Page 1 of 1

Freeze/Disable Mouse&keyboard movement

Posted: 11 Aug 2018, 07:40
by kentpachi
Can anyone make a simple script that when i press ctrl+s, it will disable keyboard and mouse

Re: Freeze/Disable Mouse&keyboard movement

Posted: 11 Aug 2018, 08:04
by Scr1pter
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

Re: Freeze/Disable Mouse&keyboard movement

Posted: 12 Aug 2018, 23:17
by kentpachi
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

Re: Freeze/Disable Mouse&keyboard movement

Posted: 13 Aug 2018, 01:54
by pro100andrik94
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