Sign in to follow this  
Followers 0
madsiddiqui

WinExist - more possibilities?

2 posts in this topic

WinExists, is it possible to check for an existing windows by other means? Like windows size, Style, ExStyle.. Or by HiddenText?

I just need a code for this, I need to exit a program by checking if its running..

I can't use process, window name or class because it can be changed easily...

"class" can be same on other programs, it might mess it up.

Thanks ahead.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can get all the windows from a same class whit this.

#include <array.au3>
Run("notepad.exe")
Run("notepad.exe")
Run("notepad.exe")
Run("notepad.exe")
sleep(1000) ; until all notepad are opened
$List = WinList("[CLASS:Notepad]")
_ArrayDisplay($List)

Later you can do a check loop and search for wherever you want, Size (WinGetPos), Style and ExStyle (_WinAPI_GetWindowLong) Visible Text (_WinAPI_GetWindowtext)

For $i = 1 to $List[0][0]
    If _WinAPI_GetWindowtext($List[$i][1]) = "wherever the text you are looking for..." then WinClose($list[$i][1])
Next
Edited by monoscout999

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