Home > Language Reference > Wait Functions > Wait for a Mouse Click

Wait for a Mouse Click

The Pause until mouse clicked pauses script execution until a mouse click is done. If after the specified timeout, the mouse has not been clicked, the block of statements following PauseFalse keyword is executed.

Usage

Used rarely. Use Insert/Wait For/Mouse menu to generate easily such a Pause.

Syntax

Pause [x secs] until
    Mouse(left|right|middle, down|up|double
    [InWindow(<window_name>,<instance>)]
    [InModule(<application_name>)]
[PauseOK|PauseTrue]
 'If the mouse click is done, the optional statements after the PauseOK and before the PauseFalse are executed
[PauseFalse]
' After the specified timeout, if the mouse click has not been done, the statements after the PauseFalse are executed
     MsgBox("Pause at line "+ #ErrorLine$ +" has failed !",16,"Runtime error")
     End
EndPause

Parameters

[x secs], optional. If the mouse has not been clicked after x seconds, the statements after the PauseFalse keyword are executed. If not specified, the default timeout is the one as defined by #PauseTimeout system variable (default value: 120 seconds). mins can be used instead of secs for a timeout in minutes.

Mouse, keyword. It specifies the mouse button (left, right or middle) and the click type (down, up or double).

InWindow, optional keyword. If specified, the condition is met only when the mouse click is done within the window specified by <window_name> and its <instance> number. 

InModule, optional keyword. If specified, the condition is met only when the mouse click is done within the application specified by <application_name>

See also

Wait for a Date
Wait for Image
Wait for a Keystroke
Wait for a Menu Selection
Wait for OCR Text
Wait for a Text
Wait for a Time Delay
Wait for a Window

Example

Pause until
     Button(Left,Down)
     InModule("IEXPLORE.EXE")
PauseFalse
     MsgBox("'Wait for' at line " + #ErrorLine$ + " has failed !")
     End
EndPause