# Send Keyboard Input with GUI Automation

**URL:** <https://www.finalbuilder.com/forums/t/send-keyboard-input-with-gui-automation/1103>\
**Category:** Discussion\
**Created:** [February 6, 2009, 3:55am UTC](https://www.finalbuilder.com/forums/t/send-keyboard-input-with-gui-automation/1103 "2009-02-06T03:55:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)\
**Post date:** [February 6, 2009, 3:55am UTC](https://www.finalbuilder.com/forums/t/send-keyboard-input-with-gui-automation/1103/1 "2009-02-06T03:55:49Z")

</div>

I'm using FinalBuilder6 to try and automate a task that someone performs every night&nbsp;which involves them connecting to a terminal server, execute a program, enter credentials and files get downloaded.

What I have done so far is:

- I execute mstsc to connect to the terminal server
- I click on the message box before the login box
- I click in the field for the user name

Those things all work fine. The next step I have is to send keyboard input to type in the user name. To set this up I click on the "Click Here to find a control in a running application" to select the control where I want to type and on the keyboard input tab I have test being typed. When this step runs I get a message in the build log saying "Object reference not set to an instance of an object".

Anyone know what I might be doing wrong?

On a related note is there any way to do the GUI Automation in such a way that does not require me to select the target on every step. My vision is that I set an object variable to the target application then I can just sent keyboard input to that object.

Your help is appreciated.

---

<div class="post-metadata">

**Author:** ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)\
**Post date:** [February 24, 2009, 11:09am UTC](https://www.finalbuilder.com/forums/t/send-keyboard-input-with-gui-automation/1103/2 "2009-02-24T11:09:48Z")

</div>

What is the website you want to login?

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [February 25, 2009, 1:05am UTC](https://www.finalbuilder.com/forums/t/send-keyboard-input-with-gui-automation/1103/3 "2009-02-25T01:05:31Z")

</div>

Hi Dave   
  
 Which version of windows and terminal service client are you using. I Just tested this and it worked fine and logged me into the remote machine. This may be a timing related issue though. I had to include a pause after executing mstsc, and after clicking on the connect button I added a Wait for Window to find the user name field before attempting to provide the user name.   
  
 Having gotten past that, I hit a road block… it’s seems it’s not possible (at least with FinalBuilder) to automate windows inside a remote desktop window. The windows api calls we use to find windows and child windows does not work for remote desktops.

---

<div class="post-metadata">

**Author:** ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)\
**Post date:** [February 25, 2009, 3:20am UTC](https://www.finalbuilder.com/forums/t/send-keyboard-input-with-gui-automation/1103/4 "2009-02-25T03:20:12Z")

</div>

Saeed, it’s not a website I’m trying to login to rather it a location application on the server that does not support command line arguments.   
  
 Vincent, I am using Windows 2003 as both the target of the TS connection and from the client side of the automation. I have gotten to the point that I can login to the terminal server but like you I have run into an issue with being able to control the child window.
