An Alternative To Pause Script

Discussion created by alecgregory on Feb 1, 2018
Latest reply on Jan 27, 2019 by dale_allyn

I thought I'd share a tiny technique that I use occasionally.


Sometimes I need to pause a script for a certain amount of time, let's say half a second. You can use the Pause/Resume Script script step:


Pause/Resume Script [ Duration (seconds): 0.5 ]


But Pause/Resume Script has some side effects:

  • It often allows user interaction during the pause, including aborting the script unless Allow User Abort[Off] has been set
  • It redraws the current window (negating an innocent and well-intentioned Freeze Window step that never hurt anyone)


When these side effects are problematic I use this technique instead:


Set Variable[ $pauseStart; Value: Get ( CurrentTimeUTCMilliseconds ) ]


     Exit Loop If[ Get ( CurrentTimeUTCMilliseconds ) - 500 > $pauseStart ]

End Loop


And it's easy enough to refine this into a sub-script so you can just pause in a single step:


Perform Script [ "Pause ( ms )" ; Parameter: 500 ]