Need help for a simple task
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Need help for a simple task
Hello, please help me: When creating a task for robotask to delete files, and when running the task the files are no longer in the folder, robotask says that the task was successfully executed....which command do I use for which robotask not complete task? I have a little difficulty, since robotask has no translation in my PT-BR language. can you help me again?
Re: Need help for a simple task
I don't understand a little...
The task is trying to delete some files, but the files do not exist. Correct?
What is the problem? This is normal situation and the task has finished successfully.
The task is trying to delete some files, but the files do not exist. Correct?
What is the problem? This is normal situation and the task has finished successfully.
Oleg Yershov
Re: Need help for a simple task
Maybe you should check for the existence of the files first
Oleg Yershov
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Re: Need help for a simple task
Sorry for the delay to reply. I would like the task to display a runtime error, because the files were not deleted, and send me an email about the error. I do not know if i was clear.
Re: Need help for a simple task
Do you want an action to throw an error if it can't delete a file?
Ok I wrote this into our ToDo.
The action writes a warning only to the log
But now you can check the file existence after delete step.
If file does not exist then OK, if exists - you can generate the error (see Exit action) or send email
Ok I wrote this into our ToDo.
The action writes a warning only to the log
But now you can check the file existence after delete step.
If file does not exist then OK, if exists - you can generate the error (see Exit action) or send email
Oleg Yershov
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Re: Need help for a simple task
I made a video showing, if the teste.txt file was no longer in the "test" folder and the option stop task execution in if error occurred, was checked, why didn't robotask stop the task? is there something i am doing wrong?
https://imgur.com/a/h3Mwps2
https://imgur.com/a/h3Mwps2
Re: Need help for a simple task
Initially the folder is empty
You are trying to delete a non-existent file
It's not an error. The file does not exist in the folder after the task. So, the operation is completed.
I think that you should check the file existence before delete operation and after.
Look at the example below. 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.
Then you can see it in task editor.
You are trying to delete a non-existent file
It's not an error. The file does not exist in the folder after the task. So, the operation is completed.
I think that you should check the file existence before delete operation and after.
Look at the example below. 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.
Then you can see it in task editor.
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|"Task14"
Hide=INTEGER|0
ID=INTEGER|-2081236730
LogOnAsUser=INTEGER|1
Name=STRING|"Delete file with checking"
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
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""filename"" with value ""C:\temp\test.txt"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"filename"
varvalue=STRING|"C:\temp\test.txt"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{FileExists({FileName})}"
[Actions\Action3]
ActionID=STRING|"A_FLOW_EXIT"
Enabled=INTEGER|-1
Name=STRING|"Exit with error"
Params=FOLDER
[Actions\Action3\Params]
errorcode=STRING|"1"
errormessage=STRING|"File {FileName} does not exist"
mode=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action5]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER
[Actions\Action5\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
deletereadonly=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"
[Actions\Action6]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action6\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists({FileName})}"
[Actions\Action7]
ActionID=STRING|"A_FLOW_EXIT"
Enabled=INTEGER|-1
Name=STRING|"Exit with error"
Params=FOLDER
[Actions\Action7\Params]
errorcode=STRING|"1"
errormessage=STRING|"File {FileName} can not be deleted"
mode=STRING|"1"
[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
Oleg Yershov
-
- Posts: 53
- Joined: Fri Dec 30, 2022 2:43 am
Re: Need help for a simple task
You are a genius Oleg, it worked perfectly! I did that and set variable C:\temp\*.*, and in delete file to include any file, and when running the task, because I didn't have any files in the folder, the task disabled, I'm your admirer. Thank you very much