I have been browsing the AutoHotKey documentation, and I don't see a clear use of how to use 'or' in context specific hot keys. On my setup, Cygwin will either launch with ahk_class cygwin (when I use the context menu) or mintty (when I use the .bat or exe directly).
Currently, I duplicate the hotkeys into two separate blocks,
#IfWinActive ahk_class cygwin
...
#IfWinActive
#IfWinActive ahk_class mintty
...
#IfWinActive
Is there a way to combine them? I've tried:
#IfWinActive ahk_class cygwin ahk_class mintty
#IfWinActive ahk_class || cygwin ahk_class mintty
#IfWinActive ahk_class or cygwin ahk_class mintty
#IfWinActive ahk_class cygwin || #IfWinActive ahk_class mintty
#IfWinActive ahk_class cygwin or #IfWinActive ahk_class mintty
#IfWinActive (ahk_class cygwin or ahk_class mintty)
#IfWinActive (ahk_class cygwin || ahk_class mintty)
#IfWinActive ahk_class cygwin|mintty
#IfWinActive ahk_class cygwin||mintty
...and none of these seem to work. This post states this can be accomplished with groups, but I'm looking for a way to combine them in a single statement.
Var := expressionEvaluates an expression and stores the result in a variable.
Send +{TAB 4} ; Presses Shift-Tab 4 times. To hold down or release a key: Enclose in braces the name of the key followed by the word Down or Up. For example: Send {b down}{b up} Send {TAB down}{TAB up} Send {Up down} ; Press down the up-arrow key.
AutoHotkey definitely does not have built-in recording capabilities--you would need to use a third party macro recorder if you don't want to just code the macro from scratch.
Alright, I remember, after seeing an other example: Define a GroupName with multiple ahk_class entries....
GroupAdd, GroupName, ahk_class ExploreWClass
GroupAdd, GroupName, ahk_class CabinetWClass
#IfWinActive ahk_group GroupName
You could also try the following, I tested and it was working for me (AutoHotkey v1.1.14.01):
SetTitleMatchMode, REGEX
#IfWinActive (cygwin)|(mintty)
This uses the built-in OR mechanism of regular expressions. I couldn't get groups to work for some reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With