Page 1 of 1

File Monitor - Wait

Posted: Mon Jul 02, 2012 4:45 pm
by rwwilkins
So I have a file monitor process that monitors a folder for new or changed files and then writes a listing of those files to a file called schedules.txt.
The issue I have is this directory has thousands of files sent to it each day. Sometimes the monitor will be adding files to the schedules.txt and before the file list is complete, the workflow of copying them begins. Because of this, the workflow copies everything it has in the original list, but the file monitor overwrites the file with new information. That new information doesnt seem to get processed by the workflow. Then file monitor will overwrite again and the process handles those.
 I'd like for that workflow to wait for the file schedules.txt to have not been written to for 1 minute before it begins the rest of the process. I'd also like File Monitor to hold its process until the workflow has completed. Is this possible?

File Monitor - Wait

Posted: Tue Jul 03, 2012 4:15 pm
by Oleg
Very interesting job.
In this case you should collect all changes and delay main code long enough.
I think that this can be solved by two tasks:
1-st task: runs main task and collects names of changed files
2-nd task: make enough pause, get collected list of files and does other main steps

Only 1-st task have file monitor. File Monitor checks files every 5 seconds and saves list of changed files every time when it fires. 2-nd task can be started only ones at a time, therefore next "Start Task" actions will have no effect.
2-nd task will be started at 1-st actuation of FileMonitor trigger and it waits necessary timeout. When trigger fires again 1-st task will only collect new filenames into global variable LIST.
You should create global empty variable LIST for correct work.

We'll try to make some changes of File Monitor trigger in order to simplify the handling of such situation.

File Monitor - Wait

Posted: Tue Jul 03, 2012 4:58 pm
by rwwilkins
So I am a little confused. Below is my current task, could you help me adapt?
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1818733157
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task25"
Hide=INTEGER|0
ID=INTEGER|643822429
LocalVariables=STRING|"M_FILE"
LogOnAsUser=INTEGER|1
Name=STRING|"SD Schedule Send to XCLOAD"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
[Actions\Action1]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action1\Params]
destvar=STRING|"N_FILE"
file=STRING|"C:\Processes\Seachange\sdschedlist.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER
[Actions\Action2\Params]
destdir=STRING|"Y:\CDCI\Schedule\xcload"
f_count=STRING|"1"
file0=STRING|"{N_FILE}"
hidden=STRING|"1"
ifexists=STRING|"0"
move=STRING|"0"
subdir=STRING|"0"
system=STRING|"1"
[Actions\Action3]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action3\Params]
message=STRING|"{N_FILE} copied to XCLOAD"
type=STRING|"0"
[Actions\Action4]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action5]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|0
Name=STRING|"Send Email"
Params=FOLDER
[Actions\Action5\Params]
attach0=STRING|"C:\Processes\Seachange\sdschedlist.txt"
attachcount=STRING|"1"
auth=STRING|"0"
cc=STRING|"email@email.com"
charset=STRING|"iso-8859-1"
from=STRING|"user@host.com"
host=STRING|"tbmailrelay.corp.local"
html=STRING|"0"
msg0=STRING|"Robotask has completed copying the files CURRENTLY scanned by Robotask."
msg2=STRING|"Please note, as schedules come in, the process may complete multiple times and you will receive a different list of completed schedules with each email."
msgcount=STRING|"3"
password=STRING|"2488926475246822493825196"
port=STRING|"25"
SSL=STRING|"0"
subject=STRING|"SD Schedule copy to XCLOAD completed"
to=STRING|"email2@email.com"
[Events]
Event1=FOLDER
[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Params=FOLDER
UnigueID=INTEGER|117411665
[Events\Event1\Params]
chg=STRING|"1"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"0"
excmask=STRING|"???a*.sch, ???a*.SCH, ???b*.sch, ???b*.SCH, ???c*.sch, ???c*.SCH, ???d*.sch, ???d*.SCH, ???e*.sch, ???e*.SCH, ???f*.sch, ???f*.SCH, ???g*.sch, ???g*.SCH, ???h*.sch, ???h*.SCH, ???98*.sch, ???98*.SCH"
folder1=STRING|"W:\Schedules\PostLoadTB"
foldercount=STRING|"1"
id=STRING|"8H1USC35D"
incmask=STRING|"?????02*.sch, ?????02*.SCH, ?????032.sch, ?????032.SCH"
interval=STRING|"180"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
onelist=STRING|"C:\Processes\Seachange\sdschedlist.txt"
saveresults=STRING|"1"
subfolders1=STRING|"0"
 

File Monitor - Wait

Posted: Wed Jul 04, 2012 5:37 am
by Oleg
I have sent adapted tasks to your email address.

File Monitor - Wait

Posted: Thu Jul 05, 2012 6:56 pm
by rwwilkins
Thank you Oleg. I will test them today!