contents   index   previous   next



SElib.suspend()

syntax:

SElib.suspend(milliSeconds)

where:

milliSeconds - a number, the time in thousandths of a second to suspend program execution.

 

return:

void.

 

description:

Suspends script or program execution for the time interval specified in milliSeconds. The next statement in a script will execute at the end of the delay.

 

True accuracy to the exact millisecond is not guaranteed and is only closely approximated according to the accuracy provided by the underlying operating system. This method allows a computer to devote more time to other processes and can be used to give the processor time to complete other tasks before calling the next line in a script.

 

The example below spawns a copy of Windows Notepad, puts the date and time into the document by simulating the selection of Time/Date from the Edit menu, and then displays the line "You asked for the time?". The SElib.suspend() method gives the processor time to finish completing the menu command before entering the text into Notepad. If Keystroke() were called immediately after the call to MenuCommand(), the text would be sent to Notepad while the menu item was still being selected and would be garbled.

 

see:

SElib.spawn(), Clib.ctime(), Date object

 

example:

#include <menuctrl.jsh>

#include <keypush.jsh>

var hWnd = SElib.spawn(P_NOWAIT, "notepad.exe");

MenuCommand(hWnd, "Edit|Time");

SElib.suspend(300);

KeyStroke("\nYou asked for the time?");

 


SElib.version()