LockMouse

System function.

The LockMouse function locks the mouse.

Usage

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

Syntax

LockMouse

Remarks

The 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 WinTask External statement (not available in WinTask Lite). Below is a sample:

 
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