Jump to content

Unusual cotrol behavior


Recommended Posts

I am trying to automate the installation of winMerge. When I hover over the "Next" button it has

className of Tbutton1,

Control ID of 1377132 (which changes each time it runs so it is not useful)

Text: &Next>

1) The & puzzles me as it is not underlined.

2) After clicking next and going to the next window, the Next button has the control ID it did in the previous window.

3) If I go back to the first window the Next button is now called TButton2.

Is any of this unusual?

Thinking I was wrong when I was thinking I had a handle on this,

jh

Link to comment
Share on other sites

I've run into windows with stacked controls. For instance Button1 = "OK" and Button2 = "Finish" stacked in the same location, and the program enables/disables and hides/unhides the controls to show you the appropriate one. But when you check it out with the AutoIT Window Info Tool, you always get info from the same one regardless (first one in the list of controls at that x/y location, I presume). You can write a detection script with WinGetClassList() that gets the list of all controls, and start sleuthing out the one you really want.

I'm not a fan of people who code their GUI's that way!

:shocked:

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

Thanks PsaltyDS, I will investigate WinGetClassList(). Right now I think I have about crunched thru this one using '&Next >' though I don't understand why the ampersand is there if it is not underlined.

I was hoping you would weigh in on my earlier 'Arranging icons (shortcuts)' post to this list.

http://www.autoitscript.com/forum/index.php?showtopic=44060

Best Regards,

jh

PS - Here's the result of WinGetClassList():

TNewNotebook

TNewNotebookPage

TNewStaticText

TNewStaticText

TNewNotebookPage

TNewNotebook

TNewNotebookPage

TRichEditViewer

TNewNotebookPage

TComboBox

TNewCheckListBox

TNewNotebookPage

TRichEditViewer

TButton

TButton

Edited by hmsSurprise
Link to comment
Share on other sites

PS - Here's the result of WinGetClassList():

TNewNotebook

TNewNotebookPage

TNewStaticText

TNewStaticText

TNewNotebookPage

TNewNotebook

TNewNotebookPage

TRichEditViewer

TNewNotebookPage

TComboBox

TNewCheckListBox

TNewNotebookPage

TRichEditViewer

TButton

TButton

I did this before, but don't have the function laying around any more:

1. Take each unique class name and append the NN number, starting with 1.

2. Get the state of the control with ControlCommand() using that ClassNN name, i.e. TNewNotebook1. Do this in a For/Next loop until the ClassNN name is invalid. For example TNewNotebook1 and TNewNotebook2 return status for 'IsVisible' and 'IsEnabled', but TNewNotebook3 returns @error, because there are only two of those controls.

3. After you have looped through all those possibilities, you have an array of valid ClassNN names and the states of them.

Now is the point where the smart people step in and say "Why didn't you just...", and achieve all that in two lines of code... :shocked:

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...