Jump to content

WinExists partial Class name


Recommended Posts

Hey fellas,

is there a was to check if window exists by only a partial Class?

The Class is apparently dynamic for my window and looks something like: HwndWrapper[app.exe;;255bd6d6-etc-etc-etc]

I would like to search only for app.exe in the class.

Is that doable?

Thanks

Seminko

Link to comment
Share on other sites

Have you tried doing something like this?

WinExists("HwndWrapper[app.exe","")

-- edit --

You might also want to set the Window Title Match option somewhere before calling WinExists()

AutoItSetOption("WinTitleMatchMode", 2) ;Match any substring in the title

 

Edited by willichan
additional information
Link to comment
Share on other sites

23 minutes ago, willichan said:

Have you tried doing something like this?

WinExists("HwndWrapper[app.exe","")

-- edit --

You might also want to set the Window Title Match option somewhere before calling WinExists()

AutoItSetOption("WinTitleMatchMode", 2) ;Match any substring in the title

 

Does not work. I suspect AutoItSetOption only works on Titles not Classes.

Link to comment
Share on other sites

Link to comment
Share on other sites

I used your own example to format the search example I gave you.  You should substitute in the part of the class name you are looking for.

In my test, I looked for my IBM Notes window.  The AutoIt v3 Window Info utility gives me the following info.

>>>> Window <<<<
Title:  Mail - Inbox - IBM Notes
Class:  SWT_Window0

I used the following line to test for it

If WinExists("SWT_Win","") Then MsgBox(0,"test","yes")

For me, I get a "yes" pop-up whenever I have Notes open, and nothing when it is closed.

I can't guarantee that it will work for all apps.  You will need to test it for your situation.

Link to comment
Share on other sites

https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm

REGEXPCLASS - Window classname using a regular expression (if the regular expression is wrong @error will be set to 2)

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...