Blocking Keyboard Input: AutoHotKey

email me

#NoTrayIcon 

SendMode Input

Keys := ["Alt","Space","Tab","Delete","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadDot","NumpadDiv","NumpadMult","NumpadAdd","NumpadSub","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","1","2","3","4","5","6","7","8","9","0",";","'",",",".","/","\","[","]","-","=","{","}","+","_","!","@","#","$","%","^","&","*","(",")","<",">","?","``","~","|"]

for k, v in Keys
   In(v, "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") ? (HotKey("+" v, "BlockKey"), HotKey(v, "BlockKey")) : HotKey(v, "BlockKey")
return

BlockKey:
Key := InStr(A_ThisHotkey, "+", "false", "1") ? (SubStr(A_ThisHotkey, "0", "1"), Mod := SubStr(A_ThisHotkey, "1", "1"))  : (A_ThisHotkey, Mod := "")

   return

In(var, Matchlist)
{
   if var in %Matchlist%
      return True
}

Hotkey(ByRef KeyName, ByRef Label) 
{
   HotKey, %KeyName%, %Label%
}

 

Notes

Ahk2Exe can be used in the following ways:

  1. GUI Interface: Run the “Convert .ahk to .exe” item in the Start Menu.
  2. Right-click: Within an open Explorer window, you can right-click any .ahk file and select “Compile Script” (only available if the script compiler option was chosen when AutoHotkey was installed).

Download AutoHotKey