Jump to content

Controls and Handles


Recommended Posts

I'm writing an application to automate macros on top of another window, and have a question. In my window, I see that all of the cells in the table have the same ControlID, namely Edit1. Is there a way to distinguish between them? I thought that maybe the Control Handle would accomplish this, but they all have the same control handle as well. So that leads to my next question: What exactly is the control handle, and why is it useful? I want to be able to send data to specific cells in the table, but I don't know how to specify which cell (control) to send to. Any help is appreciated.

Link to comment
Share on other sites

I'm writing an application to automate macros on top of another window, and have a question.  In my window, I see that all of the cells in the table have the same ControlID, namely Edit1.  Is there a way to distinguish between them?  I thought that maybe the Control Handle would accomplish this, but they all have the same control handle as well.  So that leads to my next question: What exactly is the control handle, and why is it useful?  I want to be able to send data to specific cells in the table, but I don't know how to specify which cell (control) to send to.  Any help is appreciated.

<{POST_SNAPBACK}>

are you automating for excel? if yes, then your options will be:

1)finding cells with keypresses... example: Send("^{HOME} {Down 4}{Right 4}") to go to cell D4.

2)COM. Beta is required to use COM, but can interact with excel at object level and have alot of control over it that way

3)VBA. Excel has visual basic for applications included with it. You can do about anything in VBA, it has all of the features of the Visual Basic IDE (a book i have says that it's actually the engine that runs that IDE) including an object viewer, and full help files (unlike visual studio that runs help from MSDN) with examples.

Link to comment
Share on other sites

No, the table I mentioned is not in Excel. It's a separate application, with it's own set of key functions. For instance, HOME goes to the beginning of the current row rather than the top-left cell. And I can't simply start from the corner and scroll to the cell I want, because different users will have different numbers of rows/columns in their table. So basically, I need a way to specify a cell regardless of its position in the table. Is there any truly unique identifier for cells like these?

Link to comment
Share on other sites

No, the table I mentioned is not in Excel.  It's a separate application, with it's own set of key functions.  For instance, HOME goes to the beginning of the current row rather than the top-left cell.  And I can't simply start from the corner and scroll to the cell I want, because different users will have different numbers of rows/columns in their table.  So basically, I need a way to specify a cell regardless of its position in the table.  Is there any truly unique identifier for cells like these?

<{POST_SNAPBACK}>

Without knowing the program i can't offer any better advice, sorry...Maybe if you list the program name you're trying to work with someone else has already made some progress with it...
Link to comment
Share on other sites

It is highly unlikely that ayone here has ever used this program before, seeing as how it's a product demand forecasting application (used only for work). But the other thing that I forgot to mention that struck me as rather strange is this. When I used ControlGetHandle on different cells in the tables, all of the edit controls in the top table came up with the same handle. But in another table (in the same program, different sub-window) the edit controls came up with a different handle. So it appears that the control handle may help me to differentiate between cells in the top and bottom tables, just not between cells in the same table. Any ideas or comments?

Link to comment
Share on other sites

It is highly unlikely that ayone here has ever used this program before, seeing as how it's a product demand forecasting application (used only for work).  But the other thing that I forgot to mention that struck me as rather strange is this.  When I used ControlGetHandle on different cells in the tables, all of the edit controls in the top table came up with the same handle.  But in another table (in the same program, different sub-window) the edit controls came up with a different handle.  So it appears that the control handle may help me to differentiate between cells in the top and bottom tables, just not between cells in the same table.  Any ideas or comments?

<{POST_SNAPBACK}>

you're right, the odds of someone using the application that you're using, and reading the forums that you're reading, and knowing what you're trying learn is very unlikely. </sarcasm> Sorry, it just seems like you're looking for a way to work with a specific application. without any information about the application, i don't see how you could expect a good answer tailored to that application. maybe include some AutoIT window info screenshots so we see what output you're getting from it, etc. It's hard to offer a solution without anything to work with
Link to comment
Share on other sites

Ok, I'll see if I can give a specific example of what I'm talking about. In this particuar window there are two cells (controls) side-by-side. They hold different information, but their formats are exactly the same (both hold dates, both are the same size, etc.) When I run AU3Info, I get this the same IDs and ClassNames for both controls. See the 2 attached files for screenshots of the AU3Info window. You can see by the Positions that they are not the same control, but their identifiers are the same. Sorry if the attachments don't come out right, but I'm new to the forum and wasn't sure how to do this.

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