You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AutoHotKey远程会话剪贴板模拟输入换行重复问题求助

Fix AutoHotKey Double Newline Issue in Remote Sessions

Problem Cause

When using Send %Clipboard% to simulate keystrokes in a remote session, Windows-style line breaks (CRLF, represented as `r`n in AutoHotKey) are often interpreted as two separate newline triggers. Both the carriage return (`r) and line feed (`n) characters get translated into Enter presses, resulting in double newlines between lines.

Solutions

Solution 1: Use SendRaw for Literal Text Sending

SendRaw sends the clipboard content exactly as it is, without parsing special characters into commands. This avoids the double newline issue by preserving the original line break structure:

^+1::SendRaw %Clipboard%

Solution 2: Explicitly Replace Line Breaks with Single Enter Commands

If SendRaw doesn't work with your remote session (some environments may still misinterpret raw line breaks), you can replace all line break variants with a single {Enter} command. This ensures only one newline is sent per line break:

^+1::
    ; Replace all line break types with a single Enter command
    processedText := StrReplace(Clipboard, "`r`n", "{Enter}")
    processedText := StrReplace(processedText, "`n", "{Enter}")
    processedText := StrReplace(processedText, "`r", "{Enter}")
    Send % processedText
return

Solution 3: Simplified Single-Line Replacement

For a concise version targeting Windows-style CRLF line breaks directly:

^+1::Send % StrReplace(Clipboard, "`r`n", "{Enter}")

Notes

  • Test which solution works best for your specific remote session environment, as some platforms handle line breaks differently.
  • If working with Unix-style LF-only line breaks, adjust the replacement to target `n instead of `r`n.

内容的提问来源于stack exchange,提问作者Piotr L

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 17:33:12