Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to retrieve text displayed on Java window.

Status
Not open for further replies.

markatitg

Technical User
Mar 5, 2008
2
0
0
US
Hi Everyone,

I'm trying to retrieve a portion of a text string from a Java window. The text is an output indicating when the process starts and ends.


This is what the display on the Java window looks like as time goes on.


10:44:29 Process begins
10:44:29 Process running
10:46:30 Process stopped


I'm trying to get the first "time" HH:MM:SS where the process begin "10:44:29" and save this into a variable so I can verify this time with other area on the Java application where this time also appears.

This is the string that gets generated when I clicked on the text area on the Java window.

JavaWindow("Trading Application").JavaInternalFrame("Process Progress...").JavaEdit("JTextArea").SetCaretPos 0,9

I've tried using ToString, but that did not work.

I would appreciate it if anyone can give me any suggestions.

Thank you very much,

Mark
 
Hi.

What you're doing with
Code:
JavaWindow("Trading Application").JavaInternalFrame("Process Progress...").JavaEdit("JTextArea").SetCaretPos 0,9
is setting the cursor position.

I'd suggest adding .Value in place of the .SetCaretPos 0,9 statement. This will capture the entirety of the edit box, so you may need to filter the string once it's captured to grab the first time instance.

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Hi markatitg,

You can also use GetRoProperty or GetToProperty methods with setting the desired property to "text".

I hope this will help you solving your problem.

Kind regards,
GUIValid
 
Thanks for all the responses and helpful tips.

I ended up using GetROProperty as suggested by GUIValid.

Then passing the whole string to a variable (TempText), and then using regular expression to parse the string to a new variable.

TempText=JavaWindow("Trading Application").JavaInternalFrame("Process Progress...").JavaEdit("JTextArea").GetROProperty("text")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top