How to capture a column value from my application?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

How to capture a column value from my application?

Post by aqua267 » Thu Nov 11, 2010 5:35 pm

How do I capture the value in a particular column from my application?
My screen looks like this:

Col1 Col2 Col3
col1value col2value col3value

I need to capture the value in col3value.

I am thinking of using GetWindowTextEx>Title*,Getvalues. But this will capture everything in the screen?
Should I store the result in an array and loop to find the value I am looking for?
I am always looking for a particular column value. that does not change.

Thanks.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Thu Nov 11, 2010 6:01 pm

One possible method is to click in the first column always,and then
just push the tab key the required number of times to focus the correct column.

Then depending upon the application, highlight the cell contents and issue a Ctrl-c to copy the value to the clipboard. Then a getclipboard command retrieves it and puts it in a variable.

To get the cell to highlight, sometimes it works to send Ctrl-a (select all), and sometimes it works to send a space character, and sometimes a double click works. Do it yourself manually first to see what works, before you start coding the script.

aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Post by aqua267 » Thu Nov 11, 2010 6:40 pm

Thanks for your reply.
However, I cannot select one column value at a time, even using tab. A tab and copy will select the entire row, not a particular column value.

What I've is a single row with 9 column values. The column values are not editable. I am looking to retrieve the 8th column value. I tried GetTextInRec and it works, however the downside is I need to pass the cursor position and I do not want to hard code that value.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Thu Nov 11, 2010 6:50 pm

Get the entire row into a variable.

Then separate it into it's component parts.

What is the delimiter? one or more spaces? comma?

Use the Separate command
and then trim the individual variables if needed to
get rid of extra spaces.


Here is one way to trim off excess spaces
VBEval>Trim("%trimthis%"),result

aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Post by aqua267 » Thu Nov 11, 2010 7:09 pm

Will try that. Thanks again.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts