Sample script for File Monitor demo 2nd edition HELP

Discuss RoboTask here
Post Reply
renders
Posts: 11
Joined: Tue Oct 02, 2018 7:47 pm

Sample script for File Monitor demo 2nd edition HELP

Post by renders »

Hello.. I am trying to use the sample script called, Mail list of new files (File monitor demo) 2-nd edition and am having troubles. I have included my modified version with # for private info.

Basically, I want to monitor 4 folders on our NAS and when a wav file appears, I want to move the file to another folder on another server and then send an email with the name of the file.

Issue is with the file transfer, email section works perfectly..

Any help is appreciated..

Thanks
Rob

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|2
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task15"
Hide=INTEGER|0
ID=INTEGER|1839340077
LocalVariables=STRING|"list=,subj="
LogOnAsUser=INTEGER|1
Name=STRING|"Monitor ProdBox Import"
OnErrorTaskID=INTEGER|-396267805
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|0
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=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|"20120910"
date2=STRING|"20120910"
destvar=STRING|"CFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\nas-1\Prodbox\Chatham\Import\*.wav"
file1=STRING|"\\nas-1\Prodbox\Sarnia\Import\*.wav"
file2=STRING|"\\nas-1\Prodbox\London\Import\*.wav"
file3=STRING|"\\nas-1\Prodbox\Windsor\Import\*.wav"
filecount=STRING|"4"
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\Action10]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action10\Params]
Count=STRING|"4"
deletedirs=STRING|"0"
file0=STRING|"\\nas-1\Prodbox\Chatham\Import\*.pkf"
file1=STRING|"\\nas-1\Prodbox\Sarnia\Import\*.pkf"
file2=STRING|"\\nas-1\Prodbox\London\Import\*.pkf"
file3=STRING|"\\nas-1\Prodbox\Windsor\Import\*.pkf"
hidden=STRING|"0"
subdir=STRING|"0"
system=STRING|"0"
ToRecycleBin=STRING|"0"

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

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LIST"" with value ""{list}{cfile}{EOL}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"LIST"
varvalue=STRING|"{list}{cfile}{EOL}"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SUBJ"" with value ""{SUBJ} {ExtractFileNameNoExt({cfile})},"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varname=STRING|"SUBJ"
varvalue=STRING|"{SUBJ} {ExtractFileNameNoExt({cfile})},"

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

[Actions\Action5]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action5\Params]
custom=STRING|"1"
customchar=STRING|","
eol=STRING|"0"
lead=STRING|"1"
source=STRING|"{subj}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"subj"

[Actions\Action6]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action6\Params]
custom=STRING|"0"
eol=STRING|"1"
lead=STRING|"1"
source=STRING|"{list}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"list"

[Actions\Action7]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|-1
Name=STRING|"Send Email"
Params=FOLDER

[Actions\Action7\Params]
attachcount=STRING|"1"
auth=STRING|"1"
charset=STRING|"iso-8859-1"
from=STRING|"#@#.com"
host=STRING|"#.com"
html=STRING|"0"
msg0=STRING|"New files imported"
msg1=STRING|"{list}"
msgcount=STRING|"2"
password=STRING|"#"
port=STRING|"25"
priority=STRING|"1"
receipt=STRING|"0"
SSL=STRING|"0"
subject=STRING|"ProdBox Files Imported: {subj}"
to=STRING|"#@#.com"
user=STRING|"#@#.com"

[Actions\Action8]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action8\Params]
createmode=STRING|"1"
date1=STRING|"20120910"
date2=STRING|"20120910"
destvar=STRING|"CFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\nas-1\Prodbox\Chatham\Import\*.wav"
file1=STRING|"\\nas-1\Prodbox\Sarnia\Import\*.wav"
file2=STRING|"\\nas-1\ProdboxLondon\Import\*.wav"
file3=STRING|"\\nas-1\Prodbox\Windsor\Import\*.wav"
filecount=STRING|"4"
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\Action9]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action9\Params]
destdir=STRING|"O:\AudioImport\"
f_count=STRING|"1"
file0=STRING|"{cfile}"
hidden=STRING|"0"
ifexists=STRING|"0"
move=STRING|"1"
rename=STRING|"0"
subdir=STRING|"0"
system=STRING|"0"

[Events]
Event1=FOLDER

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

