Freeze/Disable Mouse&keyboard movement

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kentpachi
Posts: 152
Joined: 15 May 2016, 01:23

Freeze/Disable Mouse&keyboard movement

11 Aug 2018, 07:40

Can anyone make a simple script that when i press ctrl+s, it will disable keyboard and mouse
User avatar
Scr1pter
Posts: 1275
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Freeze/Disable Mouse&keyboard movement

11 Aug 2018, 08:04

Be careful with Block commands.
Save all opened files and be aware of the fact you might have to use the reset button of your PC.
https://autohotkey.com/docs/commands/BlockInput.htm

I tried it but for me it didn't work.
Maybe because I'm no admin.

Code: Select all

^s:: ; Ctrl+S
BlockInput, On ; Disable keyboard and mouse input
Sleep, 5000
BlockInput, Off ; Enable keyboard and mouse input
return
Leave the Sleep time, test it.
If it works, remve it and create another hotkey which enables keyboard and mouse again.
For example:

Code: Select all

Esc::
BlockInput, Off ; Enable keyboard and mouse input
return
But I have no idea if it actually will work.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
kentpachi
Posts: 152
Joined: 15 May 2016, 01:23

Re: Freeze/Disable Mouse&keyboard movement

12 Aug 2018, 23:17

Regards[/quote]
i tried this code

Code: Select all

s:: ; Ctrl+S
BlockInput, On ; Disable keyboard and mouse input

Esc::
BlockInput, Off ; Enable keyboard and mouse input
return
it doesnt work
pro100andrik94
Posts: 27
Joined: 08 Aug 2018, 07:27

Re: Freeze/Disable Mouse&keyboard movement

13 Aug 2018, 01:54

This will not work because you miss return

Code: Select all

^s:: ; Ctrl+S
KeyWait Control ; waiting that controll wil relese to not have "stuck down"
BlockInput, On ; Disable keyboard and mouse input
return ; missed that return in first code
$~esc::
BlockInput Off
And if Escape key didn't work you allways can disable Blockinput by pressing Ctrl+Alt+Del. It will re-enable input due to a Windows API feature like say's in documentation

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 154 guests