Sign in to follow this  
Followers 0
dwaynek

How Do I Detect The Active Window Is A Windows Explorer Window?

4 posts in this topic

since Windows Explorer uses a variable window title, i can't detect it with the usual WinActive, so how do i do it?

Share this post


Link to post
Share on other sites



Here this works:

While 1
    If _ExploreWinActive() Then
        MsgBox(0, 'Active', 'Explorer Window Active')
    EndIf
    Sleep(10)
WEnd

Func _ExploreWinActive()
    $OPT_TitleMode = Opt('WinTitleMatchMode', 4)
    If WinActive('classname=ExploreWClass') Then
        Opt('WinTitleMatchMode', $OPT_TitleMode)
        Return 1
    EndIf
    Opt('WinTitleMatchMode', $OPT_TitleMode)
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

SmOke_N, Strange as my explorer windows are of Class: CabinetWClass on XP SP2 :) . Once I change the Class, then your code works well.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

SmOke_N, Strange as my explorer windows are of Class: CabinetWClass on XP SP2 :) . Once I change the Class, then your code works well.

Really? XP Pro SP2 here... hmm

Edit: Actually now that I think about it, that doesn't surprise me. The build is old I believe (2002 if I'm not mistaken).

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0