open with one #IfWinActive
and then the text you want to be in the title. AHK does partial matches. Then put the hotkey like normal, and close the block with another #IfWinActive
.
; This makes Ctrl+Shift+N send Ctrl+Shift+P when a Firefox window is active
#IfWinActive — Mozilla Firefox
^+n::
Send, ^+p
#IfWinActive
You can also chain them like this:
#IfWinActive ahk_class Notepad
^!c::MsgBox You pressed Control+Alt+C in Notepad.
#IfWinActive ahk_class WordPadClass
^!c::MsgBox You pressed Control+Alt+C in WordPad.
#IfWinActive
That's from the AHK docs, I'm not sure what the ahk_class
is about.