Jump to content
Sign in to follow this  
jsp

Terminal Server connection

Recommended Posts

jsp

Hi everybody,

I am working on my first AutoIT script (except from those of the Tutorials).

I want to use AutoIT as a testing bot for some of our corporate applications. One of these applications works under Terminal server and I am automating the process of entering a user/password and performing some additional actions.

The script is really, really simple (Did I say I am noob?). It works perfectly...as long as I have the RDP session opened in front of me, that is, active.

The following piece of code works perfectly if I keep RDP pen:

Run ("Application")
WinWaitActive ("Window Name", "Any Text")
Send ("AAA")
Send ("{TAB}")
Send ("AAA")
Send ("{TAB}")
Send ("{ENTER}")

But as long as I run the script automatically (i.e., I configure the user's profile or group policies to run the script for terminal services users) it stops working.

The moment I maximize the RDP session, the script keeps working perfectly.

I now it has some relation with the focus of the window. Obviously, when I minimize the RDP session teh focus is lost, but if I try AutoIT to set focus on the window it does not seem to work:

WinActivate ("Window Name")
WinWaitActive ("Window Name", "Any Text")
Send ("AAA")
Send ("{TAB}")
Send ("AAA")
Send ("{TAB}")
Send ("{ENTER}")

Probably I´m wrong with something...

Thanks in advance for your help.

Share this post


Link to post
Share on other sites
ResNullius

Hi everybody,

I am working on my first AutoIT script (except from those of the Tutorials).

I want to use AutoIT as a testing bot for some of our corporate applications. One of these applications works under Terminal server and I am automating the process of entering a user/password and performing some additional actions.

The script is really, really simple (Did I say I am noob?). It works perfectly...as long as I have the RDP session opened in front of me, that is, active.

The following piece of code works perfectly if I keep RDP pen:

Run ("Application")
WinWaitActive ("Window Name", "Any Text")
Send ("AAA")
Send ("{TAB}")
Send ("AAA")
Send ("{TAB}")
Send ("{ENTER}")

But as long as I run the script automatically (i.e., I configure the user's profile or group policies to run the script for terminal services users) it stops working.

The moment I maximize the RDP session, the script keeps working perfectly.

I now it has some relation with the focus of the window. Obviously, when I minimize the RDP session teh focus is lost, but if I try AutoIT to set focus on the window it does not seem to work:

WinActivate ("Window Name")
WinWaitActive ("Window Name", "Any Text")
Send ("AAA")
Send ("{TAB}")
Send ("AAA")
Send ("{TAB}")
Send ("{ENTER}")

Probably I´m wrong with something...

Thanks in advance for your help.

Is your script running on your local machine and acting on the RDP window, or is it running from within he RDP session itself?

Share this post


Link to post
Share on other sites
jsp

Is your script running on your local machine and acting on the RDP window, or is it running from within he RDP session itself?

Hi ResNullius,

from within the RDP session, I'm executing it on the remote machine.

Thanks and best regards.

Share this post


Link to post
Share on other sites
ResNullius

Try SendKeepActive() before your Send.

Or, can you use ControlSend() instead of Send()? It tends to be more reliable in all cases.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×