0
votes

Main Problem

I am trying to make an ahk script that sends the text on the clipboard to an RDP window properly.

It appears that if the RDP window is full screen the only hotkey that works is the MButton. Otherwise I have to un-maximize the RDP window when using keyboard keys as the hotkey.

This works, but now the main problem I notice is that when using Send, SendRaw, or SendInput to the the RDP window while it is maximized, it does not handle the shift key for capital letters or special characters.

This works fine when the RDP window is not maxed or if the Send/SendRaw/SendInput are part of the script and not part of the hotkey.

This is the script I have and it does not work while the RDP window is maximized.

MButton::

SendRaw %clipboard%

An example of what I mean when it does not work

Clipboard contains:

ABCD!@#$

What RDP maximized window receives:

abcd1234

Scripts that work

These two scripts work but are not what I am looking for as the first one technically will send the clipboard on startup and the second one creates a file in the working directory, which isnt as clean as I would like. As well I would like to understand why this functions the way it does. I already find it strange that the MButton is the only hotkey that will trigger when RDP is maximized.

SendRaw %clipboard%


MButton::
Reload
#SingleInstance
#InstallKeybdHook
#UseHook On
OnExit("WriteOff")

IfNotExist, %A_WorkingDir%\Switch
    IniWrite, Off, Switch, Section, Key     ; Check if Switch.ini exists. If not, create it and set it to off

IniRead, Var, Switch, Section, Key          ; Reads Switch.ini to pull the value of 
if (Var = "On") {                   ; Check if Key inside Switch.ini is set to On. 
    SendRaw %clipboard%             ; If it is, send the clipboard
    Return
}

IniWrite, Off, Switch, Section, Key         ; Set Key to Off by default

MButton::           
    IniWrite, On, Switch, Section, Key      ; When the middle mouse button is pressed, set Key to On
    Reload                      ; and reload the script
Return

WriteOff(ExitReason, ExitCode)              ; This function serves to set Key to Off to prevent your clipboard
{                           ; from being sent upon opening the script.
    if ExitReason in Reload             
    {                       ; Checks if the script was reloaded.
        Return                  ; If it was, do nothing. This prevents Key from being
    }                       ; set to Off by reloading the script.
    else 
    {
        IniWrite, Off, Switch, Section, Key ; Sets Key to Off if the script was closed for any reason 
        ExitApp                 ; other than reloading
    }
}
1
A lot of AHK stuff tends to break when using RDP. If you cant get an answer here, try asking on SuperUser or the AHK forumsSpyre
Thanks. I ended up with a solution through the forums. Appreciate the heads up. The post is here with what worked for me. autohotkey.com/boards/…Toejam08

1 Answers

0
votes

I suggest taking a look at https://superuser.com/questions/397257/how-to-fix-ahk-to-send-keys-to-rdp-fullscreen There are several options that may work, from restarting your script after you go full screen, to changing some RDP settings, to changing the way you send keys.