ScrollLock to suspend on/off and to turn LED on/off

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MagicianDz
Posts: 3
Joined: 10 Apr 2018, 01:50

ScrollLock to suspend on/off and to turn LED on/off

10 Apr 2018, 02:08

Hi.
I'm new to AKH and all I learned so far is the remap :: and the basic use of send utilities.
I learned about the "Suspend" command which allows me to assign a key to enable/disable the script. What I want to do is to assign the ScrollLock to the Suspend command but I also want it to toggle the LED light on/off. So I have a visual cue whether the script is on or off. Can anyone help me with the correct way to do it please?
MagicianDz
Posts: 3
Joined: 10 Apr 2018, 01:50

Re: ScrollLock to suspend on/off and to turn LED on/off

10 Apr 2018, 02:21

I have actually figured the solution after a couple of minutes of research and trials.
The code is:

Code: Select all

ScrollLock::
Suspend, Toggle
Send {ScrollLock}
return ;
The important thing here is to place the "Suspend, Toggle" command before the "Send {ScrollLock}" command. If you switch the order of these 2 commands then it won't work.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: ScrollLock to suspend on/off and to turn LED on/off

10 Apr 2018, 04:13

I have the same suspend hotkey, but I prefer the following method:

Code: Select all

~ScrollLock::
	Suspend Permit
	Sleep,10
	Suspend % GetKeyState("ScrollLock","T") ? "On" : "Off"
Return
~ to retain native function opposed to re-triggering itself, possible looping. Suspend % GetKeyState ... to match the suspend state to the LED state, in case suspend was set by other means.
MagicianDz
Posts: 3
Joined: 10 Apr 2018, 01:50

Re: ScrollLock to suspend on/off and to turn LED on/off

10 Apr 2018, 16:54

Nextron wrote:I have the same suspend hotkey, but I prefer the following method:

Code: Select all

~ScrollLock::
	Suspend Permit
	Sleep,10
	Suspend % GetKeyState("ScrollLock","T") ? "On" : "Off"
Return
~ to retain native function opposed to re-triggering itself, possible looping. Suspend % GetKeyState ... to match the suspend state to the LED state, in case suspend was set by other means.
I'm not fully sure what your code does opposite to mine, but does it just turns the LED light on/off without really activating the scrolllock?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CuriousDad, Google [Bot], rc76 and 233 guests