Sending text to 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

Sending text to a minimized window

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

Hello!

If I focus the chat box of a chat client before minimizing it, could I then send text to it without focusing the client?

If it is possible, could you show me an example? Like sending "Hello!" to a chat client (chatclient.exe).

Thank you!

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue May 10, 2011 12:41 pm

I don't have chat to test but to answer your question: When a window is minimized, it no longer has focus so as you have probably already found, you can't Send> text to it.

You might try the SetControlText> function. It can place text in a minimized Notepad window.

Code: Select all

Run>Notepad.exe
WaitWindowOpen>Untitled - Notepad
WindowAction>2,Untitled - Notepad

Input>SendData,Enter something to send to minimized Notepad
SetControlText>Untitled - Notepad,Edit,1,SendData

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

Post by ineedh3lp » Tue May 10, 2011 4:30 pm

Thank you! It works!

I replaced the tile in your example with the chat window title, identified the class name using the View System Windows tool, set class instance to 2 since there were two classes with the same name and the chat box was the second.

The only question is how do I instruct the script to press "ENTER" so it actually sends the message? And if that's possible, could it be extended to inserting multiple lines (CTRL+ENTER)*?

*the chat window accepts and sends multiple lines.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue May 10, 2011 4:41 pm

The only question is how do I instruct the script to press "ENTER" so it actually sends the message?
Try using the PushButton> function.
could it be extended to inserting multiple lines
Try sending %CRLF% using SetControlText>. Hopefully you'll get a new line each time you do.

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

Post by ineedh3lp » Tue May 10, 2011 4:56 pm

Excellent! Thank you once again, JRL!

Support on this forum is great.

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