1

I've made a script that will set an environment variable to the path in the current Explorer windows when its hotkey is pressed. However, I want this to only trigger if the active window is an Explorer window. This should do it:

  #IfWinActive ahk_class ExploreWClass|CabinetWClass
     #p::
        SetPath()
     return
  #IfWinActive

But for some reason it isn't. Is there something I'm doing wrong?

  • Which version of Windows? XP, Vista, 7? – iglvzx Mar 21 '12 at 23:01
  • 2
    @iglvzx Sorry, Windows XP. Added that to the tags. – SaintWacko Mar 21 '12 at 23:11
3

The pipe syntax seems to be iffy. Use a variant instead:

#IfWinActive ahk_class ExploreWClass
    #z::
#IfWinActive ahk_class CabinetWClass
    #z::
        MsgBox SetPath()
    return
#IfWinActive
  • Perfect, that did it. Thanks! And that will still call SetPath if it's ExploreWClass? – SaintWacko Mar 22 '12 at 15:38
  • Yes, they fall through until either the EOF or an #IfWinActive with no parameters. – Synetech Mar 22 '12 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.