Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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