Problems copy/Move files

Discuss RoboTask here
Post Reply
arteta2k
Posts: 1
Joined: Mon May 04, 2020 10:42 am

Problems copy/Move files

Post by arteta2k »

Hello, i'm a reseller of robotask from Spain. We have a problem with one of our coustomers.
They have a rip software that export PDF files to another folder. The rip first create the end file with 0kb and this file is growing. The final file can be any size from 20 Mb to 1,2,3...Gb and the computer can take a long and variable time to create the file.
They have a Cyclic task that every 100 seconds move this file to another computer way network that make a conversion of the PDF file and the problem is that the robotask try to move the incomplete file every 100 seconds and move bad files to the another computer making this crash.
How can we make that robotask detect that the file is complete and move it at that time?
Thanks
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Problems copy/Move files

Post by Oleg »

Look at {IsFileFree(<full_file_name>)} variable.
Returns False if the file is occupied by another process. For example if file being copied at this moment.
If file is completely free it returns True
Also look at small example below
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|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task170"
Hide=INTEGER|0
ID=INTEGER|685754357
LogOnAsUser=INTEGER|1
Name=STRING|"check the file"
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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FILENAME"" with value ""D:\Temp\Test.pdf"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"FILENAME"
varvalue=STRING|"D:\Temp\Test.pdf"

[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|"0"
type=STRING|"3"
value1=STRING|"{IsFileFree({FileName})}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""You can copy this file"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"You can copy this file"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File is NOT FREE!!!"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"3"
msg0=STRING|"File is NOT FREE!!!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

Also you can use Wait for file action to wait until the file will be available
Oleg Yershov
Post Reply