The AutoHotkey Beginner Tutorial includes a sample script to demonstrate window specific hotkeys and hotstrings.
#IfWinActive ahk_class Notepad
::msg::You typed msg in Notepad
#IfWinActive
#IfWinActive untitled - Paint
::msg::You typed msg in MSPaint!
#IfWinActive
The second example is fairly self-explanatory: Check for a window named "untitled - Paint". It's the first example's use of ahk_class
that has me confused.
I haven't been able to find any explanation of the variable in the AHK documentation. According to an AHK forum post, ahk_class
is the name of a window as given by Windows Spy, the post didn't go into any more detail.
Would there be any difference between using ahk_class Notepad
and Untitled - Notepad
? Would the second example work if replaced with #IfWinActive ahk_class Paint
?
What is ahk_class
and how can I use it for window matching?