Page 1 of 2
operations on variables
Posted: Tue Aug 26, 2008 12:16 am
by tombur
hi.i have a question about making operations on variables.for eg. i have three variables : variable1,variable2,variable3 and i want variable2 to be 'variable1' * 0.007 (0.7 % of variable1) and variable3 to be 'variable1' minus 'variable2'robotask can do it for me ???sorry for my bad english
operations on variables
Posted: Tue Aug 26, 2008 12:46 am
by Oleg
Yes, of course. But you have to use Basic plugin.
Look at "Evaluate" action.
Basic plugin is not included to general package, but you may download and install it in addition. See here.
operations on variables
Posted: Tue Aug 26, 2008 4:26 am
by tombur
OK thank you . now it works preety well but i have another problem because it only works for digits eg. 2 , 5 , 20 and not for 2,5 3,29 any ideas ?
operations on variables
Posted: Tue Aug 26, 2008 4:51 am
by tombur
the problem is in comma (,) instead of dot (.) but program within robotask will perform this task displays numbers with comma not a dot. is there any way to change comma to dot with robotask?
operations on variables
Posted: Tue Aug 26, 2008 5:25 am
by Oleg
Look at the function REPLACE in basic.
You may to use it in the "evaluate" action too.
For example: replace("5,2",",",".") - result is 5.2
operations on variables
Posted: Tue Aug 26, 2008 1:30 pm
by tombur
In my task numeric value for example 5,2 is copied to clipboard and becames variable1. then evaluating variable1*0.007 into variable2.the content of vriable1 must be changed from 5,2 to 5.2 before evaluating. how can I change value of this variable ? by using function set variable or maybe this change will take place in clipboard? I do not know where I must put that basic function replace. maybe I am too stupid to do this
operations on variables
Posted: Tue Aug 26, 2008 10:59 pm
by Oleg
Loook at the Evaluate action.
you may write the following expression:
replace("{variable1}",",",".")
and assign the result back to variable1
In the expression you may use macros like "{var_name}" too. (variable bame in curly brackets "{}")
Your task will be such
get from clipboard into variable1
evaluate replace("{variable1}",",",".") and assign to variable1
evaluate {variable1}*0.007 and assign to variable2
etc.
operations on variables
Posted: Wed Aug 27, 2008 12:18 am
by tombur
hi it's me again the task works fine now but if Robotask works in system try (minimized) my task does not work
operations on variables
Posted: Wed Aug 27, 2008 7:55 am
by Oleg
Make sure that the task is enabled and hot-key doesn't conflict with another task or application. You can register hot-key combination only once in your system.
Also, can I see your final task in order I be able to test it?
My RoboTask is always minimized in system tray and it works fine.
operations on variables
Posted: Wed Aug 27, 2008 11:50 pm
by tombur
robotask working and there is no hot-key conflict. only one task exists and is enabled with this hot-key .The way to solve this problem is to add a command Restore Robotask on top of my task and it helps.this is my task:;*****************************;* RoboTask Task file ;* Do not edit in text editor!;***************************** [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|-1CatID=INTEGER|1981091247ContinueOnError=INTEGER|0Events=FOLDERExternalName=STRING|"Task5"Hide=INTEGER|0ID=INTEGER|1241965760Name=STRING|"UPUST 0.5 - sbterm"Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3WriteGeneralLog=INTEGER|0[Actions]Action1=FOLDERAction10=FOLDERAction11=FOLDERAction12=FOLDERAction13=FOLDERAction14=FOLDERAction15=FOLDERAction16=FOLDERAction17=FOLDERAction18=FOLDERAction19=FOLDERAction2=FOLDERAction3=FOLDERAction4=FOLDERAction5=FOLDERAction6=FOLDERAction7=FOLDERAction8=FOLDERAction9=FOLDER[Actions\Action1]ActionID=STRING|"A_ROBOTASK_RESTORE"Enabled=INTEGER|-1Name=STRING|"Restore RoboTask"[Actions\Action10]ActionID=STRING|"BASIC_EVALUATE"Enabled=INTEGER|-1Name=STRING|"Evaluate"Params=FOLDER[Actions\Action10\Params]expression=STRING|"{WAGA1}*0.005"variable=STRING|"{UPUST}"[Actions\Action11]ActionID=STRING|"BASIC_EVALUATE"Enabled=INTEGER|-1Name=STRING|"Evaluate"Params=FOLDER[Actions\Action11\Params]expression=STRING|"{WAGA1}-{UPUST}"variable=STRING|"{WAGA2}"[Actions\Action12]ActionID=STRING|"A_CLIPBOARD_CLEAR"Enabled=INTEGER|-1Name=STRING|"Clear Clipboard"[Actions\Action13]ActionID=STRING|"A_CLIPBOARD_PUT"Enabled=INTEGER|-1Name=STRING|"Put Text"Params=FOLDER[Actions\Action13\Params]line0=STRING|"{WAGA2}"linecount=STRING|"1"sourcetext=STRING|"1"[Actions\Action14]ActionID=STRING|"A_VARIABLES_REMOVE"Enabled=INTEGER|-1Name=STRING|"Remove variable ""WAGA1"""Params=FOLDER[Actions\Action14\Params]varname=STRING|"WAGA1"[Actions\Action15]ActionID=STRING|"A_VARIABLES_REMOVE"Enabled=INTEGER|-1Name=STRING|"Remove variable ""WAGA2"""Params=FOLDER[Actions\Action15\Params]varname=STRING|"WAGA2"[Actions\Action16]ActionID=STRING|"A_VARIABLES_REMOVE"Enabled=INTEGER|-1Name=STRING|"Remove variable ""UPUST"""Params=FOLDER[Actions\Action16\Params]varname=STRING|"UPUST"[Actions\Action17]ActionID=STRING|"A_GENERAL_SENDKEYS"Enabled=INTEGER|-1Name=STRING|"Send keys to ""sbterm"""Params=FOLDER[Actions\Action17\Params]currentwindow=STRING|"0"fixedwindow=STRING|"0"keylayout=STRING|"0"keys=STRING|"{ENTER}"sendkind=STRING|"0"wincaption=STRING|"sbterm"[Actions\Action18]ActionID=STRING|"A_CLIPBOARD_PASTE"Enabled=INTEGER|-1Name=STRING|"Paste"Params=FOLDER[Actions\Action18\Params]mode=STRING|"1"[Actions\Action19]ActionID=STRING|"A_CLIPBOARD_CLEAR"Enabled=INTEGER|-1Name=STRING|"Clear Clipboard"[Actions\Action2]ActionID=STRING|"A_CLIPBOARD_CLEAR"Enabled=INTEGER|-1Name=STRING|"Clear Clipboard"[Actions\Action3]ActionID=STRING|"A_GENERAL_SENDKEYS"Enabled=INTEGER|-1Name=STRING|"Send keys to ""sbterm"""Params=FOLDER[Actions\Action3\Params]currentwindow=STRING|"0"fixedwindow=STRING|"0"keylayout=STRING|"0"keys=STRING|"{ENTER}"sendkind=STRING|"0"wincaption=STRING|"sbterm"[Actions\Action4]ActionID=STRING|"A_CLIPBOARD_COPY"Enabled=INTEGER|-1Name=STRING|"Copy"Params=FOLDER[Actions\Action4\Params]mode=STRING|"1"[Actions\Action5]ActionID=STRING|"A_GENERAL_SENDKEYS"Enabled=INTEGER|-1Name=STRING|"Send keys to ""sbterm"""Params=FOLDER[Actions\Action5\Params]currentwindow=STRING|"0"fixedwindow=STRING|"0"keylayout=STRING|"0"keys=STRING|"{ENTER}"sendkind=STRING|"0"wincaption=STRING|"sbterm"[Actions\Action6]ActionID=STRING|"A_VARIABLES_CREATE"Enabled=INTEGER|-1Name=STRING|"Create variable ""WAGA1"" with value ""{ClipBoardContent}"""Params=FOLDER[Actions\Action6\Params]expand=STRING|"0"varname=STRING|"WAGA1"varvalue=STRING|"{ClipBoardContent}"[Actions\Action7]ActionID=STRING|"A_VARIABLES_CREATE"Enabled=INTEGER|-1Name=STRING|"Create variable ""UPUST"" with value """""Params=FOLDER[Actions\Action7\Params]expand=STRING|"0"varname=STRING|"UPUST"[Actions\Action8]ActionID=STRING|"A_VARIABLES_CREATE"Enabled=INTEGER|-1Name=STRING|"Create variable ""WAGA2"" with value """""Params=FOLDER[Actions\Action8\Params]expand=STRING|"0"varname=STRING|"WAGA2"[Actions\Action9]ActionID=STRING|"BASIC_EVALUATE"Enabled=INTEGER|-1Name=STRING|"Evaluate"Params=FOLDER[Actions\Action9\Params]expression=STRING|"replace(""{WAGA1}"","","",""."")"variable=STRING|"{WAGA1}"[Events]Event1=FOLDER[Events\Event1]Enabled=INTEGER|-1EventID=STRING|"E_GENERAL_HOTKEY"Params=FOLDER[Events\Event1\Params]hotkey=STRING|"32884"