Ryan Griggs
Ryan Griggs

Reputation: 2758

AutoHotKey - selectively call AltTabMenu when mouse wheel is pressed

I currently use the following script in order to switch applications with the mouse wheel:

MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab

This allows me to click the mouse wheel, then roll the wheel to select the desired application, then click again to switch to it.

However, there are some applications that require me to click the mouse wheel (i.e. SketchUp in order to orbit).

How can I automatically disable/bypass this set of macros only when the SketchUp application is in the foreground (i.e. the window has the focus)?

According to the official docs, the AltTabMenu function is only valid when paired directly with a hotkey on the same line (i.e. MButton::AltTabMenu), so I can't use WinGetTitle and an IF statement to selectively call AltTabMenu.

Currently I simply disable AutoHotKey when I am using SketchUp, but this gets annoying because my AHK script also contains several other shortcuts/key remappings that I use frequently.

Thanks for any insight.

Upvotes: 1

Views: 573

Answers (3)

Yane
Yane

Reputation: 837

Summarizing the the solutions the wonderful AHK community already provided, here is my take on this issue:

MButton::Send , ^!{tab}  ; this sets wheel click to open the AltTab menu


#IfWinActive SketchUp ; you may need to adjust the window name here
MButton::return   ; ignore the hotkey defined above if SketchUp is active


#IfWinActive ahk_class MultitaskingViewFrame  ; Indicates that the alt-tab menu is present on the screen. The below hotkeys are used then to tab through the windows
WheelDown::Send, !{tab}
WheelUp::Send, +!{tab}
MButton::Send, {Enter}
#IfWinActive

Upvotes: 1

user10364927
user10364927

Reputation:

I believe you can get the desired effect without using the special alt-tab commands. Instead, you can map ^!{tab} to MButton.

This test snippet worked for me:

#If WinActive( "Untitled" ) ; new, unsaved notepad window
MButton::Send , a
#If
MButton::Send , ^!{tab}

Upvotes: 0

J. G.
J. G.

Reputation: 1832

Overwrite the hotkey at the bottom when you are in the SketchUp window

Upvotes: -1

Related Questions