This function is for delaying script execution for a specifier number of milliseconds. 


Important! This is a service function. Avoid forced delays in real work.

 

Syntax

procedure ScriptSleep(const ASleepTime: integer);

 

Example

var
  i: integer;
  iStarted, iNow: int64;
begin
  mLogScript('Started', '');
  iStarted := GetTickCount;
  for i := 1 to 5 do begin
    ScriptSleep(i * 100);
    iNow := GetTickCount;
    mLogScript(IntToStr(iNow - iStarted), 'Iteration #' + IntToStr(i));
  end;
  mLogScript('Finish', '');
end.


Script work result

[19:45:43] (Log "ScriptSleepExample"): Started

[19:45:43] (Log "ScriptSleepExample"): [Iteration #1] 110

[19:45:43] (Log "ScriptSleepExample"): [Iteration #2] 313

[19:45:44] (Log "ScriptSleepExample"): [Iteration #3] 625

[19:45:44] (Log "ScriptSleepExample"): [Iteration #4] 1031

[19:45:45] (Log "ScriptSleepExample"): [Iteration #5] 1547

[19:45:45] (Log "ScriptSleepExample"): Finish

[19:45:45] (Run "ScriptSleepExample"): Script operation time: 1540 ms

[19:45:45] (Run "ScriptSleepExample"): Script done successfully.
 

See also

GetTickCount

IntToStr

mLogScript