EmEditorのマクロ機能で、選択範囲に改行タグを入れるマクロをVBSで書いてみました。上から選択しても下から選択しても動くように、カレントポジジョンを見て判定。
うーん、「選択範囲」をどう捉えるかちょっと悩みつつ、ひとまず自分が使いやすいように。
Dim intXB '選択範囲の最終行のX
Dim intYC '現在位置のY
Dim intYA '選択範囲の開始行
Dim intYB '選択範囲の最終行
Dim i
intYC = document.selection.GetActivePointY( eePosLogical )
intXB = document.selection.GetBottomPointX( eePosLogical )
intYA = document.selection.GetAnchorPointY( eePosLogical )
intYB = document.selection.GetBottomPointY( eePosLogical )
If intXB = 1 Then
intYB = intYB -1
If intYC > 1 Then intYC = intYC - 1
End If
If intYC <> intYB Then
For i = intYC To intYB
document.selection.StartOfLine False,eeLineLogical
document.selection.EndOfLine False,eeLineLogical
document.selection.Text="<br />"
document.selection.LineDown
Next
Else
For i= intYA to intYB
document.selection.StartOfLine False,eeLineLogical
document.selection.EndOfLine False,eeLineLogical
document.selection.Text="<br />"
document.selection.LineDown
Next
End If
0 件のコメント:
コメントを投稿