Autohotkey 使用自动热键自动连接线

Autohotkey 使用自动热键自动连接线,autohotkey,Autohotkey,当文本复制到剪贴板并粘贴到Word中时,Adobe Acrobat中的长段落会导致换行 为了解决这个问题,我手动将复制的文本粘贴到记事本+++>全选>ctrl+J(连接行)>全选>复制。。。。。。然后将其粘贴到我的Word文档中 我想使用自动热键自动执行此连接行,因为我有大量文档要处理。在自动热键脚本中,我似乎找不到任何直接处理此问题的在线示例 前 手动加入记事本++后 Data structures with labeled axes supporting automatic or expli

当文本复制到剪贴板并粘贴到Word中时,Adobe Acrobat中的长段落会导致换行

为了解决这个问题,我手动将复制的文本粘贴到记事本+++>全选>ctrl+J(连接行)>全选>复制。。。。。。然后将其粘贴到我的Word文档中

我想使用自动热键自动执行此连接行,因为我有大量文档要处理。在自动热键脚本中,我似乎找不到任何直接处理此问题的在线示例

手动加入记事本++后

Data structures with labeled axes supporting automatic or explicit data alignment. This prevents common errors resulting from misaligned data and working with differently-indexed data coming from different sources.
试试这个:

#Persistent
return

    OnClipboardChange:
If WinActive("ahk_exe AcroRd32.exe")
{
    clipboard =
    Send, {Ctrl down}c{Ctrl up}{Esc}
        ClipWait
    clip := RegExReplace(clipboard, "(\S.*?)\R(.*?\S)", "$1 $2") ; strip line breaks and replace them with spaces
    clipboard = %clip%  
    StringReplace clipboard, clipboard, % "  ", % " ", A         ; replace double spaces with single spaces 
        ClipWait
    ControlClick, x0 y0, A
}
return
编辑

或者这个:

#Persistent
return

    OnClipboardChange:
If WinActive("ahk_class AcrobatSDIWindow")
{
    clipboard := ""
    Send, {Ctrl down}c{Ctrl up}{Esc}
        ClipWait
    clip := RegExReplace(clipboard, "(\S.*?)\R(.*?\S)", "$1 $2") ; strip line breaks and replace them with spaces
    StringReplace clip, clip, % "  ", % " ", A         ; replace double spaces with single spaces 
    clipboard := "" 
    clipboard = %clip% 
    ClipWait 2
    If !(ErrorLevel)
    {
        ToolTip, lines joined
        Sleep 500
        ToolTip
    }
}
return
试试这个:

#Persistent
return

    OnClipboardChange:
If WinActive("ahk_exe AcroRd32.exe")
{
    clipboard =
    Send, {Ctrl down}c{Ctrl up}{Esc}
        ClipWait
    clip := RegExReplace(clipboard, "(\S.*?)\R(.*?\S)", "$1 $2") ; strip line breaks and replace them with spaces
    clipboard = %clip%  
    StringReplace clipboard, clipboard, % "  ", % " ", A         ; replace double spaces with single spaces 
        ClipWait
    ControlClick, x0 y0, A
}
return
编辑

或者这个:

#Persistent
return

    OnClipboardChange:
If WinActive("ahk_class AcrobatSDIWindow")
{
    clipboard := ""
    Send, {Ctrl down}c{Ctrl up}{Esc}
        ClipWait
    clip := RegExReplace(clipboard, "(\S.*?)\R(.*?\S)", "$1 $2") ; strip line breaks and replace them with spaces
    StringReplace clip, clip, % "  ", % " ", A         ; replace double spaces with single spaces 
    clipboard := "" 
    clipboard = %clip% 
    ClipWait 2
    If !(ErrorLevel)
    {
        ToolTip, lines joined
        Sleep 500
        ToolTip
    }
}
return
这项工作:

#Persistent
OnClipboardChange("ClipChanged")
return

ClipChanged() {

    If (WinActive("ahk_exe AcroRd32.exe")) {
        For e, v in StrSplit(clipboard, "`n", "`r")
            x .= v " "
        clipboard := trim(x)
    }
}
这项工作:

#Persistent
OnClipboardChange("ClipChanged")
return

ClipChanged() {

    If (WinActive("ahk_exe AcroRd32.exe")) {
        For e, v in StrSplit(clipboard, "`n", "`r")
            x .= v " "
        clipboard := trim(x)
    }
}

我添加了以连字符结尾的行的功能

之前:

This occurs in elec-
tricity generation
systems.
之后:

This occurs in electricity generation systems.
代码:


我添加了以连字符结尾的行的功能

之前:

This occurs in elec-
tricity generation
systems.
之后:

This occurs in electricity generation systems.
代码:


我将“ahk_exe AcroRd32.exe”切换为“ahk_class AcrobatSDIWindow”,它成功了。唯一的问题是当我复制剪贴板时。它将acrobat的光标从文本切换到平移(手动)。不知道为什么会这样。此外,如果复制并移动到记事本的速度过快(在剪贴板进程完成之前),则不会出现连接行。我看看我能想出什么办法。谢谢试试我编辑过的答案@ahkcoder的代码也适用于我。是最新的AHK版本。我将“AHK_exe AcroRd32.exe”切换为“AHK_class AcrobatSDIWindow”,它成功了。唯一的问题是当我复制剪贴板时。它将acrobat的光标从文本切换到平移(手动)。不知道为什么会这样。此外,如果复制并移动到记事本的速度过快(在剪贴板进程完成之前),则不会出现连接行。我看看我能想出什么办法。谢谢试试我编辑过的答案@ahkcoder的代码也适用于我。是最新的AHK版本。它似乎缺少OnClipboardChange函数。这是默认函数吗。也许我在使用最新版本的AHK中的过时AHKIt,几个早期版本。它看起来缺少OnClipboardChange功能。这是默认函数吗。可能我在使用AHK最新版本中的过时AHKIt,几个早期版本。在此处找到答案:在此处找到答案: