Array of integer

Discuss RoboTask here
Post Reply
RaulAlonso
Posts: 1
Joined: Wed May 20, 2020 10:45 am

Array of integer

Post by RaulAlonso »

Hi

Can somebody help me please
I am trying to create an array of integers and then use the increment
function for each one of the array cells with loop, each time i am getting
an error "not valid integer value" or "Illegal name of variable"

Thank you
Last edited by RaulAlonso on Thu Aug 13, 2020 11:29 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Array of integer

Post by Oleg »

RoboTask doesn't support arrays.
But you can use indexed variables. For example MyVar1, MyVar2, ...., MyVarN

Look at the small example below how to set values to the indexed variables in the loop and increment values in the loop
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|448832495
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task221"
Hide=INTEGER|0
ID=INTEGER|-334982463
LogOnAsUser=INTEGER|1
Name=STRING|"indexed variables (increment)"
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
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER

[Actions\Action1\Params]
begin=STRING|"1"
end=STRING|"10"
variable=STRING|"NUM"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MYVAR{NUM}"" with value ""{num}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"MYVAR{NUM}"
varvalue=STRING|"{num}"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Initial values"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"Initial values"
msg1=STRING|"MyVar1 = {MyVar1}"
msg10=STRING|"MyVar10 = {MyVar10}"
msg2=STRING|"MyVar2 = {MyVar2}"
msg3=STRING|"MyVar3 = {MyVar3}"
msg4=STRING|"MyVar4 = {MyVar4}"
msg5=STRING|"MyVar5 = {MyVar5}"
msg6=STRING|"MyVar6 = {MyVar6}"
msg7=STRING|"MyVar7 = {MyVar7}"
msg8=STRING|"MyVar8 = {MyVar8}"
msg9=STRING|"MyVar9 = {MyVar9}"
msgcount=STRING|"11"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Now we increment all variables by 1"
Params=FOLDER

[Actions\Action5\Params]
comment=STRING|"Now we increment all variables by 1"

[Actions\Action6]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER

[Actions\Action6\Params]
begin=STRING|"1"
end=STRING|"10"
variable=STRING|"NUM"

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

[Actions\Action7\Params]
incement=STRING|"1"
vaiable=STRING|"MyVar{num}"

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action9]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""After incremental"""
Params=FOLDER

[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"After incremental"
msg1=STRING|"MyVar1 = {MyVar1}"
msg10=STRING|"MyVar10 = {MyVar10}"
msg2=STRING|"MyVar2 = {MyVar2}"
msg3=STRING|"MyVar3 = {MyVar3}"
msg4=STRING|"MyVar4 = {MyVar4}"
msg5=STRING|"MyVar5 = {MyVar5}"
msg6=STRING|"MyVar6 = {MyVar6}"
msg7=STRING|"MyVar7 = {MyVar7}"
msg8=STRING|"MyVar8 = {MyVar8}"
msg9=STRING|"MyVar9 = {MyVar9}"
msgcount=STRING|"11"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Post Reply