My script works, but I'm stuck on the toggle-off part

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Immortal-D
Posts: 2
Joined: 08 May 2021, 10:30

My script works, but I'm stuck on the toggle-off part

08 May 2021, 10:36

Greetings all. After a bit of browsing (can't believe I didn't know about this program sooner), I have a functioning script that holds down the Shift key for me. The problem is, it doesn't toggle off. I need to press shift-hotkey (num0 here) to turn it off. A single press of the hotkey turns it on like normal though. Any information is appreciated.

Code: Select all

Numpad0::
KeyDown := !KeyDown
If KeyDown
	SendInput {Shift down}
Else
	SendInput {Shift up}
Return
User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: My script works, but I'm stuck on the toggle-off part

08 May 2021, 10:47

Code: Select all

Numpad0::Send {Shift down}
NumpadIns::Send {Shift up}
Immortal-D
Posts: 2
Joined: 08 May 2021, 10:30

Re: My script works, but I'm stuck on the toggle-off part

08 May 2021, 11:06

mikeyww wrote:
08 May 2021, 10:47

Code: Select all

Numpad0::Send {Shift down}
NumpadIns::Send {Shift up}
I was really overthinking it, lol. Thank you sir.
User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: My script works, but I'm stuck on the toggle-off part

08 May 2021, 11:37

While Shift is held down, triggering a hotkey would typically require that modifier to be recognized in the hotkey. In the case of the Numpad, the name of the "shifted key" actually changes as shown.

Enjoy.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998 and 248 guests