InputBox not empty Loop

Discuss RoboTask here
Post Reply
gremlin
Posts: 35
Joined: Sun Jan 08, 2023 3:13 pm

InputBox not empty Loop

Post by gremlin »

Hy,
I try to use a loop with a Input Box.
So now empty or cancel option possible...
Snipaste_2023-01-23_17-28-15.png
Snipaste_2023-01-23_17-28-15.png (13.57 KiB) Viewed 1488 times
Snipaste_2023-01-23_17-28-26.png
Snipaste_2023-01-23_17-28-26.png (9.88 KiB) Viewed 1488 times
It´s a infinity loop, also when I choose "Is not empty"
Anyone had a idea ?

Thanks

Steven
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: InputBox not empty Loop

Post by Oleg »

Look at my example. It works.
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|693415217
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task46"
Hide=INTEGER|0
ID=INTEGER|1234854598
LogOnAsUser=INTEGER|1
Name=STRING|"Loop with input-box"
OnErrorTaskID=INTEGER|1879502808
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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MyVal"" with value ""Some nonempty value to enter to the loop"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"MyVal"
varvalue=STRING|"Some nonempty value to enter to the loop"

[Actions\Action2]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|-1
Name=STRING|"While loop"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"8"
type=STRING|"0"
value1=STRING|"{MyVal}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action3\Params]
password=STRING|"0"
prompt=STRING|"Input the walue"
stopifcancel=STRING|"0"
variable=STRING|"MYVAL"

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

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

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

Maybe you made some logical error in your task. May I look at your task?
Oleg Yershov
gremlin
Posts: 35
Joined: Sun Jan 08, 2023 3:13 pm

Re: InputBox not empty Loop

Post by gremlin »

Hy,
sorry your example doesn`t work for me.
I would have a inputbox, with requires a input. No option to skip or empty entry.
Do you have a idea ? I can´t get it work..

Thanks
Steven
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: InputBox not empty Loop

Post by Oleg »

Maybe I don't understand your goal...
My example ask you to input some value. If value is empty or you press ESC or Cancel button the task beaks the loop and finish.
Probably you want to realize some other algorithm.
No option to skip or empty entry.
Do you want to skip and continue to enter next value?
How do you want to finish task?
In this case you will have infinite loop...

But you can enter some key-work. For example "end" or "stop" to stop the task
Oleg Yershov
gremlin
Posts: 35
Joined: Sun Jan 08, 2023 3:13 pm

Re: InputBox not empty Loop

Post by gremlin »

Hy,
sorry for my bad description.
I would have a input box which doesn´t accept a empty value.
Thanks
Steven
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: InputBox not empty Loop

Post by Oleg »

Maybe something like this:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|799397369
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task17"
Hide=INTEGER|0
ID=INTEGER|488131522
LogOnAsUser=INTEGER|1
Name=STRING|"Input box"
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_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MyVar"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"0"
varname=STRING|"MyVar"

[Actions\Action2]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|-1
Name=STRING|"While loop"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"7"
type=STRING|"0"
value1=STRING|"{MyVar}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action3\Params]
default=STRING|"none"
password=STRING|"0"
prompt=STRING|"Input some non-empty value"
stopifcancel=STRING|"0"
variable=STRING|"MYVAR"

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{MyVar}"
value2=STRING|"None"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""You press Cancel button!"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"0"
msg0=STRING|"You press Cancel button!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action8]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Entered value: {MyVar}"""
Params=FOLDER

[Actions\Action8\Params]
icon=STRING|"1"
msg0=STRING|"Entered value: {MyVar}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
Oleg Yershov
gremlin
Posts: 35
Joined: Sun Jan 08, 2023 3:13 pm

Re: InputBox not empty Loop

Post by gremlin »

Hy, thank you for this sample.
When I press cancel , the Popup tell me "I press cancel". Thanks good.
But the Task end.
I need a loop. Where a empty or "cancel" option are not possible.

This is my Task:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|720234516
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task15"
Hide=INTEGER|0
ID=INTEGER|953570178
LogOnAsUser=INTEGER|1
Name=STRING|"Rechnungsnummer"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
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_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20230123"
date2=STRING|"20230123"
destvar=STRING|"PDFDATEIEN"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"c:\Sharepoint\Schreiner GmbH & Co. KG\Strandkorb-King - Dokumente\Scan\PC-BUERO1\*.pdf"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action2]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""msedge.exe ""{PDFDATEIEN}"""""
Params=FOLDER

[Actions\Action2\Params]
ifnonzero=STRING|"0"
params=STRING|"""{PDFDATEIEN}"""
program=STRING|"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
runas=STRING|"0"
wait=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|0
Name=STRING|"While loop"
Params=FOLDER

[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"1"
count=STRING|"1"
operator=STRING|"7"
type=STRING|"0"
value1=STRING|"{RECHNUNGSNUMMER}"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action4\Params]
password=STRING|"0"
prompt=STRING|"Rechnungsnummer:"
stopifcancel=STRING|"0"
variable=STRING|"RECHNUNGSNUMMER"

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

[Actions\Action6]
ActionID=STRING|"A_MISC_KILLAPP"
Enabled=INTEGER|-1
Name=STRING|"Terminate process ""C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"""
Params=FOLDER

[Actions\Action6\Params]
more=STRING|"2"
process=STRING|"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"

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

[Actions\Action7\Params]
destdir=STRING|"c:\Sharepoint\Schreiner GmbH & Co. KG\Strandkorb-King - Dokumente\JTL2Datev\ek-belege original\"
f_count=STRING|"1"
file0=STRING|"{PDFDATEIEN}"
hidden=STRING|"1"
ifexists=STRING|"0"
move=STRING|"0"
rename=STRING|"1"
renamemask=STRING|"{RECHNUNGSNUMMER}.pdf"
subdir=STRING|"0"
system=STRING|"1"

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

[Actions\Action8\Params]
expand=STRING|"0"
linecount=STRING|"0"
varname=STRING|"RECHNUNGSNUMMER"

[Actions\Action9]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action9\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
deletereadonly=STRING|"1"
file0=STRING|"{PDFDATEIEN}"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Name=STRING|"File Monitor"
Params=FOLDER
UniqueID=INTEGER|-2004472469

[Events\Event1\Params]
chg=STRING|"0"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"0"
folder1=STRING|"c:\Sharepoint\Schreiner GmbH & Co. KG\Strandkorb-King - Dokumente\Scan\PC-BUERO1\"
foldercount=STRING|"1"
incmask=STRING|"*.pdf"
interval=STRING|"15"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
notsavestatus=STRING|"0"
pass=STRING|"0"
passmode=STRING|"1"
required=STRING|"0"
saveresults=STRING|"0"
subfolders1=STRING|"0"
Post Reply