How can I change a string value to an integer?
for example I have a string {TIMEEDITMIN} that contains "10" but when I try to use IF...THEN and compare it as a number I get an error saying "Value "TIMEEDITMIN" it is not a number value."
String to Interger
Re: String to Interger
I'm afraid that your variable contain a non integer value. Maybe some other extra symbols or empty value.
Try to put "Show Message" action before if-then with expression |{TIMEEDITMIN}|
You should see |10|
This error means that the current value can't be transformed into into numeric value. As a rule this value is empty or contains incorrect symbols
Maybe you put variable without {}. In this case the action uses the expression AS IS. Show me your example.
Look my example below. It uses correct and incorrect values:
Save the text of task into a file and use menu Task -> Import
Try to put "Show Message" action before if-then with expression |{TIMEEDITMIN}|
You should see |10|
This error means that the current value can't be transformed into into numeric value. As a rule this value is empty or contains incorrect symbols
Maybe you put variable without {}. In this case the action uses the expression AS IS. Show me your example.
Look my example below. It uses correct and incorrect values:
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1239974297
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task625"
Hide=INTEGER|0
ID=INTEGER|643905856
LogOnAsUser=INTEGER|1
Name=STRING|"If Then..."
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""AAA"" with value ""{chr(32)}10{chr(32)}{EOL}"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"AAA"
varvalue=STRING|"{chr(32)}10{chr(32)}{EOL}"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{aaa}"
value2=STRING|"10"
[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Value is 10"""
Params=FOLDER
[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"Value is 10"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""AAA"" with value """""
Params=FOLDER
[Actions\Action5\Params]
expand=STRING|"0"
varname=STRING|"AAA"
[Actions\Action6]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action6\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{aaa}"
value2=STRING|"10"
[Actions\Action7]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Value is 10"""
Params=FOLDER
[Actions\Action7\Params]
icon=STRING|"1"
msg0=STRING|"Value is 10"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
Oleg Yershov