Jump to content

[TITLE:test; CLASS;test2] not working?


 Share

Recommended Posts

I have the following function:

While WinExists("[TITLE:Test; CLASS:HwndWrapper]","")

CloseTest()

WEnd

Where CloseTest is:

Func CloseTest()

WinActivate("[TITLE:Test; CLASS:HwndWrapper]","")

If WinActive("[TITLE:Test; CLASS:HwndWrapper]","") Then

Send("!{F4}")

EndIf

EndFunc

My problem is that when I have 2 or more windows with the title Test, they are all closed, even the ones taht do not match the class. Now I don't see why this isn't working, since I used pretty much matched an example from the help files (topic Advanced Window Descriptions):

e.g. Wait for the 2nd instance of a window with title "My Window" and classname "My Class"

WinWaitActive("[TITLE:My Window; CLASS:My Class; INSTANCE:2]", "")

It seems like the CLASS is being ignored altogether. Can anyone confirm this or tell me what I'm doing wrong?

Link to comment
Share on other sites

Try something like this:

While WinExists("[TITLE:Test; CLASS:HwndWrapper; INSTANCE:2]","")
  WinClose("[TITLE:Test; CLASS:HwndWrapper; INSTANCE:2]", "")
  Sleep(100)
WEnd
Thank you for your response. I'm afraid the problem is the same; all windows with TITLE 'Test' are closed, no matter if the CLASS is matched or not. This is my fundamental problem; the function is supposed to only target the windows that match TITLE and CLASS, but only the TITLE seems to be considered.
Link to comment
Share on other sites

Thank you for your response. I'm afraid the problem is the same; all windows with TITLE 'Test' are closed, no matter if the CLASS is matched or not. This is my fundamental problem; the function is supposed to only target the windows that match TITLE and CLASS, but only the TITLE seems to be considered.

If it's true then you probably found a bug in AutoIt.

Maybe you should post this in bugtrack.

Edited by Zedna
Link to comment
Share on other sites

  • 4 weeks later...

Can confirm this,

If WinActive("[TITLE:My App; CLASS:My Class]")oÝ÷ Úf­r¬¢yr¶­Ù^jw¢jez×¥Ê('¢·¬¶«,½êÚºÚ"µÍYÚ[XÝ]J   ][ÝÖÕUN^HI][ÝÊH[Ú[XÝ]J   ][ÝÖÐÓTÔÎ^HÛÜ×I][ÝÊ
works. This is a solution for active windows only, because there can only be one active window at a time. It's very likely it will wreak havoc if used with WinExists
Link to comment
Share on other sites

Can confirm this,

If WinActive("[TITLE:My App; CLASS:My Class]")
matches only the title and completely ignores the class, however

If WinActive("[TITLE:My App]") And WinActive("[CLASS:My Class]")
works. This is a solution for active windows only, because there can only be one active window at a time. It's very likely it will wreak havoc if used with WinExists
I think this is as intended. The first match condition is checked, and further checks are done ONLY if there are multiple matches. The match conditions are not all AND'ed by the function, they are used left to right until an single match is found.

You could submit a change to behavior as a change request, but I don't think it's a bug.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Administrators

The first one should only match windows called "My App" that are also of the class "My Class". For example

[TITLE: test.txt - Notepad; CLASS:Notepad] will only match Notepad windows called "test.txt - Notepad". Any other window that happened to be called "test.txt" but wasn't a notepad windows would be ignored.

If that's not working then it's a bug, but we tested this scenario a lot and AFAIK it's working correctly...

Link to comment
Share on other sites

It was a bug (#562). It's been fixed in the betas for some time now. When specifying a title and then class in that order, the class portion was ignored. This is a bug in the last stable release, so use the beta if it's important not to have this bug.

Edit: Forgot I could use the ticket tag.

Edited by Valik
Link to comment
Share on other sites

The first one should only match windows called "My App" that are also of the class "My Class". For example

[TITLE: test.txt - Notepad; CLASS:Notepad] will only match Notepad windows called "test.txt - Notepad". Any other window that happened to be called "test.txt" but wasn't a notepad windows would be ignored.

If that's not working then it's a bug, but we tested this scenario a lot and AFAIK it's working correctly...

Guess we got a bug after all, then. <deleted>

Rats, forgot to test in Beta. This was fixed in 3.2.13.8. I should have tested with current Beta before using the word "bug"... sorry.

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

To clarify, I specifically tried to use

If WinActive("[TITLE:Tabula Rasa; CLASS:PalantirAppWindowClass]") Then Beep(100, 50)

which beeped when I switched to the game and beeped when I opened the folder named 'Tabula Rasa' (where the game is installed in, e.g. to view screenshots) with Windows Explorer

Any idea when the next final release of AutoIt will be ready?

Link to comment
Share on other sites

To clarify, I specifically tried to use

If WinActive("[TITLE:Tabula Rasa; CLASS:PalantirAppWindowClass]") Then Beep(100, 50)

which beeped when I switched to the game and beeped when I opened the folder named 'Tabula Rasa' (where the game is installed in, e.g. to view screenshots) with Windows Explorer

Any idea when the next final release of AutoIt will be ready?

You can get the current Beta (3.2.13.10) right now. Your script should work with that, or any Beta after 3.2.13.8. :(

As for 3.2.14.0, Jon has a radioactive-source hardware random number generator that determines when the next Prod release will be. You just never know... :mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...