Blocking Mouse Action (AutoHotkey BlockInput Tip)

Clarification of Earlier AutoHotkey BlockInput Command Tips

While working on a couple of chapters in my new book, I noticed that I had effectively blocked inadvertent mouse movement while running a demonstration of a Windows Paint automation routine. In the script DrawSquiggle.ahk, AutoHotkey turns off the mouse while it executes various other mouse movements. Otherwise, any accidental manual movement of the mouse cursor might screw up the final result. Most importantly, the command to block mouse action worked without raising user privilege levels or running the script as an administrator.

paintcurvetool
The DrawSquiggle.ahk script demonstrates how AutoHotkey can control the selection of tools and mouse actions in Windows Paint.

Continue reading

Stop Accidental Deletions with the BlockInput Command (AutoHotkey Tip—Part Two)

AutoHotkey BlockInput Command May Cause Stuck Keys! Fix It with the KeyWait Command

In the last blog, we dealt with the issue of setting the privilege level required to use the BlockInput command. In the BackupText.ahk and IncrementalSaveText.ahk scripts, the AutoHotkey command prevents user mouse/keyboard input while the script selects and copies text to the Windows Clipboard, but it doesn’t work without Administrator privileges. After raising the script to a higher level, we demonstrated how to use Windows Task Manager to bypass the User Account Control (UAC) warning window.

At the end of the blog, I mentioned an additional problem where BlockInput causes keys (usually one or more from the Hotkey combination) to stick in the down position. Here’s the trouble. Continue reading

Stop Accidental Deletions with the BlockInput Command (AutoHotkey Tip—Part One)

Ever Wonder Why You Might Want to Block Keyboard and Mouse Input? Here’s One Reason to Use the BlockInput AutoHotkey Command, Plus the Associated Problems

I added the BlockInput command to both the BackupText.ahk and IncrementalSaveText.ahk scripts. I did this to prevent the accidental deletion of the target text by an errant press of a key.

To check out whether the command operated or not, I added a time delay to the script looking for the halting of keyboard and mouse action with BlockInput On. It didn’t work! My experiment demonstrated that the BlockInput command blocked nothing. There’s a good reason for this. Continue reading