simple LOOP

Discuss RoboTask here
Post Reply
photoevents
Posts: 44
Joined: Mon Jan 01, 2024 11:21 am
Contact:

simple LOOP

Post by photoevents »

I have a variable nr_prints with value 1
How can I set that variable to an integer value?
Because, simple LOOP complains about my value not being an integer.
photoevents
Posts: 44
Joined: Mon Jan 01, 2024 11:21 am
Contact:

Re: simple LOOP

Post by photoevents »

I found that when using the dialog 'Input Box' the value is not recognized as an integer.
But when using 'custom dialog' and specifying 'numbers only' the value is recognized or can be used as an integer in simple loop.

Christian
Oleg
Site Admin
Posts: 3084
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: simple LOOP

Post by Oleg »

photoevents wrote: Tue Jun 18, 2024 12:23 pm I have a variable nr_prints with value 1
How can I set that variable to an integer value?
Because, simple LOOP complains about my value not being an integer.
it works. Take a look at the task below.
probably you doing something wrong
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1298793676
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task323"
Hide=INTEGER|0
ID=INTEGER|-1594788966
LogOnAsUser=INTEGER|1
Name=STRING|"simple loop with variables"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""a"" with value ""5"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"a"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"a"
varvalue=STRING|"5"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""b"" with value ""10"""
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"b"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"b"
varvalue=STRING|"10"

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

[Actions\Action3\Params]
_rt_variables_produced=STRING|"num"
begin=STRING|"{a}"
end=STRING|"{b}"
step=STRING|"1"
variable=STRING|"num"

[Actions\Action4]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action4\Params]
message=STRING|"{num}"
type=STRING|"3"

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

Oleg Yershov
photoevents
Posts: 44
Joined: Mon Jan 01, 2024 11:21 am
Contact:

Re: simple LOOP

Post by photoevents »

The difference is that I don't use a variable for the start value. Just typing in 1
Using custom dialog this does not matter, it seems.
Oleg
Site Admin
Posts: 3084
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: simple LOOP

Post by Oleg »

send you task, please. Probably I don't understand you.
Oleg Yershov
photoevents
Posts: 44
Joined: Mon Jan 01, 2024 11:21 am
Contact:

Re: simple LOOP

Post by photoevents »

This is the one that works, but using input box, it doesn't

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|345416516
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task12"
Hide=INTEGER|0
ID=INTEGER|991448307
LogOnAsUser=INTEGER|1
Name=STRING|"simpleloop"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=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

[Actions\Action1]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action1\Params]
case=STRING|"0"
case#1=STRING|"0"
connection=STRING|"0"
count=STRING|"2"
operator=STRING|"0"
operator#1=STRING|"0"
type=STRING|"3"
type#1=STRING|"3"
value1=STRING|"{merge_qrcode}"
value1#1=STRING|"{print_hotfolder}"

[Actions\Action2]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Ask how many prints are needed."
Params=FOLDER

[Actions\Action2\Params]
comment=STRING|"Ask how many prints are needed."

[Actions\Action3]
ActionID=STRING|"A_CUSTOM_INPUT_DIALOG"
Enabled=INTEGER|-1
Name=STRING|"Custom Input Dialog"
Params=FOLDER

[Actions\Action3\Params]
_rt_variables_produced=STRING|"DialogResult"
dialog_caption=STRING|"How many prints are required?"
dialog_height=STRING|"200"
dialog_width=STRING|"400"
field_count=STRING|"1"
field0=STRING|"{""type"":""CustomInputDialog"",""version"":""1.0"",""fieldGroups"":[{""caption"":""Field Properties"",""showCaption"":false,""fields"":[{""type"":""Simple Edit"",""labelText"":""Field Name:"",""name"":""name"",""value"":""QTY_Prints""},{""type"":""Simple Edit"",""labelText"":""Caption:"",""name"":""labelText"",""value"":""Number of Prints needed: ""},{""type"":""Simple Edit"",""labelText"":""Default Value:"",""name"":""value"",""value"":""1""},{""type"":""Checkbox"",""labelText"":""Password Input"",""name"":""passwordInput"",""value"":false},{""type"":""Checkbox"",""labelText"":""Numbers only"",""name"":""numbersOnly"",""value"":true},{""type"":""Checkbox"",""labelText"":""Required"",""name"":""required"",""value"":false}]}],""className"":""Text Edit"",""fieldName"":""QTY_Prints""}"
grid_lines=STRING|"0"
label_column_width=STRING|"140"
save_to=STRING|"DialogResult"
stop_if_cancel=STRING|"1"
vertical_layout=STRING|"0"

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

[Actions\Action4\Params]
begin=STRING|"1"
end=STRING|"{json:DialogResult.QTY_Prints}"
step=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action5\Params]
checkfile=STRING|"0"
destdir=STRING|"C:\DNP\Hot Folder\Prints\{DNP_hotfolder}"
f_count=STRING|"1"
file0=STRING|"{local_workfolder}\merged_qrcode\{filename}"
hidden=STRING|"0"
ifexists=STRING|"1"
maxtimeout=STRING|"15"
move=STRING|"0"
output=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"0"

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

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
photoevents
Posts: 44
Joined: Mon Jan 01, 2024 11:21 am
Contact:

Re: simple LOOP

Post by photoevents »

Conclusion:
If i follow your example using var "a" as start and var "b" as end value, it works.
If I type in a value by hand in the start box, it doesn't.

Christian
Oleg
Site Admin
Posts: 3084
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: simple LOOP

Post by Oleg »

If I type in a value by hand in the start box, it doesn't.
it works without problem...

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1523"
Hide=INTEGER|0
ID=INTEGER|-844986379
LogOnAsUser=INTEGER|1
Name=STRING|"Custom Input Dialog..."
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=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_CUSTOM_INPUT_DIALOG"
Enabled=INTEGER|-1
Name=STRING|"Custom Input Dialog"
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"DialogResult"
dialog_caption=STRING|"How many prints are required?"
dialog_height=STRING|"200"
dialog_width=STRING|"400"
field_count=STRING|"1"
field0=STRING|"{""type"":""CustomInputDialog"",""version"":""1.0"",""fieldGroups"":[{""caption"":""Field Properties"",""showCaption"":false,""fields"":[{""type"":""Simple Edit"",""labelText"":""Field Name:"",""name"":""name"",""value"":""QTY_Prints""},{""type"":""Simple Edit"",""labelText"":""Caption:"",""name"":""labelText"",""value"":""Number of Prints needed: ""},{""type"":""Simple Edit"",""labelText"":""Default Value:"",""name"":""value"",""value"":""1""},{""type"":""Checkbox"",""labelText"":""Password Input"",""name"":""passwordInput"",""value"":false},{""type"":""Checkbox"",""labelText"":""Numbers only"",""name"":""numbersOnly"",""value"":true},{""type"":""Checkbox"",""labelText"":""Required"",""name"":""required"",""value"":false}]}],""className"":""Text Edit"",""fieldName"":""QTY_Prints""}"
grid_lines=STRING|"0"
label_column_width=STRING|"140"
save_to=STRING|"DialogResult"
stop_if_cancel=STRING|"1"
vertical_layout=STRING|"0"

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

[Actions\Action2\Params]
_rt_variables_produced=STRING|"num"
begin=STRING|"1"
end=STRING|"{json:DialogResult.QTY_Prints}"
step=STRING|"1"
variable=STRING|"num"

[Actions\Action3]
ActionID=STRING|"A_LOG_DIALOG"
Enabled=INTEGER|-1
Name=STRING|"Log Dialog"
Params=FOLDER

[Actions\Action3\Params]
line00000000=STRING|"{num}"
linecount=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
photoevents
Posts: 44
Joined: Mon Jan 01, 2024 11:21 am
Contact:

Re: simple LOOP

Post by photoevents »

Okay, thanks.

Christian
Post Reply