Wait for Flow Validation before running script
Posted: Wed Jan 10, 2018 11:52 pm
Im Trying to Get a Job to run in VDP only one at a time because if another job attempts to enter the segment of the flow it will overwrite the artwork for the job that is currently running. I need a single Folder to pass a Hold job point and wait until VDP outputs something (or timeout if it never reaches VDP). im currently using the code below
Entry Point:
Before VDP (to tell timeout not to run because VDP got the job...)
End point (to tell entry point it is safe to allow next job)
However when the flow starts it trips the entry script without actually sending a file... and then the files are stuck there. Im looking for a way to wait until the flow has validated and will actually allow the file to pass the hold point before actually running the script in the entry point (all 3 are hold points with scripted release expressions)
Example:
Entry Point:
Code: Select all
var uniquekey="AF29 Press"
var started = s.getGlobalData( uniquekey, "Started" );
var finished = s.getGlobalData( uniquekey, "Finished" );
var timeout = s.getGlobalData( uniquekey, "timeout" );
var time=job.getVariableAsString('[Switch.Date:Format="hh:mm",TimeZone="System"]',s);
var bRelease="false";
if ((finished=="true") || (!started && timeout==time)){
bRelease="true";
s.log(-1,"Finished="+finished)
s.log(-1,"started="+started)
s.log(-1,"timeout="+timeout)
var hour=job.getVariableAsNumber('[Switch.Date:Format="hh",TimeZone="System"]',s);
var minute=job.getVariableAsNumber('[Switch.Date:Format="mm",TimeZone="System"]',s);
minute+=5;//wait up to five minutes for start
if (minute>59){
minute-=60
hour+=1
}
if (hour>23){
hour-=24
}
timeout=hour.toString()
timeout+=":"
timeout+=minute.toString();
s.log(2,timeout)
s.setGlobalData( uniquekey, "Started", "false" );
s.setGlobalData( uniquekey, "Finished", "false");
s.setGlobalData( uniquekey, "timeout", timeout);
}else{
s.log(-1,"waiting for time "+timeout)
}
bRelease;
Code: Select all
var uniquekey="AF29 Press"
s.setGlobalData( uniquekey, "Started", "True" )
"true"
End point (to tell entry point it is safe to allow next job)
Code: Select all
var uniquekey="AF29 Press"
s.setGlobalData( uniquekey, "Finished","true" )
s.setGlobalData( uniquekey, "Started","false" )
"true"
Example: