将文本复制到剪贴板并粘贴到Word中时,Adobe Acrobat中的长段落会导致换行。
为了解决这个问题,我手动将复制的文本粘贴到记事本++ > select all > ctrl+J (join lines) > select all > Copy......然后粘贴到我的Word文档中。
我想使用autohotkey自动执行这条连接线,因为我有大量的文档要处理。我似乎在网上找不到任何直接在autohotkey脚本中处理这个问题的例子。
例如。
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.手动加入记事本++后
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.发布于 2017-04-03 01:24:52
这是可行的:
#Persistent
OnClipboardChange("ClipChanged")
return
ClipChanged() {
If (WinActive("ahk_exe AcroRd32.exe")) {
For e, v in StrSplit(clipboard, "`n", "`r")
x .= v " "
clipboard := trim(x)
}
}发布于 2017-04-02 23:39:16
试试这个:
#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发布于 2020-08-14 21:02:38
考虑到以连字符结尾的行,我添加了功能。
之前:
This occurs in elec-
tricity generation
systems.之后:
This occurs in electricity generation systems.代码:
#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
}
}
returnhttps://stackoverflow.com/questions/43169213
复制相似问题