Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do you get AutoHotKey hotkeys to work with Remote Desktop in fullscreen on Windows 7?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

As user16659 notes, Reload makes the hotkeys work again (But his script did not work for me).

Basically, I now have two scripts running, one which contains my hotkeys and hotstrings "script.ahk" and another which will reload this script if RDP is maximised "controller.ahk".

script.ahk:

#SingleInstance force
::hw::Hello World

controller.ahk:

Run "autohotkey" "script.ahk"

#Persistent
SetTimer, ReloadOnRDPMaximized, 500
return

ReloadOnRDPMaximized:
If WinActive("ahk_class TscShellContainerClass")
{
    WinGet, maxOrMin, MinMax, ahk_class TscShellContainerClass

    if (maxOrMin = 0) {
        WinGetPos, PosX, PosY, WinWidth, WinHeight, ahk_class TscShellContainerClass

        if (PosY = 0) {
            ; it is fully maximized therefore reload "script.ahk"
            Run "autohotkey" "script.ahk"

            ; wait until window gets deactivated so you don't reload it again.
            WinWaitNotActive, ahk_class TscShellContainerClass

        }
    }
}
return
share|improve this answer
2  
However, I have noticed that even my solution does not work because in RDP it does not send the shift key press for hot strings, e.g. if you send * then it will send 8... :( –  Tahir Hassan Nov 16 '12 at 15:23
    
I had to do something like SendInput, {shift}8{shift up} to send * in RDP, but it will send 8 in Windows. SendInput, {shift down}8{shift up} works the other way around. –  user16659 Nov 16 '12 at 17:14
1  
Since answering your above question, I have decided to run my AHK script on the remote server (it is a LOT more reliable). I have changed controller.ahk to close script.ahk so it does not interfere with the server's script. I pasted my solution on my blog: tahirhassan.blogspot.co.uk/2012/11/autohotkey-scripts_19.html –  Tahir Hassan Dec 5 '12 at 13:46
add comment

To make AHK work with Microsoft's Terminal Server client in fullscreen, AHK has to reload after the Remote Desktop window is activated.

SetTimer, waitforrdp, -250
return

:*:ppp::password
:*:ccc::
SendInput, {shift}C{shift up}
SendInput, apitalized
return

waitforrdp:
IfWinActive, ahk_class TscShellContainerClass
{
    WinWaitNotActive, ahk_class TscShellContainerClass,,3600
}
WinWaitActive, ahk_class TscShellContainerClass,,3600
Reload
return
share|improve this answer
add comment

You also need to set "Apply windows key combinations" on the "Local resources" tab of remote desktop connection 'mstsc.exe' to "ON THIS COMPUTER"MSTSC WINDOWS KEY COMBINATIONS

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.