lock/unlock the Keyboard

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
the_eraser
Posts: 11
Joined: 19 Jan 2018, 12:57

lock/unlock the Keyboard

19 Jan 2018, 13:36

Hi,

I was looking for a way to lock or unlock the keyboard with a combination of keys and/or with a press of a switch button using the touchpad/mouse/touchscreen. My objective is to use my Active Pen resting my arm on the keyboard.

I stumbled upon:

https://autohotkey.com/board/topic/2123 ... not-mouse/ - page 2 Lexicos code.
https://www.howtogeek.com/howto/11570/d ... n-windows/ - modified version

which locks the keyboard, but fails to unlock it. I'm on Windows 10.

I'm very new to AutoHotkey (since this morning). I've been study that script very hard since this morning without finding a way to fix it. Please help me.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: lock/unlock the Keyboard

21 Jan 2018, 20:22

You have to use BlockInput on and BlockInput off.
As the Keyboard is blocked, it is the best to even start for safety a timer to execute BlockInput off, because if your code stucks, your keyboard could stay blocked until new boot or similar.
The timer will prevent being unable to unblock the keyboard.

EDIT: I've problems with BlockInput on. It does not works. I can't block my keyboard. It was not a problem in the past.
SOLUTION: Help-file says
Note: Mode 1 and 2 might have no effect if UAC is enabled and the script has not been run as administrator. For more information, refer to the FAQ.
Now it works :mrgreen:

Here a sample for a selfunblocking code:

Code: Select all

F7:: ; press F7 to start this script
Blockinput, on ; User input is blocked - try to move mouse to test
SetTimer, UnBlocker, 5000 ; set the label UnBlocker as timer with 5 sec repeat time.
return

UnBlocker:
Blockinput, off ; selfexplaining
SetTimer, UnBlocker, off ; deactivates himself
return
Einfach nur ein toller Typ. :mrgreen:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, mcd, NullRefEx, supplementfacts and 140 guests