ST2 について私が読んだことから (気づかせてくれてありがとう)、^+d は選択されたテキストをコピーするか、何も選択されていない場合は行全体をコピーするということです。
これは機能しますか?
TempCB = %ClipBoard% ; Park clipboard (text) content, Other content (format, images, etc.) will be lost.
ClipBoard = ; Clear clipboard
Send, ^c ; Grab selected text
Sleep, 100 ; Wait 0.1 seconds for clipboard (clipboard will not get filled if nothing is selected)
if (Clipboard = "") ; Nothing selected, thus copy whole line
{
Send, {Home}+{End}^c ; Select line and copy to clipbard
}
MoveBack := StrLen(ClipBoard)
MoveFwd := MoveBack
MoveBack++ ; Move one step back further back due to earlier step {right}
Send, {Right}{Left}^v{Right}{left %Moveback%}+{Right %MoveFwd%} ; Go to end of selected text (in MS notepad this is will jump over the first next char., thus a jump back as well), add a space and paste.
ClipBoard = %TempCB% ; Restore (text part) of previous clipboard content.
Return
これを MS のメモ帳でテストしましたが、他のエディターでは動作が異なる場合があります (特に、選択したテキストの末尾に向かってジャンプする場合)。スクリプトは、選択したテキストをコピーして貼り付け、新しく貼り付けたテキストを強調表示します。