Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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
@iglvzx Sorry, Windows XP. Added that to the tags. – SaintWacko Mar 21 '12 at 23:11
up vote 3 down vote accepted

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

#IfWinActive ahk_class ExploreWClass
#IfWinActive ahk_class CabinetWClass
        MsgBox SetPath()
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .