Sign in to follow this  
Followers 0
frank10

Difficult button recognition

8 posts in this topic

#1 ·  Posted (edited)

Hi to all.

First, I want to thank the author for this awesome program! It is very useful.

My problem is:

I have a program that trigger a timed pop-up window with two buttons that change random every time the window appear (one shows "continue" & the other "Url page..."); they have the same text in the AutoIt Window Info and no different ControlID. Their className are Widget2 - widget1, but this refer to a button that can have both "continue" or "URL".

You can only click the "enter" key or click with the mouse to go on.

If you press the wrong button, you get an Url loaded in the default Browser and then another pop-up.

Is there a way to detect where is the "continue" button?

Thanks a lot for any tips.

Greetings

Edited by frank10

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi to all.

First, I want to thank the author for this awesome program! It is very useful.

My problem is:

I have a program that trigger a timed pop-up window with two buttons that change random every time the window appear (one shows "continue" & the other "Url page..."); they have the same text in the AutoIt Window Info and no different ControlID. Their className are Widget2 - widget1, but this refer to a button that can have both "continue" or "URL".

You can only click the "enter" key or click with the mouse to go on.

If you press the wrong button, you get an Url loaded in the default Browser and then another pop-up.

Is there a way to detect where is the "continue" button?

Thanks a lot for any tips.

Greetings

<{POST_SNAPBACK}>

use "AutoIt Window info" to determine the ClassnameNN.

perhaps it is always the same whatever the position or the focus.

If yes you can use the ControlClick on the right button. :)

Edited by jpm

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

use "AutoIt Window info" to determine the ClassnameNN.

perhaps it is always the same whatever the position or the focus.

If yes you can use the ControlClick on the right button

thanks.

Yes, I tried that and it gives me ClassNameNN: Widget2 on one button & widget1 on the rigth one, but their function is random, so they change on the same ClassName.

what do you mean with ControlClick on right button?

Edit: Neither button has a ControlID and the exact className is QWidget2-1

Edited by frank10

Share this post


Link to post
Share on other sites

thanks.

Yes, I tried that and it gives me ClassNameNN: Widget2 on one button & widget1 on the rigth one, but their function is random, so they change on the same ClassName.

what do you mean with ControlClick on right button?

Edit: Neither button has a ControlID and the exact className is QWidget2-1

<{POST_SNAPBACK}>

so ControlID can be ClassnameNN use it with ControlGetText for both button and do the ControlClick on the button having the right text

:)

Share this post


Link to post
Share on other sites

so ControlID can be ClassnameNN use it with ControlGetText for both button and do the ControlClick on the button having the right text

:)

<{POST_SNAPBACK}>

Ok, no it doesn't work: with ControlGetText the buttons give the same text: "unnamed"

I already tried that, also in the Autoit WindowsInfo there are these two visible window text: "unnamed, unnamed".

I found out a workaround:

I send a "Enter" key with a loop control until I guess the "continue" button (the window disappear). The drawback is that for every "URL" button I get a new Mozilla window. I solved that with a strict-name check to a window named "Mozilla" (the title window before the url is loaded).

This is clearly a workaround, cause I want to exactly know where is the correct button, but it works.

I would like to make this script more generic: I would intercept every type of Internet Window when I press the "URL" button, Internet Explorer, Firefox, Opera...

So, how do you close a window just opened without knowning the title name?

Thanks

Share this post


Link to post
Share on other sites

Bad luck,

I run out of fuel :)

for the window title name does WinGetTitle("") works?

You need to be for sure it is opened first perhpas some sleep(...)

Share this post


Link to post
Share on other sites

@jpm:

Yes it could work.

So I could test if after the first Enter key, the Window active has the name of the main program. Hmm, it should work.

Thanks

Has anyone else any idea about the button recognition problem to make the process cleaner?

Share this post


Link to post
Share on other sites

I have found the solution!

You can control the color under mouse position in a window, so I checked in a position where the text of the different button differs and so the color is different.

So checking the position of the left button where the color correspond to the "continue" button I send "Enter", while if the color is different there must be the "url" button, so I send "Tab" to swith to the other button and then "Enter".

This works perfectly. Wow, great options to choose in Autoit!

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