How to fix AHK to send keys to RDP fullscreen?

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


Solution 1:

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

Solution 2:

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