[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|"\\nas-1\Prodbox\Chatham\Import\"
folder2=STRING|"\\nas-1\Prodbox\Sarnia\Import\"
folder3=STRING|"\\nas-1\Prodbox\London\Import\"
folder4=STRING|"\\nas-1\Prodbox\Windsor\Import\"
foldercount=STRING|"4"
incmask=STRING|"*.wav"
interval=STRING|"10"
listmode=STRING|"2"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
newlist=STRING|"c:\new_files.txt"
pass=STRING|"0"
passmode=STRING|"1"
required=STRING|"0"
saveresults=STRING|"0"
subfolders1=STRING|"0"
subfolders2=STRING|"0"
subfolders3=STRING|"0"
subfolders4=STRING|"0"
Oleg
Site Admin
Posts: 3010
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Sample script for File Monitor demo 2nd edition HELP

Post by Oleg »

But what is the problem? Maybe some log file with error messages? I don't see fatal problems.

But I have two notes:
1. I think that you need to move the step #10 (delete file) out of the loop. Place it after EndLoop
2. Maybe it's necessary to put Wait for File action before you try to move it. The file can be locked by another process. You have to determine the timeout manually.

Look at the corrected task:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1040932817
Comment=STRINGLIST
ContinueOnError=INTEGER|2
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task628"
Hide=INTEGER|0
ID=INTEGER|1839340077
LocalVariables=STRING|"list=,subj="
LogOnAsUser=INTEGER|1
Name=STRING|"Monitor ProdBox Import (2 ver)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|0
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=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|"20120910"
date2=STRING|"20120910"
destvar=STRING|"CFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\nas-1\Prodbox\Chatham\Import\*.wav"
file1=STRING|"\\nas-1\Prodbox\Sarnia\Import\*.wav"
file2=STRING|"\\nas-1\Prodbox\London\Import\*.wav"
file3=STRING|"\\nas-1\Prodbox\Windsor\Import\*.wav"
filecount=STRING|"4"
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\Action10]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action10\Params]
destdir=STRING|"O:\AudioImport\"
f_count=STRING|"1"
file0=STRING|"{cfile}"
hidden=STRING|"0"
ifexists=STRING|"0"
move=STRING|"1"
rename=STRING|"0"
subdir=STRING|"0"
system=STRING|"0"

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

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

[Actions\Action12\Params]
Count=STRING|"4"
deletedirs=STRING|"0"
file0=STRING|"\\nas-1\Prodbox\Chatham\Import\*.pkf"
file1=STRING|"\\nas-1\Prodbox\Sarnia\Import\*.pkf"
file2=STRING|"\\nas-1\Prodbox\London\Import\*.pkf"
file3=STRING|"\\nas-1\Prodbox\Windsor\Import\*.pkf"
hidden=STRING|"0"
subdir=STRING|"0"
system=STRING|"0"
ToRecycleBin=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LIST"" with value ""{list}{cfile}{EOL}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"LIST"
varvalue=STRING|"{list}{cfile}{EOL}"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SUBJ"" with value ""{SUBJ} {ExtractFileNameNoExt({cfile})},"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varname=STRING|"SUBJ"
varvalue=STRING|"{SUBJ} {ExtractFileNameNoExt({cfile})},"

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

[Actions\Action5]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action5\Params]
custom=STRING|"1"
customchar=STRING|","
eol=STRING|"0"
lead=STRING|"1"
source=STRING|"{subj}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"subj"

[Actions\Action6]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action6\Params]
custom=STRING|"0"
eol=STRING|"1"
lead=STRING|"1"
source=STRING|"{list}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"list"

[Actions\Action7]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|-1
Name=STRING|"Send Email"
Params=FOLDER

[Actions\Action7\Params]
attachcount=STRING|"1"
auth=STRING|"1"
charset=STRING|"iso-8859-1"
from=STRING|"#@#.com"
host=STRING|"#.com"
html=STRING|"0"
msg0=STRING|"New files imported"
msg1=STRING|"{list}"
msgcount=STRING|"2"
password=STRING|"#"
port=STRING|"25"
priority=STRING|"1"
receipt=STRING|"0"
SSL=STRING|"0"
subject=STRING|"ProdBox Files Imported: {subj}"
to=STRING|"#@#.com"
user=STRING|"#@#.com"

[Actions\Action8]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action8\Params]
createmode=STRING|"1"
date1=STRING|"20120910"
date2=STRING|"20120910"
destvar=STRING|"CFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\nas-1\Prodbox\Chatham\Import\*.wav"
file1=STRING|"\\nas-1\Prodbox\Sarnia\Import\*.wav"
file2=STRING|"\\nas-1\ProdboxLondon\Import\*.wav"
file3=STRING|"\\nas-1\Prodbox\Windsor\Import\*.wav"
filecount=STRING|"4"
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\Action9]
ActionID=STRING|"A_FILE_WAIT"
Enabled=INTEGER|-1
Name=STRING|"Wait accessibility of the file ({cfile}) for 60 seconds"
Params=FOLDER

[Actions\Action9\Params]
filename=STRING|"{cfile}"
mode=STRING|"0"
timeout=STRING|"60"

[Events]
Event1=FOLDER

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

[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|"\\nas-1\Prodbox\Chatham\Import\"
folder2=STRING|"\\nas-1\Prodbox\Sarnia\Import\"
folder3=STRING|"\\nas-1\Prodbox\London\Import\"
folder4=STRING|"\\nas-1\Prodbox\Windsor\Import\"
foldercount=STRING|"4"
incmask=STRING|"*.wav"
interval=STRING|"10"
listmode=STRING|"2"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
newlist=STRING|"c:\new_files.txt"
pass=STRING|"0"
passmode=STRING|"1"
required=STRING|"0"
saveresults=STRING|"0"
subfolders1=STRING|"0"
subfolders2=STRING|"0"
subfolders3=STRING|"0"
subfolders4=STRING|"0"

Oleg Yershov
Post Reply