AutoHotKey: #IfWinActive .* Explorer *. ? in windows 7

Ola picture Ola · Dec 9, 2010 · Viewed 7.5k times · Source

I'm trying to make an AutoHotKey macro that's active only in Windows Explorer but I don't know the name of Explorer in Windows 7. I tried the following:

;Make explorer understand that Ctrl+L means goto location bar (like Firefox / Chrome)
#IfWinActive .* Explorer *.
    ^l::Send {F4}
#IfWinActive

Any ideas?

Answer

Nathan picture Nathan · Dec 9, 2010

Autohotkey comes with a program called Window Spy. You can use it to discover the title of the active window.

Also, take note of ahk_class (look up ahk_class in the help file), which uses the type of window, rather than the title. For example, in my Win 7 case, I can restrict hotkeys to explorer by specifying:

#IfWinActive ahk_class CabinetWClass