Code Snippet - Looping a Script Until a Certain Time

If you want to loop a script until a specific time then you could consider this as an option:


var Hour, Min, Sec, MSec: Integer;

DecodeTime(Now, Hour, Min, Sec, MSec);
if Hour < 19 then
  PAL.Loop := True;


Firstly we need to declare the variables for the different parts of the time, including the miliseconds, then we decode the current time (Now) into the different parts, finally we check for a specific hour which in this case is 7pm, 19:00 in the 24-hour clock system.

When the if statement is met the script will stop looping.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request