Sign in to follow this  
Followers 0
atvaxtr

Open folder / activate folderwindow

3 posts in this topic

Hi everybody,
I need a Script like this

If WinExists "D:\Dowloads\Pics" Then
    WinActivate "D:\Dowloads\Pics"
Else
    Run("Explorer.exe " & "D:\Dowloads\Pics")
EndIf

But how can I check wether the Window with a specif PATH is already opened / exists....?

Thank you very much

Share this post


Link to post
Share on other sites



@atvaxtr You could use the AutoIt Window info tool to get title and text of the window, which should then work with WinExists. This works fine for me (pointed at my pictures directory):

If WinExists("Pictures", "C:\Users\LoganJ\Pictures") Then
    WinActivate("Pictures", "C:\Users\LoganJ\Pictures")
Else
    ShellExecute(@UserProfileDir & "\Pictures")
EndIf

Alternatively, you can use WinList to get a list of all windows open that conform to either your title or text specifications, and use that to determine the window's existence. Try something like this to see what I mean:

#include <Array.au3>

_ArrayDisplay(WinList("Pictures", "C:\Users\LoganJ"))

 

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

WOW, first answer = exact solution. What a great feeling :D

Thank you so much JLogan! my code works like a charm now
The second code via Array looks interesting too. I definitly will try it out.

Have a nice day everybody :)

Edited by atvaxtr

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