Retrieving text from a minimized window

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Retrieving text from a minimized window

Post by ineedh3lp » Tue May 10, 2011 5:55 pm

Greetings!

I'm currently working on multiple small projects. One of them is a chat room bot that listens to commands and returns different kinds of results.

The way it's capturing text now is by using "GetTextAtPoint". The biggest inconvenient at the moment is that I have to keep the chat window visible at all times and it has to keep the same position and size.

My query's the following: is there a more convenient way of retrieving chat text from a minimized (unfocused) window. I am aware that you can't give me a clear example fitting exactly my situation, but please try to imagine the scenario and provide me with example code that could put me on the right track, so I can then come back and ask about more specific issues.

Thank you.

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

Post by adroege » Tue May 10, 2011 6:15 pm

Have you tried

GetControlText>

??

It won't work with every application, but if it works with yours
then problem is solved.

Use the "view system windows" tool while your chat room program is running to help you find the proper parameters to GetControlText

ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Post by ineedh3lp » Tue May 10, 2011 7:45 pm

JRL just told me about SetControlText in a different topic and I didn't think of checking GetControlText. *sigh*

Thank you, adroege! It works retrieving text from the main chat box. It gets all the text, and the last line is a blank one.

Code: Select all

[...]
[23:03:45] <bot1> test1
[23:03:47] <bot1> test2
[23:03:49] <bot1> test3
[23:03:50] <bot1> test4
[23:03:52] <bot1> test5
[blank line here]
Could you show me how to store the line before the blank one to a variable? (i.e. [23:03:52] test5)

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

Post by adroege » Tue May 10, 2011 8:11 pm

This should help you out

Code: Select all

//You are doing something like this already
//GetControlText>WindowTitle,ClassName,Instance,Result

//I'm simulating getcontroltext by just putting the output in a "result" variable
Let>result=[23:03:45] <bot1> test1%CRLF%[23:03:47] <bot1> test2%CRLF%[23:03:49] <bot1> test3%CRLF%[23:03:50] <bot1> test4%CRLF%[23:03:52] <bot1> test5%CRLF%
 
//This separates the text into lines
Separate>result,%CRLF%,items

//You may need to adjust this to items_6
MessageModal>items_5

ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Post by ineedh3lp » Tue May 10, 2011 8:27 pm

I took your example and changed the last lines to:

Let>last_but_one=items_count-1
MessageModal>items_%last_but_one%


so it returns the last line before the blank one regardless of line numbers.

Thank you for your support!

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