How to stop a task when files no longer exist to copy?
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
How to stop a task when files no longer exist to copy?
Hello could you help me again? I created a simple task to copy some files from one folder to another, then I deleted the files from the source folder and ran the task again, and robotask completed the task again without errors, it wasn't to warn that the files in the folder no longer exist ? thankful.
Re: How to stop a task when files no longer exist to copy?
Use something like this
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.
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|799397369
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task36"
Hide=INTEGER|0
ID=INTEGER|-2089420202
LogOnAsUser=INTEGER|1
Name=STRING|"Copy files and warning"
OnErrorTaskID=INTEGER|-1
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_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""source"" with value ""c:\incoming"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"source"
varvalue=STRING|"c:\incoming"
[Actions\Action10]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""dest"" with value ""c:\dest"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"dest"
varvalue=STRING|"c:\dest"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""isEmpty"" with value ""true"""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"isEmpty"
varvalue=STRING|"true"
[Actions\Action4]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action4\Params]
createmode=STRING|"1"
date1=STRING|"20230102"
date2=STRING|"20230102"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{Source}\*.txt"
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|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""isempty"" with value ""false"""
Params=FOLDER
[Actions\Action5\Params]
expand=STRING|"0"
varname=STRING|"isempty"
varvalue=STRING|"false"
[Actions\Action6]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER
[Actions\Action6\Params]
destdir=STRING|"{dest}"
f_count=STRING|"1"
file0=STRING|"{filename}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"1"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"
[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsEmpty}"
[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action9\Params]
message=STRING|"No files to copy"
type=STRING|"2"
Oleg Yershov
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Re: How to stop a task when files no longer exist to copy?
Hello...It worked perfectly, but taking advantage of the post, why don't tasks disable when the error occurs? in all tasks this happens .. what am I not doing right? How to disable the task if the error occurs?
- Attachments
-
- print3.jpg (122.63 KiB) Viewed 8302 times
-
- print4.jpg (85.76 KiB) Viewed 8302 times
-
- print5.jpg (70.98 KiB) Viewed 8302 times
Re: How to stop a task when files no longer exist to copy?
Just put the Disable Task action to disable task
Oleg Yershov
Re: How to stop a task when files no longer exist to copy?
Do you see/try my example? It seems not...
Oleg Yershov
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Re: How to stop a task when files no longer exist to copy?
Hello, thanks. I followed your example yes, but I still couldn't make it so that when an error was presented in the task, the task would be disabled. It would be a way to show that the task gave an error and did not continue
Re: How to stop a task when files no longer exist to copy?
Version 9.4 has modified Exit action
You can generate your custom error.
Version 9.4 released yesterday (at 2023-01-03). Download and install it.
You can generate your custom error.
Version 9.4 released yesterday (at 2023-01-03). Download and install it.
Oleg Yershov
Re: How to stop a task when files no longer exist to copy?
Your task will be like this
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|799397369
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|1
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task36"
Hide=INTEGER|0
ID=INTEGER|-2089420202
LogOnAsUser=INTEGER|1
Name=STRING|"Copy files and warning (for ver 9.4)"
OnErrorTaskID=INTEGER|-1
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_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""source"" with value ""c:\incoming"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"source"
varvalue=STRING|"c:\incoming"
[Actions\Action10]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""dest"" with value ""c:\dest"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"dest"
varvalue=STRING|"c:\dest"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""isEmpty"" with value ""true"""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"isEmpty"
varvalue=STRING|"true"
[Actions\Action4]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action4\Params]
createmode=STRING|"1"
date1=STRING|"20230102"
date2=STRING|"20230102"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{Source}\*.txt"
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|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""isempty"" with value ""false"""
Params=FOLDER
[Actions\Action5\Params]
expand=STRING|"0"
varname=STRING|"isempty"
varvalue=STRING|"false"
[Actions\Action6]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER
[Actions\Action6\Params]
destdir=STRING|"{dest}"
f_count=STRING|"1"
file0=STRING|"{filename}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"1"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"
[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsEmpty}"
[Actions\Action9]
ActionID=STRING|"A_FLOW_EXIT"
Enabled=INTEGER|-1
Name=STRING|"Exit with error"
Params=FOLDER
[Actions\Action9\Params]
errorcode=STRING|"1"
errormessage=STRING|"No files to copy"
mode=STRING|"1"
Oleg Yershov
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Re: How to stop a task when files no longer exist to copy?
Hi, sorry for the delay in getting back to you. I tested this feature in version 9.4, it's working perfectly, excellent. Thank you very much!Oleg wrote: ↑Wed Jan 04, 2023 8:44 am Your task will be like thisCode: Select all
;***************************** ;* RoboTask Task file ;* Do not edit in text editor! ;***************************** [Root] ActionAfterRun=INTEGER|0 Actions=FOLDER Automat=INTEGER|0 CatID=INTEGER|799397369 Comment=STRINGLIST ContinueOnError=INTEGER|0 DisableOnError=INTEGER|1 DoNotStopWhenShutdown=INTEGER|0 ExternalName=STRING|"Task36" Hide=INTEGER|0 ID=INTEGER|-2089420202 LogOnAsUser=INTEGER|1 Name=STRING|"Copy files and warning (for ver 9.4)" OnErrorTaskID=INTEGER|-1 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_VARIABLES_SET" Enabled=INTEGER|-1 Name=STRING|"Set variable ""source"" with value ""c:\incoming""" Params=FOLDER [Actions\Action1\Params] expand=STRING|"0" varname=STRING|"source" varvalue=STRING|"c:\incoming" [Actions\Action10] ActionID=STRING|"A_FLOW_ENDIF" Enabled=INTEGER|-1 Name=STRING|"End If" [Actions\Action2] ActionID=STRING|"A_VARIABLES_SET" Enabled=INTEGER|-1 Name=STRING|"Set variable ""dest"" with value ""c:\dest""" Params=FOLDER [Actions\Action2\Params] expand=STRING|"0" varname=STRING|"dest" varvalue=STRING|"c:\dest" [Actions\Action3] ActionID=STRING|"A_VARIABLES_SET" Enabled=INTEGER|-1 Name=STRING|"Set variable ""isEmpty"" with value ""true""" Params=FOLDER [Actions\Action3\Params] expand=STRING|"0" varname=STRING|"isEmpty" varvalue=STRING|"true" [Actions\Action4] ActionID=STRING|"A_LOOP_FILE" Enabled=INTEGER|-1 Name=STRING|"File Loop" Params=FOLDER [Actions\Action4\Params] createmode=STRING|"1" date1=STRING|"20230102" date2=STRING|"20230102" destvar=STRING|"FILENAME" DuringDays=STRING|"1" DuringHours=STRING|"1" DuringMinutes=STRING|"1" DuringMonths=STRING|"1" file0=STRING|"{Source}\*.txt" 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|"1" timesize=STRING|"0" WithoutPath=STRING|"0" [Actions\Action5] ActionID=STRING|"A_VARIABLES_SET" Enabled=INTEGER|-1 Name=STRING|"Set variable ""isempty"" with value ""false""" Params=FOLDER [Actions\Action5\Params] expand=STRING|"0" varname=STRING|"isempty" varvalue=STRING|"false" [Actions\Action6] ActionID=STRING|"A_FILE_COPY" Enabled=INTEGER|-1 Name=STRING|"Copy/Move File" Params=FOLDER [Actions\Action6\Params] destdir=STRING|"{dest}" f_count=STRING|"1" file0=STRING|"{filename}" hidden=STRING|"1" ifexists=STRING|"1" move=STRING|"1" rename=STRING|"0" renamemask=STRING|"*.*.new" subdir=STRING|"0" system=STRING|"1" [Actions\Action7] ActionID=STRING|"A_LOOP_END" Enabled=INTEGER|-1 Name=STRING|"End Loop" [Actions\Action8] ActionID=STRING|"A_FLOW_IF" Enabled=INTEGER|-1 Name=STRING|"If Then" Params=FOLDER [Actions\Action8\Params] case=STRING|"0" connection=STRING|"0" count=STRING|"1" operator=STRING|"0" type=STRING|"3" value1=STRING|"{IsEmpty}" [Actions\Action9] ActionID=STRING|"A_FLOW_EXIT" Enabled=INTEGER|-1 Name=STRING|"Exit with error" Params=FOLDER [Actions\Action9\Params] errorcode=STRING|"1" errormessage=STRING|"No files to copy" mode=STRING|"1"