More AutoHotKey Fun Writer #1, 2024-08-092024-08-10 In AutoHotKey, if you have some typing shortcuts, it can be helpful to know which window you’ll be typing in to. For example, if I’m on my OneNote app, I might have one series of key presses but if I’m in AmpleNote it will be another series of key presses. While you can use the #IfWinActive conditional, or WinActive() function, if you need to know which webpage is active then those functions don’t help much. For that, you’ll need to know this. At the top of my AutoHotKey script, I have a function that figures out the app name. The full app name is a built in variable in AutoHotKey called WinGetTitle, but it can have a very long name that is concatenated with very specific things. This window I’m typing in to is in Firefox, but the full window title is “Add New Post ‹ benjf.com — WordPress — Mozilla Firefox”, so I can’t just check if it equals “Firefox”, because it doesn’t. So, I can simply check if “Firefox” is in the string. GetAppName(){ WinGetTitle, Title, A isAmpleNote := False isOneNote := False if InStr(Title, "Amplenote") > 0 { return "AmpleNote" } if InStr(Title, "OneNote") > 0 { return "OneNote" } } Then, anywhere later in my script, I can check if the active app is AmpleNote like this: If GetAppName() = "AmpleNote" { Send, [[ } Desktop Productivity amplenoteautohotkey