Lets say I have x
key, and I want use it as a "modifier" so that I can combine it with other hotkeys, like so:
x
& and y
x
& and w
x
& and z
In order to do this, I need to use ~
:
#singleinstance, force
~x::
;~$x:: ;I tried this, thinking '$' to mean to disables the keys default function. Didnt work
tooltip, X pressed
return
x & y::
tooltip, X and Y pressed
return
But now, the active windows shortcut for x
will also fire, in some windows this could be simply typing x
, in others firing a command. In effect AutoHotkey fails in blocking x
.
This has been a issue that has been plaguing me for a long time, ~
will allow you to combine its hotkey with other keys but then also disables AHKs ability to block the hotkeys default shortcut.
This int really a AhkV1/V2 issue. I am sure the same issues is present in V2 as well
I ran a brief test, and it seems it's possible. I have used my appskey to more easily use arrow keys for navigation, but have also put in a definition for just pressing the key. Defining the default action is important, otherwise only the combinations will work.
;Use appskey as modifier to get home/end/pgup/pgdn at a useful place
AppsKey::Send, {AppsKey}
AppsKey & Up::PgUp
AppsKey & Down::PgDn
AppsKey & Left::Home
AppsKey & Right::End
In your case, the code could look like this (in one-liner, as there's only one thing to do)
x::tooltip, X pressed
x & y::tooltip, X and Y pressed