Solved

How to send Keystroke or mouse clicks to remote desktop?

Posted on 2015-01-28
15
1,006 Views
Last Modified: 2015-02-17
Does anyone know any tool or method to send Keystroke or mouse clicks to remote desktop?
0
Comment
Question by:Subsun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +1
15 Comments
 
LVL 81

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 200 total points
ID: 40577080
Simple answer is that you can't unless you use something like sendkey or (autohotkey) since you are only seeing a representation of the screen and also sending a representation of the keyboard/mouse
0
 
LVL 42

Expert Comment

by:pcelba
ID: 40577098
You should better specify what is your goal. To send any Windows event to the Remote desktop itself is possible because it is just another application in your Windows environment.

To send mouse clicks and keystrokes to an application running under the Remote desktop is  a little bit more difficult but you may look at this code: http://www.codeguru.com/vb/gen/vb_system/keyboard/article.php/c14629/SendKeys.htm
0
 
LVL 40

Author Comment

by:Subsun
ID: 40577120
Thanks for the response, I was in a perception that, SendKeys doesn't work with Remote Desktop. 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.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 40577237
on the server where the app lies use an auto-it or autohotkeys script to open it and call the script and not the application directly
0
 
LVL 40

Author Comment

by:Subsun
ID: 40577284
But in that case also we need to open the user sessions. which is a challenge.. Because we have a license agreement while login which I need to press OK. For some reason our management is not ready to suppress it.
0
 
LVL 42

Expert Comment

by:pcelba
ID: 40577338
Application launch on multiple servers can be done by PS Tools: https://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
0
 
LVL 40

Author Comment

by:Subsun
ID: 40577372
Like I said simply launching the app wont help as it required some manual intervention to start functioning. Also we need to start it from two different user sessions. And while login in to this sessions we need to press ok to a legal warning.
0
 
LVL 42

Accepted Solution

by:
pcelba earned 200 total points
ID: 40578407
In such case you have to execute several EXEs (two at least) under the same RDP session. One of them is your application the other one is checking the app state and sends the keystrokes.

The one sending keystrokes must have admin rights.

To confirm login dialog is not so easy and you'll need some C and Windows internals programmer help.

You should rather redesign your app to work without keyboard/mouse interaction.
0
 
LVL 40

Author Comment

by:Subsun
ID: 40596171
Redesigning of app is not an option, as it is a legacy app and also building new app will take time..

Can anyone give a working example on selecting tab in a third-party application window and clink a button on that window?
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 40596745
Are you able to use Tab to go to that tab, and then press Return to "click" the button?
0
 
LVL 40

Author Comment

by:Subsun
ID: 40598204
@Qlemo, Yes, I can do that, first I need to select the application then use tab keys..
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 40598247
auto-it or autohotkey as previously mentioned will do it.
0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 100 total points
ID: 40598979
In VBS, this is something along
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "Beginning of your application window ttle"
WScript.Sleep 250
Wshshell.SendKeys "{TAB}"
WScript.Sleep 250
Wshshell.SendKeys "{ENTER}"

Open in new window

PowerShell is very similar:
$wsh = New-Object -Com WScript.Shell
$wsh.AppActivate('Beginning of your application window ttle')
start-sleep -m 250
$wsh.SendKeys('{TAB}')
start-sleep -m 250
$wsh.SendKeys('{ENTER}')

Open in new window

0
 
LVL 70

Expert Comment

by:Qlemo
ID: 40598985
This does not work with the RDP session, it needs to be run on the remote system directly.
0
 
LVL 40

Author Comment

by:Subsun
ID: 40614722
Unfortunately I couldn't make any suggestion to work as per my requirement in remote desktop..  I will have to work with product development team to see if there any option to start the application without any manual intervention. I am not deleting this question as there is some valuable suggestion which may help others..
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question