LockMouse – System Function**





LockMouse Function


Usage

The LockMouse function locks the mouse. Even if LockMouse can be useful for preventing user interference while a script is running, we do not recommend using it. If something goes wrong, the only way to enable the mouse again will be to power off!

Syntax

LockMouse

Remarks

Mouse actions are not transmitted during the execution of the script. When the last script finishes, the mouse is reactivated.

Example

LockMouse

Example Code

Under Windows 2000/XP/2003, it is possible to call a Windows API function locking the keyboard using the WinTask External statement (not available in WinTask Lite). Below is a sample:

' Launch Notepad
Shell("notepad",1)

False = 0
True = 1

' Lock keyboard and mouse for 10 seconds
external("user32","BlockInput", True)
pause 5

' The script can still type
UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1)
SendKeys("aa")
pause 5

' Unlock keyboard and mouse - when the script ends,
' keyboard and mouse are unlocked even if an external call is not done.
external("user32","BlockInput", False)

' Check during 5 secs that you can now use mouse
pause 5