Function Reference

BlockInput

Disable/enable the mouse and keyboard.

BlockInput ( flag )

 

Parameters

flag 1 = Disable user input
0 = Enable user input

 

Return Value

None.

 

Remarks

If BlockInput is enabled, the Alt keypress cannot be sent!
The table below shows how BlockInput behavior depends on 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 95 No effect.
Windows 98/Me User input is blocked but AutoIt is also unable to simulate input.
Windows NT 4 (Without ServicePack 6) No effect.
Windows NT 4 (With ServicePack 6) User input is blocked and AutoIt can simulate most input.
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.

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

Note that functions such as WinMove() will still work on Windows 98/Me when BlockInput is enabled.

 

Related

Send

 

Example


If @OSVersion <> "WIN_98" And @OSVersion <> "WIN_ME" Then
    BlockInput(1)
EndIf

Run("notepad")
WinWaitActive("Untitled - Notepad")
Send("{F5}")  ;pastes time and date

BlockInput(0)