Freeze/Disable Mouse&keyboard movement

Get help with using AutoHotkey and its commands and hotkeys
kentpachi
Posts: 50
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: 580
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
I'm not an expert, just an enthusiastic AutoHotkey user. 8-)
Please do not support cheaters!
Keyboard: Logitech G15 first generation - Mice: Logitech G9, G502, G602 - OS: Windows 7 Pro 64 Bit - AHK version: 1.1.29.00
kentpachi
Posts: 50
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: 26
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”

Who is online

Users browsing this forum: Bing [Bot], TAC109 and 96 guests