Sign in to follow this  
Followers 0
Subashes

MSTSC and AutoIT

13 posts in this topic

Is it possible to control the application on remote desktop (MSTSC - RDP / Terminal Server Connection) using Autoit? My intention is to open a user session using MSTSC and open a program in the user session and select a tab, and the clik a ok button in that tab. Please let me know if it is possible or not. If yes. can anyone give any example script? many thanks in advance.

Share this post


Link to post
Share on other sites



You can control the RDP connection, but it sounds like you're asking about launching a connection and then controlling an application on the remote machine is that correct? If so, what is the application? That will determine how easy it is to manipulate, as some GUI-driven apps can be challenging through a remote console.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

hello Subashes, welcome to AutoIt and to the forum!

the limitation is that direct handling of windows and controls over remote session is not possible, as the user actually sees a video of what's going on the server - and you have no contact with the elements of that video. you can simulate mouse clicks, but that heavily depends on the correct visual identification of the elements, and requires lack of user interference (yeah, like that never happens... ;) )

best solution: prepare an AutoIt script that does what you want on the server, then compile it and either publish it (Terminal Server style) or use its shortcut instead of the target application (Remote Desktop style). either way, the compiled AutoIt script runs on the remote machine.

next best solution: if it's that simple, try to simulate everything using key press only (no mouse clicks). if you can do that, than you are probably able to have your script do what you want on the user machine - the only requirement is that the user does not interfere with the operation in the few seconds it should take.

search the forum, this subject has been discussed a few times already.

Share this post


Link to post
Share on other sites

One thing you can do, which I have found helpful, is to run MSTSC, and then after a few seconds to send a CR into the Remote Desktop. This will dismiss those ultra-annoying Legal Captions that block scripts running from the startup menu. Once the Remote Desktop is cooking, though, the answer orbs provided is the only way.

Share this post


Link to post
Share on other sites

Sorry for the late response, I away due to some medical emergency.. Thanks for your replies..

I am trying to automate a application launch on multiple servers. The legacy application need some need some manual intervention, I mean we need to select some tabs and click some buttons to start it. We also need to start the app in two different user sessions.

First challenge : We have a license agreement while RDP login which I need to press OK. (For some reason our management is not ready to suppress it).

If above works, then I will be able to open multiple user sessions using RDP.

Then the next challenge is to start the legacy application and select a specific tab in it and click a button. I can use Tab key to go to that tab, and then press Return to "click" the button. (May be create a exe using AutoIt which perform this task and run it remotely from the server)

But I am clueless how to achieve this. I am new to AutoIt. If any one can help me to get a sample code. I can start experimenting with it and try to make it work.


 

Share this post


Link to post
Share on other sites

Subashes, there is a reason you're being asked what the software is; how can anyone assist you if they don't know what the program is or even have a screenshot of what tabs you need to click on? You need to help us help you. You can start with the name of the legacy application, some screenshots to show where you want to click, and a detailed step by step explanation of what you want to accomplish.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This is a custom program which was developed for our company..

Step by step instructions are..

First I open the MSTSC and the type the server Name and press Connect, Then I get a prompt to enter user name and password and click OK.

Once it's connected I get following legal prompt to press OK.

post-89935-0-62586600-1423495585_thumb.j

Once I login I launch the application using a shortcut in desktop (Application window shown below). Application opens by default to the Setup Tab. I need to click on 'Router' Tab and Then Click on The 'Start Router' button.

post-89935-0-79848600-1423495756_thumb.j

After Clicking The 'Start Router' button, I get a status prompt where I need to press 'Yes'

post-89935-0-43239400-1423495928_thumb.j

Please let me know if you need any further information.

Edited by Subashes

Share this post


Link to post
Share on other sites

@JLogan3o13 did you get a chance to check on this? or do you need any further details? Thanks!

Share this post


Link to post
Share on other sites

Hi I just read your thread quickly, and I'm not that good in autoit at all, but I try to help you out as much as I can.

I assume that connecting with the MSTSC, user names etc is done, since its "still on your PC" (sorry for the unprofessional language :D )

Once you start the application, you can either use Send ("{X tab}{Enter}") where X is the number of tab strokes you need to get to Router. Same way maybe for the Start router button, If the PopUpWindow has its focus on yes, then a Send Enter could work.

Otherwise orbs and clicked solutions seems the best to me, but I must say I never really worked with remotemachines, mostly made scripts that were used as a stand alone application for specified tasks in the company I work for.

If you wanna go with MouseClicks you can first move the Window with WinMove (I guess, may not work since the remote machine) to the 0,0 coordinates, and from there on you can be sure which Control is where to automate it with clicking.

I'm not sure if you can but if you want you can try to decline users usage of their inputs with BlockInput while the scripts run (shouldn't be a real problems since I assume this doesn't really take more then 1min top)

Hope I helped somewhat

Share this post


Link to post
Share on other sites

as for connection - there should be no problem storing your server hostname, your username and password (and certificate, if applicable) into an .rdp file.

as for the legal prompt - it is technically possible to automate, but you are going to click that manually. if you want that removed. contact the sysadmin in-charge and have them disable it (unless mandated by some regulations, of course).

as for the application - are you allowed to run your script on the server? how you proceed depends on an answer to this question.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Compile a script, and port it over, and run it via PAEXEC.

You would have to do all pixel searches and OCR through MSTSC, which would be (not entirely, but effectively) imposible.  Imposible from a consistancy of execution perspective.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Can any of you provide a sample script? I don't have any experience with Autoit. Thanks in advance.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Open the help file...look at all the Win* (window functions) and Control* functions.

Outside of that, you can always go to a pay for scripting site if you want someone to do all the work

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  
Followers 0