AutoHotKey将剪贴板转换为键盘输入用于VNC
看到有人求助 VNC 中无法粘贴.
在 google 上搜索了一下, 找到一个这样的结果
https://ardalis.com/use-autohotkey-to-paste-text-as-typing/
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.; #Warn ; Enable warnings to assist with detecting common errors.SendMode Event ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.setkeydelay 70^+v::GoTo, CMDCMD:;Send {Raw}%Clipboard%vText := ClipboardClipboard := vTextLoop Parse, vText, % "`n", % "`r"{Send, % "{Text}" A_LoopFieldSend, % "+{Enter}"}return
试用了一下, 效果不对.
但是 AutoHotKey 这个思路是对的.
所以让GPT写了一个.
#F3::; 快速键 win + f3TextToSend := Clipboard; 检查剪贴板是否为空if (TextToSend = "") {MsgBox, clipboard emptyReturn}DelayMs := 500 ; 设置您想要的延迟时间(毫秒); 调用自定义函数发送文本SendTextWithDelay(TextToSend, DelayMs)MsgBox, input finishedReturn; ------------------------------------------------; 自定义函数:使用 SendInput 逐字符发送,并加入 Sleep 延迟; ------------------------------------------------SendTextWithDelay(Text, Delay){; 在发送字符之前 先延迟1秒Sleep, 1000; 循环遍历文本中的每个字符Loop, Parse, Text{; A_LoopField 包含当前循环中的单个字符SendInput, %A_LoopField%; 强制等待指定的毫秒数Sleep, %Delay%}}
使用效果演示
最后, 如果你也希望帮助翻墙新手, 欢迎关注这个关键字通知频道!
评论
发表评论