Sign in to follow this  
Followers 0
AlphaS

Block ALL Keyboard Input ONLY

4 posts in this topic

Hey All, I am just wondering (And I have searched the forums but to no avail) is there a way to block all keyboard input but not Mouse movement.

Reason being Is possibly using a mouse key to turn on and off the keyboard lock.

IF that is not possible...

Is there a way to lock ALL KEYS except two keys that lock and unlock the keyboard.

Yes I am aware of BlockInput, No it does not perform the actions I require, No it does not block the keyboard only, No Its not what I am looking for, Yes I've already tried playing around with it :) .

Thanks!

Share this post


Link to post
Share on other sites



Try this method.. unfortunetly autoit can only have at most 64 hotkeys.. :)

$keys = StringSplit("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|"  & _
                     "0|1|2|3|4|5|6|7|8|9|", "|")
For $i = 1 to $keys[0]
   HotKeySet($keys[$i], "Stop")
Next

While 1
sleep(1000)
WEnd

Func Stop()
;blocks numbers letters
EndFunc

Share this post


Link to post
Share on other sites

Try this method.. unfortunetly autoit can only have at most 64 hotkeys.. :shocked:

$keys = StringSplit("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|"  & _
                     "0|1|2|3|4|5|6|7|8|9|", "|")
For $i = 1 to $keys[0]
   HotKeySet($keys[$i], "Stop")
Next

While 1
sleep(1000)
WEnd

Func Stop()
;blocks numbers letters
EndFunc

How would you set a "back out key"

ie: setup of a program jammed and you would like the user to press for ie: the letter Z whch will end the keyboard locking loop and allow full functionality again, i have messed around with bits and pieces of code to see if i can get it with no luck just yet

Tim

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <misc.au3>

$keys = StringSplit("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|" & _
        "0|1|2|3|4|5|6|7|8|9", "|")
For $i = 1 To $keys[0]
    HotKeySet($keys[$i], "Stop")
Next

While 1
    Sleep(1000)
        If _IsPressed('5a') Then
        $init = TimerInit()
        Do
            Sleep(100)
        Until Not _IsPressed('5a')
        If TimerDiff($init) / 1000 > 5 Then  ; holding 'z' for 5 seconds unlocks the keyboard
            For $i = 1 To $keys[0]
                HotKeySet($keys[$i])
            Next
        EndIf
    EndIf
WEnd

Func Stop()
    ;blocks numbers letters
EndFunc

edit - moved the unlock in to the keep alive loop

Edited by xcal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0