如何解决在 RDP 中为 AutoHotKey 脚本发送不区分大小写的热键
主要问题
我正在尝试制作一个 ahk 脚本,将剪贴板上的文本正确发送到 RDP 窗口。
看来,如果 RDP 窗口是全屏的,唯一有效的热键是 MButton。否则,当使用键盘键作为热键时,我必须取消最大化 RDP 窗口。
这是可行的,但现在我注意到的主要问题是当 RDP 窗口最大化时使用 Send、SendRaw 或 sendinput 时,它不处理大写字母或特殊字符的 shift 键。
当 RDP 窗口未最大化或者 Send/SendRaw/sendinput 是脚本的一部分而不是热键的一部分时,这可以正常工作。
这是我拥有的脚本,它在 RDP 窗口最大化时不起作用。
MButton::
SendRaw %clipboard%
当它不起作用时我的意思的一个例子
剪贴板包含:
ABCD!@#$
什么 RDP 最大化窗口接收:
abcd1234
有效的脚本
这两个脚本可以工作,但不是我想要的,因为第一个在技术上会在启动时发送剪贴板,第二个在工作目录中创建一个文件,它不像我想要的那么干净。我也想了解为什么它的功能如此。我已经觉得很奇怪 MButton 是唯一一个在 RDP 最大化时会触发的热键。
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,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,Key ; Set Key to Off by default
MButton::
IniWrite,On,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,Key ; Sets Key to Off if the script was closed for any reason
ExitApp ; other than reloading
}
}
解决方法
我建议看看 https://superuser.com/questions/397257/how-to-fix-ahk-to-send-keys-to-rdp-fullscreen 有几个可能有用的选项,从在全屏后重新启动脚本,到更改某些 RDP 设置,再到更改发送密钥的方式。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。