AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting Keystrokes thru to remote desktop client

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
MisterW



Joined: 20 Jul 2005
Posts: 65

PostPosted: Thu Oct 06, 2005 11:55 am    Post subject: Getting Keystrokes thru to remote desktop client Reply with quote

I'm having trouble getting hotkeys to work using windows (xp) remote desktop client.

Actually (just testing...) They do work but not in fullscreen mode (which is how I tend to work, via a second monitor).

Is there a way to get this working?

Just to clarify, I'm not trying to send hotkeys on the remote machine but just to get them to respond while remote desktop is the active window (in fullscreen mode).
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Oct 07, 2005 1:51 pm    Post subject: Reply with quote

You could try adding the line #UseHook above the definitions of the hotkeys you want to be active. This might allow your client PC to catch the keystrokes (and thus fire the hotkeys) before they get routed to the remote PC.
Back to top
View user's profile Send private message Send e-mail
MisterW



Joined: 20 Jul 2005
Posts: 65

PostPosted: Tue Oct 11, 2005 12:43 am    Post subject: Reply with quote

Chris wrote:
You could try adding the line #UseHook above the definitions of the hotkeys you want to be active. This might allow your client PC to catch the keystrokes (and thus fire the hotkeys) before they get routed to the remote PC.


Thanks for your reply, Chris.

Unfortunately adding #UseHook hasn't affected any change in the way RD responds.

Here's a test script:

#UseHook

#z::
Send Hello
return

When remote desktop is running windowed with notepad open on the remote machine it enters the text "Hello" into notepad.

If I maximise RD to fullscreen it enters the value "z" into notepad.

Anything else i might try?

(Also, pressing the windows key in fullscreen mode activates the taskbar/startmenu on the remote machine - as you would probably expect)

misterw
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Oct 11, 2005 10:59 pm    Post subject: Reply with quote

You've probably thought of this, but the only idea I have left is to run some or all of your hotkeys in a script on the remote machine. In fact, you might be able to have the same script running both remotely and locally so that the hotkeys are the same whether you're running in windowed or full-screen mode.

When I use Remote Desktop, I leave the script running only on the remote machine and always keep the client in full-screen mode. This allows most of my hotkeys to work, though of course they don't work on the machine running the client.
Back to top
View user's profile Send private message Send e-mail
MisterW



Joined: 20 Jul 2005
Posts: 65

PostPosted: Sun Oct 23, 2005 6:02 am    Post subject: Reply with quote

Chris wrote:
You've probably thought of this, but the only idea I have left is to run some or all of your hotkeys in a script on the remote machine. In fact, you might be able to have the same script running both remotely and locally so that the hotkeys are the same whether you're running in windowed or full-screen mode.

Thanks for your help, unfortunately this won't work for me as the remote machine is locked down and I have no privileges to install ahk.

Also mainly I want to be able to send information from the local computer to the remote. I guess I can always include code to minimize the window before sending data/keystrokes and then maximise again when I'm finished.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Oct 23, 2005 2:58 pm    Post subject: Reply with quote

MisterW wrote:
the remote machine is locked down and I have no privileges to install ahk.
As a last resort, you could unzip the no-install version of AutoHotkey onto the machine and try running the script directly (by dragging it onto AutoHotkey.exe, making a shortcut, etc.)
Back to top
View user's profile Send private message Send e-mail
xx3nvyxx



Joined: 05 Sep 2005
Posts: 86
Location: Down the hall, on your left.

PostPosted: Sun Oct 23, 2005 6:39 pm    Post subject: Reply with quote

What about controlsend? Maybe the keys aren't going to the right window. :\
_________________
Now the world has gone to bed,
Darkness won't engulf my head,
I can see by infra-red,
How I hate the night.

Now I lay me down to sleep,
Try to count electric sheep,
Sweet dream wishes you can keep,
How I hate the night.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
MisterW



Joined: 20 Jul 2005
Posts: 65

PostPosted: Mon Oct 24, 2005 5:57 am    Post subject: Reply with quote

Chris wrote:
MisterW wrote:
the remote machine is locked down and I have no privileges to install ahk.
As a last resort, you could unzip the no-install version of AutoHotkey onto the machine and try running the script directly (by dragging it onto AutoHotkey.exe, making a shortcut, etc.)


The only way of getting anything to or from the remote machine is by pasting or typing it. I could try and paste the entire executable but I would need to text encode it and decode it at the other end. Is this what uuencoding is? Still I'm not guaranteed to be able to run it.
There's supposed to be a file transfer option in RD but
1. I don't know how to do it. and
2. I 've heard it doesn't work with our systems for whatever reason.

Ok. Problem Solved (just then actually Very Happy ). There is a setting for RD sessions to enable windows key combinations on either local computer, remote computer or fullscreen mode only. Setting this to local has made things work as I would like. It must have defaulted to fullscreen mode. It does however disable alt-tabbing thru the remote windows when the remote desktop is the active window.
Back to top
View user's profile Send private message
Jerry



Joined: 24 Jun 2004
Posts: 39

PostPosted: Wed Aug 09, 2006 6:41 pm    Post subject: Reply with quote

I just had the problem of the "remote" session (remote desktop) not receiving the keys from autohotkey. The script I have is. When the remote desktop window is open and I press LWin , then the remote session should be minimized.

I have the setting of enable windows key combinations on "fullscreen mode only"

The result would be that the windows key would activate the start menu (on the remote session only)


By experimenting I found out you can solve the problem 3 ways.

1)
a) #usehook must be used (I only needed this command for the letter 'z')
b) the hotkeys must be dynamic
See script below.

2) Start the script after the remote desktop session has started so it get the hook first.

3) You could also keep 'reload'ing the script too.

My guess is that the RDP client window grabs the key first and then hides it from the local machine, like the way autohotkey does. Not sure if this is completly correct but the idea works.

Chris - If your think its worth it, you could add a command to reload / reaquire all hotkeys/hotstrings/etc in a script.

Here is the script
Code:

setTimer, windowwatch, 500
#persistent
#usehook
return

z_key:
; change the z to 'he'
send, he
tooltip done z
settimer, TooltipClear, 2000
return

LWin_key:
; minimize the remote session
winminimize ahk_class TSSHELLWND
tooltip done LWin
settimer, TooltipClear, 2000
Return

TooltipClear:
; just a routine to turn off tooltip after x milliseconds
tooltip
settimer, TooltipClear, off
Return

windowwatch:
ifwinactive ahk_class TSSHELLWND
{
  hotkey LWin, LWin_key, on
  hotkey z, z_key, on
}
else
{
 hotkey LWin, LWin_key, off
 hotkey z, z_key, off
}
Return


Jerry
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Aug 10, 2006 1:01 am    Post subject: Reply with quote

Thanks for posting your findings. They'll be valuable to me and others.

Jerry wrote:
Chris - If your think its worth it, you could add a command to reload / reaquire all hotkeys/hotstrings/etc in a script.
I'll keep that in mind as a future feature (especially if other uses can be discovered for it). Thanks.
Back to top
View user's profile Send private message Send e-mail
vijucat



Joined: 15 Sep 2005
Posts: 2
Location: Hong Kong

PostPosted: Fri Aug 22, 2008 6:01 am    Post subject: Thanks Jerry Reply with quote

Restarting AHK on the local machine after initiating Remote Desktop worked well for me. However, AHK is now running on both machines so I'm not sure which one is picking up the messages! Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group