KeyWait without sending key press

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ardent246
Posts: 7
Joined: 22 Nov 2019, 16:35

KeyWait without sending key press

22 Nov 2019, 16:42

Hi,

I've looked extensively for an answer to this question, so please forgive me if it has been posted and I missed it.

I want to use KeyWait, but I do not want the key that is pressed to be sent through to the system. For example I'd like to do the following

F5::
*code*
KeyWait, PGDN, D
*more code:
return

I do not want PGDN to be its own hotkey, because I simply want the code I execute with my F5 hotkey to pause until I continue it by pressing PGDN. But I do not want that PGDN to be sent through to the system, I only want it to be captured by AHK and used to continue the code execution. Afterward, PGDN should function as a normal key.

Is there a way to do this?

I saw previously someone mentioning Pause, On and then unpausing with page down with the below code:

#If A_IsPaused
PGDN::Pause, Off
#If

This produces inconsistent behavior and is not ideal. I really just want to simplicity of KeyWait without sending the keypress. Thanks!
ardent246
Posts: 7
Joined: 22 Nov 2019, 16:35

Re: KeyWait without sending key press

22 Nov 2019, 17:00

Cap'n Odin very nicely posted the code below in the discord server which I am copying here in case any one runs into the same problem. Thanks!

***

F5::
ToolTip, waiting
Hotkey, PgDn, label, On
KeyWait, PgDn, D
Hotkey, PgDn, label, Off
ToolTip, done
return

label:
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 371 guests