DirWaitForUpdate is wacthing all changes not just new files. As result the rest of your script may run when a file is deleted or updated in that directory causing false starts. I suggest to replace DirWaitForUpdate initial_dir, 0, change_found with simple Wait 5 GoTo START : Dim local_computer, string : Dim status_message, string : Dim change_found, boolean : Dim bln_FileExists, Boolean : Dim process_id, number : Dim initial_dir, string "\\\\ServerName\\100\\" : Dim search_dir, string : set local_computer "@V"computer"" : Upper( local_computer, local_computer ) : concatex ("File Watch processor running on ", : "@V"computer"", status_message) : logaddmessageex ("INFO", "@V"job_id"" , : "@V"job_name"", status_message) : START: concatex initial_dir, "*.txt", search_dir : FileExists search_dir, bln_FileExists : if bln_FileExists runit, Wait_for_it : Wait_for_it: DirWaitForUpdate initial_dir, 0, change_found : // OK, some change is found : runit: Wait 20 : JobRun( "SomeJob" ) : Wait 20 : // start watching again : GoTo START
|