Function Reference

BlockInput

Disable/enable the mouse and keyboard.

BlockInput ( flag )

 

Parameters

flag 1 = Disable user input
0 = Enable user input

 

Return Value

Success: Returns 1.
Failure: Returns 0. Already Enable or #requireAdmin not used.

 

Remarks

If BlockInput is enabled, the Alt keypress cannot be sent!
The table below shows how BlockInput behavior depends on the Windows version; however, pressing Ctrl+Alt+Del on any platform will re-enable input due to a Windows API feature.


Operating System "BlockInput" Results
Windows 2000 User input is blocked and AutoIt can simulate most input.
Windows XP User input is blocked and AutoIt can simulate most input. See exceptions below.
Windows Vista User input is blocked and AutoIt can simulate most input if #requireAdmin is used. See exceptions below.

If you are using Windows XP then you should be aware that a hotfix released in between SP1 and SP2 limited Blockinput so that the ALT key could NOT be sent. This was fixed in XP SP2.

Note that functions such as WinMove() or Send() will still work when BlockInput is enabled because BlockInput just affects user interaction with the keyboard or the mouse not what is done with AutoIt functions (aside from the exceptions in the table above).

 

Related

Send

 

Example


BlockInput(1)

Run("notepad")
WinWaitActive("[CLASS:Notepad]")
Send("{F5}")  ;pastes time and date

BlockInput(0)