Igor
Igor

Reputation: 1201

Creating a hotkey with backslash in AutoHotkey

I want to create a hotkey using a backslash key (\). Namely, I would like to assign Media_Prev to Windows button + backslash. I have tried both LWin & \::Media_Prev and #\::Media_Prev. However, these do not work: it just normally sends the backslash character. In AutoHotkey's key history, I do see that both \ and LWin register when I press this key combination.

Interestingly, something like LWin & c::Media_Prev or #v::Media_Prev does work well, just not with the backslash character.

Upvotes: 1

Views: 4892

Answers (2)

miroxlav
miroxlav

Reputation: 12184

I successfully tested the following:

<#vk dc::Send {Media_Prev}
  • < is Left key
  • # is Windows key
  • VK DC is virtual key number DC (you can find this code using AHK menu View > Key History and Script Info). With VK, the same key works regardless of active keyboard layout.

Note: Don't do LWin & key or Ctrl & key etc... & has a bit different meaning. For the above purpose AHK provides prefixes as shown above, e.g. ^b or #F1 etc. See AHK help on Remapping Keys and Buttons

Upvotes: 1

SeanC
SeanC

Reputation: 15923

This worked for me, using AHK version 1.1.13.01

LWin & \:: run Notepad

you can also use scan codes - something like

SC15B & SC02B:: run Notepad

should have the same effect

reference: here

Upvotes: 2

Related Questions