I want ctrl + { to work as the home key. This doesn't work:
^{::Send {Home}
I guess the { needs to be escaped?
This also doesn't work: (it generates an error on loading the script)
^{{}::Send {Home}
What is the correct way of doing this?
You can use the steps listed here to find the scan code and virtual key code of the {
and then use either of those (SCnnn
or VKnn
) in the hotkey definition.
Even though that works I was curious why the ^{
doesn't work for your layout, so I tried using it and seeing if AHK's key history showed {
, which it does. I took a look at AHK's source code to see what's happening, and I think it comes down to the return value of VkKeyScanEx
called with { and your layout, which is 0x0634, i.e., AltGr+4. I hadn't noticed that AltGr+4, AltGr+5, and AltGr+9 all produce { in your layout before this, so I tried the ^{
hotkey again and sure enough it fires with AltGr+4. So it seems it's just a limitation of VkKeyScanEx
: even if multiple combinations map to some character only one of them can be returned. In your .klc file, wherever LEFT CURLY BRACKET first appears will be the combination that VkKeyScanEx
returns. I don't know if you use the AltGr combinations for {, but if you remove them from your layout the ^{
hotkey should work for just Ctrl+{.
{
on your keyboard? On mine it is Shift+[ so to execute your hotkey I actually have to type Ctrl+Shift+[. If it's the same for you and you don't want to press shift you can use^[
. – Josh BrobstVKnn
) for{
to make the hotkey. Sidenote, what keyboard layout are you using (guessing Dvorak programmer or Latin America)? – Josh Brobst^SC028::Send {Home}
. I have a custom layout (github.com/r03/azerty). Maybe that is the problem. – roeland