Jump to content
Sign in to follow this  
cvocvo

Windows Explorer Current Path in Windows 7/Vista

Recommended Posts

cvocvo

I've been looking for a clean way to get the current path of a explorer window in Windows 7/Vista and have yet to come across anything.

What I have found is a stellar solution for Windows XP: http://www.autoitscript.com/forum/index.php?showtopic=89833

Has anyone succeeded in getting this (above) script to work in Windows Vista or 7? I don't understand why it wouldn't work in 7 -- the class for an explorer window is still CabinetWClass.

Any suggestions that might help get this working? Or any other solutions that might solve this problem?--I could always use @OSVersion and fork for XP and Vista/7.

Thanks

Edit:

After thinking about this some more, I have something that will work. *Note: I haven't tested on Vista yet, only 7.

;;;This is the code that would go in your code, does the string analysis to get the path
for $i = 1 to $var[0][0]
    If @OSVersion = "WIN_7" Then
        $string = _GetWindowsExplorerPath($var[$i][1])
        $string = StringReplace($string, "Address: ", "")
        $string = StringSplit($string, @CRLF)
        MsgBox(0,"", $string[1])
    ElseIf @OSVersion = "WIN_VISTA" Then
        $string = _GetWindowsExplorerPath($var[$i][1])
        $string = StringReplace($string, "Address: ", "")
        $string = StringSplit($string, @CRLF)
        MsgBox(0,"", $string[1])
    Else
        MsgBox (0, "", _GetWindowsExplorerPath($var[$i][1]))
    EndIf
Next

;;This gets added to the function
;;It goes below this line:
;;If ($className[2] <> "ExploreWClass" And $className[2] <> "CabinetWClass") Then Return SetError(1, 0, "")

If @OSVersion = "WIN_7" Then Return WinGetText($hWnd,"")
If @OSVersion = "WIN_Vista" Then Return WinGetText($hWnd,"")

Hopefully there's a less messy solution out there, but for now this seems like it could work.

Edited by cvocvo

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.