首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用自动热键自动连接线条

使用自动热键自动连接线条
EN

Stack Overflow用户
提问于 2017-04-02 22:00:47
回答 3查看 416关注 0票数 0

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

为了解决这个问题,我手动将复制的文本粘贴到记事本++ > select all > ctrl+J (join lines) > select all > Copy......然后粘贴到我的Word文档中。

我想使用autohotkey自动执行这条连接线,因为我有大量的文档要处理。我似乎在网上找不到任何直接在autohotkey脚本中处理这个问题的例子。

例如。

代码语言:javascript
运行
复制
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.

手动加入记事本++后

代码语言:javascript
运行
复制
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.
EN

回答 3

Stack Overflow用户

发布于 2017-04-03 01:24:52

这是可行的:

代码语言:javascript
运行
复制
#Persistent
OnClipboardChange("ClipChanged")
return

ClipChanged() {

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

Stack Overflow用户

发布于 2017-04-02 23:39:16

试试这个:

代码语言:javascript
运行
复制
#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

编辑

或者这样:

代码语言:javascript
运行
复制
#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
票数 1
EN

Stack Overflow用户

发布于 2020-08-14 21:02:38

考虑到以连字符结尾的行,我添加了功能。

之前:

代码语言:javascript
运行
复制
This occurs in elec-
tricity generation
systems.

之后:

代码语言:javascript
运行
复制
This occurs in electricity generation systems.

代码:

代码语言:javascript
运行
复制
#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 with hyphen
    clip := RegExReplace(clip, "(\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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43169213

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档