Send hotkey definition style keys? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
william_ahk
Posts: 481
Joined: 03 Dec 2018, 20:02

Send hotkey definition style keys?

Post by william_ahk » 17 May 2022, 19:56

As hotkey definition, we can write special keys without the brackets, like so:

Code: Select all

+F1::
But when we use the Send command, special keys will need to be wrapped in curly brackets like +{F1}. Is there a way to make it send keys in the style of hotkey definitions? I didn't find anything relevant in the docs.
The dilemma I have is that the value of the Hotkey GUI controls is in the hotkey definition style. So perhaps there's another way to approach this problem?

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

Re: Send hotkey definition style keys?  Topic is solved

Post by mikeyww » 17 May 2022, 20:04

Code: Select all

Gui, Font, s10
Gui, Add, Hotkey, w250 vhk
Gui, Add, Button, wp   Default, OK
Gui, Show,, Hotkey
Return
ButtonOK:
Gui, Submit
RegExMatch(hk, "([!^+#]*)(.+)", m), keys := m1 "{" m2 "}"
MsgBox, 64, Keys, %keys%
Send, %keys%
Return

william_ahk
Posts: 481
Joined: 03 Dec 2018, 20:02

Re: Send hotkey definition style keys?

Post by william_ahk » 17 May 2022, 20:57

@mikeyww Would never have thought it could be transformed with a simple regex like such. Thanks a ton :thumbup:

Post Reply

Return to “Ask for Help (v1)”