Hi everyone
Can anyone out there advise how I can correctly use the s.sleep function to delay each iteration of a loop that sends a sorted list of files from an array to a single path?
I'm not having any luck at all using it inside the loop. Does it perhaps need to be positioned outside the loop?
Any advice gratefully received.
How to use s.sleep in a loop...
How to use s.sleep in a loop...
Regards,
William Buckingham
William Buckingham
How to use s.sleep in a loop...
job.sendToxxx's are not executed immediately. They are queued up and executed after the script finishes. In other words, the s.sleep in the loop makes your script slower, but the hoped for interval in sending the jobs is not happening. You will have to use a Hold job after the script.
Freddy
Freddy
How to use s.sleep in a loop...
Hi Freddy and thanks for the response. I was actually afraid that was what happened with a SendToXXX function.
Can you advise the following then please?
Since Switch uses FIFO will each of the files that are sent to the single output receive their unique job numbers in the order specified by the array.
In my testing this appears to be what happens, but I'd like to know this is programmatically the way it is supposed to work.
Can you advise the following then please?
Since Switch uses FIFO will each of the files that are sent to the single output receive their unique job numbers in the order specified by the array.
In my testing this appears to be what happens, but I'd like to know this is programmatically the way it is supposed to work.
Regards,
William Buckingham
William Buckingham
How to use s.sleep in a loop...
According to engineering the order of the sendToXXX's is likely to be that of the script, but this is not guaranteed!! If you really positively 100% certain have to respect the order, you should add a second script that uses TimerFired and that only sends 1 job at a time.
In the first script add a piece of private data to each job with the priority number. In the second script you loop over all the jobs in the input folder and you only send the one with the lowest number. The rest you leave untouched. Every time the timer is fired the script will take the file with the lowest priority number, and after so many iterations the input folder will be empty. You obviously do not need "Hold job" anymore.
Freddy
In the first script add a piece of private data to each job with the priority number. In the second script you loop over all the jobs in the input folder and you only send the one with the lowest number. The rest you leave untouched. Every time the timer is fired the script will take the file with the lowest priority number, and after so many iterations the input folder will be empty. You obviously do not need "Hold job" anymore.
Freddy