Jump to content
Sign in to follow this  
ryanbogadi

Working with controls

Recommended Posts

ryanbogadi

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.

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
anyday

toolbars to my understanding do not have individual controls, i would suggest the moustclick function

Share this post


Link to post
Share on other sites
AutoChris

Also, depending on the button you want to click, you can do a PixelSearch() to get the color of the toolbar pic to click. That usually works for me when I am waiting for the "Stop" button on IE to go red.

Share this post


Link to post
Share on other sites
quaizywabbit

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

Share this post


Link to post
Share on other sites
LxP

Toolbars generally just duplicate the options available via a program's menu bar. You may find the WinMenuSelectItem() function quite useful for your purposes.

Share this post


Link to post
Share on other sites
ryanbogadi

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.

Share this post


Link to post
Share on other sites
MHz

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.

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  

×