Launch screen saver and block all input except a special key. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kenji
Posts: 16
Joined: 08 Nov 2021, 03:15

Launch screen saver and block all input except a special key.

Post by kenji » 06 Dec 2021, 10:32

Saw this code on archived forums - https://www.autohotkey.com/board/topic/95543-activate-screen-saver-with-scrolllock/
(note- the script needs to be run as admin to block the input.)

The code does not work where i have to press scroll lock key again to unlock the input , i had to use ctrl+alt+del to get out of the code.
any fix, i like the way to toggling this using scloll lock key.

here's the code

Code: Select all

~ScrollLock::
KeyWait,ScrollLock
If Block = 1
{
BlockInput,Off
MouseGetPos,X,Y
MouseMove,% X + 5,% Y
Block = 0
SetScrollLockState,off
Return
}
State := GetKeyState("ScrollLock", "T")
If State = 1
{
SendMessage, 0x112, 0xF140, 0,, Program Manager
BlockInput,on
Block = 1
}
Return

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Launch screen saver and block all input except a special key.  Topic is solved

Post by mikeyww » 06 Dec 2021, 11:10

If you block the input, then... well... it means that it is blocked, until your script unblocks it, or CTRL-ALT-DEL (for example).

Instead of the block, it is possible to disable other keys except the one you want, by setting hotkeys to execute Return. Some scripts are available by searching for "block keyboard".

Post Reply

Return to “Ask for Help (v1)”