Toggle Key Being Held Down

Get help with using AutoHotkey and its commands and hotkeys
thebib622
Posts: 16
Joined: 01 Aug 2017, 17:09

Toggle Key Being Held Down

05 Aug 2017, 15:59

I want to press PAGEUP
after that I want CONTROL to be held down until I press PAGEUP again.
Press PAGEUP for a second time needs to release the CONTROL key for being held down.

I've look for scripts and changing the keys, but I can never get it working...
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Toggle Key Being Held Down

05 Aug 2017, 17:09

Hallo,
try:

Code: Select all

PgUp::
Toggle := !Toggle
If (Toggle)
{
	Send {Ctrl down}
} Else {
	Send {Ctrl up}
}
Return
thebib622
Posts: 16
Joined: 01 Aug 2017, 17:09

Re: Toggle Key Being Held Down

05 Aug 2017, 19:26

thank you for your help, but after I un-toggle the PAGEUP command, control is still being held down... it is strange.

For example, if I run your script, and un-toggle it, and then go to firefox and scroll up or down, it will resize the webpage (as if CONTROL is being held down)
I need to press CONTROL for everything to work like normal again.
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Toggle Key Being Held Down

05 Aug 2017, 19:38

Maybe change it to LCtrl instead of Ctrl?
thebib622
Posts: 16
Joined: 01 Aug 2017, 17:09

Re: Toggle Key Being Held Down

05 Aug 2017, 20:57

I got it working! Thank you so much! I was using this with a program that lets me live draw on the screen, and this script allows me to use it with my script.

ESC::Send --
PgUp::Ctrl

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bodhi, boiler, davidjmorin, drewjbx1, evilmanimani, hd0202, keylo, mikeyww, roysubs, yyardim and 46 guests