Jump to content

Working with controls


Recommended Posts

How do I go about using all of these "control" functions to click and send to various controls? I know about the help file, and I know that this is the basic format for ControlClick:

ControlClick ( "title", "text", controlID [, button] [, clicks]] )

But what I don't understand is how to specify what part of the control to click. I used the AU3Info.exe to get the name of the control, but it seems to consider the whole toolbar, for example, to be one big control. So if I use something like this

ControlClick("AutoIt3","","ToolbarWindow323")

it just clicks the button at the end of that toolbar (in this case, Views). So if I wanted to tell it to click the refresh button on the toolbar, how do I do that? Are these controls broken down into smaller controls? Any help is appreciated.

Link to comment
Share on other sites

  • Moderators

You could always use MouseClick() if the Control doesn't have any Text to specify its location or if it doesn't have a unique Control ID / ClassNameNN.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

have a look here under the "ToolBar Control Reference/Messages"

using DllCall to 'SendMessage" you could do quite a bit with a toolbar control.

Since Toolbars aren't part of AutoIt's Gui creation set yet, I'm not aware of any specific UDF's that deal with them.

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

I guess my initial post was a bit misleading. The application I'm trying to create will not be clicking things in the toolbar (except for a couple of instances in which I just use MouseClick). I just thought that the toolbar would be a good general example of what I'm talking about. But in the real application, the controls are inside the window, and they are not always in the same place for every user. Up until now I have used calibration to force the users to locate the controls, then use MouseClick. But I'm really hoping that this can be done without the calibration step, and the only way to do that (that I can think of) is by using the Control functions.

So, when I run AU3Info.exe, it finds controls in this window. For example, the data header row is treated as one long control. And the group of page-scrolling buttons is another control. But if I want to click on an individual cell in the data header row, or an individual button from the page-scrollng group, how do I do that? Is there a way to indicate coordinates within a control (like say "click control X at 100,100")? Again, any help is appreciated.

Link to comment
Share on other sites

Hi ryanbogadi,

Controls are buttons, checkboxes etc. AutoIt works with a control quite differently as to a mouseclick. AutoIt just needs the ControlID to click it, where as a mouseclick needs coordinates. If you know this, good. That is why Control* functions are more reliable. You tell AutoIt to click "button1", and it clicks on it.

Now, the basic rule is, that if AutoItInfo cannot retrieve the ControlID, then AutoIT cannot see it.

So, in response to your last question. Control functions do not use coordinates. ControlGetPos is the only Control function that deals with coordinates, but that is the get coordinates of a control.

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