atvaxtr Posted January 18, 2017 Share Posted January 18, 2017 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 18, 2017 Moderators Share Posted January 18, 2017 @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")) atvaxtr 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
atvaxtr Posted January 20, 2017 Author Share Posted January 20, 2017 (edited) WOW, first answer = exact solution. What a great feeling 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 January 20, 2017 by atvaxtr Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now