Page 1 of 1
Calculating with variables
Posted: Tue Dec 19, 2017 11:58 am
by deesloop
Is it possible to perform calculations on variables other than increment.
I'd like to subtract one variable from another, but it'snot working with set variable
Code: Select all
[Actions\Action19]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Get number imported"
Params=FOLDER
[Actions\Action19\Params]
expand=STRING|"0"
varname=STRING|"NUMIMPORTED"
varvalue=STRING|"{COUNTAFTER}-{COUNTBEFORE}"
Re: Calculating with variables
Posted: Tue Dec 19, 2017 1:32 pm
by Oleg
If you need to make some calculations you have to use
VB Evaluate or
JS Evaluate actions
Set variable only sets the variable with specified string and expands variables in the text
Look at the example below. Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task294"
Hide=INTEGER|0
ID=INTEGER|73528162
LogOnAsUser=INTEGER|1
Name=STRING|"calculate the expression"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""COUNTAFTER"" with value ""26"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"COUNTAFTER"
varvalue=STRING|"26"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""COUNTBEFORE"" with value ""10"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"COUNTBEFORE"
varvalue=STRING|"10"
[Actions\Action3]
ActionID=STRING|"A_SCRIPT_VBEVALUATE"
Enabled=INTEGER|-1
Name=STRING|"VB Evaluate"
Params=FOLDER
[Actions\Action3\Params]
expression=STRING|"{COUNTAFTER}-{COUNTBEFORE}"
linecount=STRING|"0"
loadfromfile=STRING|"1"
variable=STRING|"res"
[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{COUNTAFTER}-{COUNTBEFORE} = {res}"""
Params=FOLDER
[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"{COUNTAFTER}-{COUNTBEFORE} = {res}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
Re: Calculating with variables
Posted: Tue Dec 19, 2017 3:25 pm
by deesloop
Great, that's exactly what's needed