Using tilde prefix with conditional hotkeys

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pukkandan
Posts: 1
Joined: 28 Apr 2017, 12:38

Using tilde prefix with conditional hotkeys

28 Apr 2017, 13:26

This is a code for Win-tabbing with right mouse button and scroll wheel in Windows 10:

Code: Select all

#IfWinActive, ahk_exe mspaint.exe
~RButton::return
#IfWinActive
*RButton::Send, {RButton}

;The main part of the code
RButton & MButton::Send, #{Tab}
RButton & WheelUp::Send, #^{Left}
RButton & WheelDown::Send, #^{Right}
The *RButton is necessary so that the native function is not completely blocked. If I instead use ~RButton::return (or ~RButton & ...), RButton is send to active window even if I used the RButton & ... hotkeys. So, *RButton::Send, {RButton} seems to be the best alternative.
However, since the *RButton variant only triggers when the button is released, I cannot use the right (background color) brush in mspaint. So, I added the ~RButton in #ifWinActive. But it seems as though the ~ in this (conditional) variant of the hotkey forces ~ prefix on all its variants even when the #If is not satisfied.

Is there any way to use ~ only for the #If variant? If not, is there another way to achieve this kind of behaviour?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], TAC109 and 135 guests