How to use "or in AutoHotKey scripts?

I was looking at AutoHotKey documentation , and I don't see a clear use of how to use 'or' in a context specific to hot keys. In my setup, Cygwin either starts with ahk_class cygwin (when I use the context menu) or mintty (when I use .bat or exe directly).

I am currently duplicating keyboard shortcuts into two separate blocks,

#IfWinActive ahk_class cygwin
...
#IfWinActive
#IfWinActive ahk_class mintty
...
#IfWinActive

Is there a way to combine them? I 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 them seem to work. This post claims that this can be done using groups, but I'm looking for a way to combine them into a single expression.

+5
source share
6 answers

, (AutoHotkey v1.1.14.01):

SetTitleMatchMode, REGEX

#IfWinActive (cygwin)|(mintty)

OR . - .

+3

, ( ).

#If WinActive("ahk_class ExploreWClass") || WinActive("ahk_class CabinetWClass")

Oh b.t.w. AutoHotKey_L, #If!

+7

, , : _ ahk_class....

GroupAdd, GroupName, ahk_class ExploreWClass
GroupAdd, GroupName, ahk_class CabinetWClass
#IfWinActive ahk_group GroupName
+4

, , ,

#if WinActive("ahk_class cygwin") or WinActive("ahk_class mintty") 

.

+1

: IF.

#IfWinActive (ahk_class cygwin or ahk_class mintty)
0

, :

#IfWinActive ahk_class ExploreWClass|CabinetWClass

: AutoHotKey?

0

All Articles