2017-04-02 19 views
0

テキストがクリップボードにコピーされてWordに貼り付けられると、Adobe Acrobatの長い段落が改行されます。オートハットキーを使用してラインを自動的に結合する

これを処理するには、コピーしたテキストをメモ帳に手動で貼り付けてください。++>すべてを選択> Ctrl + J(行を結合)>すべて選択>コピー......を選択し、 。

私は大量の文書が通過するので、自動結合キーを使用してこの結合行を自動化したいと思います。 autohotkeyスクリプト内でこれを直接処理する例はありません。

Ex。

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. 
+0

は、ここに答えを見つけました:https://superuser.com/a/1109920/235752 – JinSnow

答えて

1

++メモ帳に参加した後、これを試してみてください:

#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 

EDIT

するか、この:

#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 
+0

は、私が "AcrobatSDIWindow ahk_class" に "ahk_exe AcroRd32.exe" に切り替え、それが働きました。唯一のことは、クリップボードをコピーするときです。 acrobatのカーソルをTextからPan(Hand)に切り替えます。それがなぜ起こっているのか分かりません。また、コピーしてメモ帳に移動するのが早すぎると(クリップボードプロセスが終了する前に)、結合行は発生しません。私は何が分かるかを見ていきます。ありがとう! – Karun

+0

私の編集した答えをお試しください。 @ ahkcoderのコードも私のために働いています。 [This](https://autohotkey.com/download/)は最新のAHKバージョンです。 – user3419297

1

これは動作します:

#Persistent 
OnClipboardChange("ClipChanged") 
return 

ClipChanged() { 

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

OnClipboardChange関数がないようです。これはデフォルトの機能ですか?たぶん古いAHKを使用している可能性があります – Karun

+0

これはAHKの最新バージョンにあります。 – errorseven

関連する問題