|
|
|
| 25 March 2002 | Wait() |
| Author | ScriptLogic Corporation |
| Action | Pauses script execution for a specified number of seconds or until a key is pressed. |
| Syntax | Wait (seconds) |
| Parameters | |
| Remarks | Similar to KiXtart's native Sleep command, but give you the ability to break out of the sleep cycle if a key is pressed. The codes returned by this function have changed on 17-Nov-2001. Please update you library. |
| Returns | 0 = Wait cycle completed without interruption. x = Number of seconds elapsed at the time a key was pressed. |
| Examples | ?'Press any key within the next 10 seconds to abort script...' $rc=Wait(10) IF ($rc <> 0) ?'Script terminating!' QUIT ENDIF ?'Script continuing...' |
| Source |
FUNCTION Wait ($seconds)
; similar to KiXtart's built-in SLEEP command, but this UDF can wake up
; early if a key is pressed during the sleep cycle.
;
; Returns null string if sleep cycle completed without interruption.
; Returns string of key pressed, if a key was pressed during wait cycle.
DIM $x
$wait=''
IF ($seconds > 0)
FOR $x=1 TO $seconds
SLEEP 1
$wait=KbHit()
IF $wait
RETURN
ENDIF
NEXT
ENDIF
ENDFUNCTION ; - Wait -
|
|
|
|