operations on variables

Discuss RoboTask here
tombur
Posts: 24
Joined: Mon Aug 25, 2008 11:59 pm

operations on variables

Post 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
Last edited by tombur on Tue Aug 26, 2008 4:17 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

operations on variables

Post 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.
tombur
Posts: 24
Joined: Mon Aug 25, 2008 11:59 pm

operations on variables

Post 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 ?
tombur
Posts: 24
Joined: Mon Aug 25, 2008 11:59 pm

operations on variables

Post 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?
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

operations on variables

Post 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
tombur
Posts: 24
Joined: Mon Aug 25, 2008 11:59 pm

operations on variables

Post 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
Last edited by tombur on Tue Aug 26, 2008 5:31 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

operations on variables

Post 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.
tombur
Posts: 24
Joined: Mon Aug 25, 2008 11:59 pm

operations on variables

Post 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

Last edited by tombur on Wed Aug 27, 2008 8:17 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

operations on variables

Post 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.
tombur
Posts: 24
Joined: Mon Aug 25, 2008 11:59 pm

operations on variables

Post 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"
Post Reply