How to convert string to integer

Discuss RoboTask here
Post Reply
artyom
Posts: 2
Joined: Fri Sep 11, 2015 8:49 am

How to convert string to integer

Post by artyom »

Hello. I use RoboTask Lite and I have a question: how can i convert string variable (content of the clipboard {ClipBoardContent} ) to integer, so i can increase or decrease it?
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: How to convert string to integer

Post by Oleg »

Look at the example below:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task14"
Hide=INTEGER|0
ID=INTEGER|567220487
LogOnAsUser=INTEGER|1
Name=STRING|"1 test clipboard"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_CLIPBOARD_PUT"
Enabled=INTEGER|-1
Name=STRING|"Put Text"
Params=FOLDER

[Actions\Action1\Params]
line0=STRING|"22"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action10]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Decremented"""
Params=FOLDER

[Actions\Action10\Params]
icon=STRING|"1"
msg0=STRING|"Decremented"
msg1=STRING|"{ClipBoardContent}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Original"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"Original"
msg1=STRING|"{ClipBoardContent}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_CLIPBOARD_GET"
Enabled=INTEGER|-1
Name=STRING|"Get Text"
Params=FOLDER

[Actions\Action3\Params]
variable=STRING|"num"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""num"""
Params=FOLDER

[Actions\Action4\Params]
incement=STRING|"1"
vaiable=STRING|"num"

[Actions\Action5]
ActionID=STRING|"A_CLIPBOARD_PUT"
Enabled=INTEGER|-1
Name=STRING|"Put Text"
Params=FOLDER

[Actions\Action5\Params]
line0=STRING|"{num}"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Incremented"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"Incremented"
msg1=STRING|"{ClipBoardContent}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_CLIPBOARD_GET"
Enabled=INTEGER|-1
Name=STRING|"Get Text"
Params=FOLDER

[Actions\Action7\Params]
variable=STRING|"num"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""num"""
Params=FOLDER

[Actions\Action8\Params]
incement=STRING|"-2"
vaiable=STRING|"num"

[Actions\Action9]
ActionID=STRING|"A_CLIPBOARD_PUT"
Enabled=INTEGER|-1
Name=STRING|"Put Text"
Params=FOLDER

[Actions\Action9\Params]
line0=STRING|"{num}"
linecount=STRING|"1"
sourcetext=STRING|"1"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

Any variables of RoboTask are strings
You do not need to convert them. RoboTask make necessary transformations itself, if it's possible.
Oleg Yershov
artyom
Posts: 2
Joined: Fri Sep 11, 2015 8:49 am

Re: How to convert string to integer

Post by artyom »

Oleg wrote:Any variables of RoboTask are strings
You do not need to convert them. RoboTask make necessary transformations itself, if it's possible.
Thank you for help! Your example was very helpfull ))))
Post Reply