Jump to content

Clicking on a button with no name


Recommended Posts

Hey all, I am trying to do two things in a program: click on a button, then select two items from a list that appears. However, I am having problems with the former as the button has no caption (lazy programmers, I expect).

The button has no caption, so I have tried using the handle property instead. However, that doesnt seem to be working. I'm using the following code:

CODE

ControlClick ("List Items", "","[HANDLE:00A044E]")

Winspy reports the Handle as being the "00A044E" as listed above.

What am I doing wrong there?

I also need to select two items from a list that's in a ListBox, but I can't find any sample code on doing this. Anybody got any to hand?

Link to comment
Share on other sites

Hey all, I am trying to do two things in a program: click on a button, then select two items from a list that appears. However, I am having problems with the former as the button has no caption (lazy programmers, I expect).

The button has no caption, so I have tried using the handle property instead. However, that doesnt seem to be working. I'm using the following code:

ControlClick ("List Items", "","[HANDLE:00A044E]")

Winspy reports the Handle as being the "00A044E" as listed above.

What am I doing wrong there?

I also need to select two items from a list that's in a ListBox, but I can't find any sample code on doing this. Anybody got any to hand?

That will not work twice because handles are unique to the running instance and change every time.

Use AutoIt's AU3Info.exe and get the control ID number, or ClassNameNN, or X/Y coords instead. See "Controls" in the help file for all the ways you can identify them.

:P

P.S. Just for academic sake: You can use the handle if you get it this way:

$hButton = HWND("00A044E")
ControlClick ("List Items", "", $hButton)
But, as I said before, this will have to be recoded every instance because the handle will change, so it is next to useless. 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

awesome! Using the combination of class name and instance worked. Now, how do I select the items from the listBox, based on the text they contain?

You can try ControlListView(), in the help file.

If it gets more complicated you go with the _GUICtrlListView_* UDFs, like _GUICtrlListView_FindInText() and _GUICtrlListView_ClickItem(), again they are in the help file.

:P

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