2014年11月12日 5:38 pm #20960
Yutaka Emura
Keymaster
ent 様
いつも EmEditor Professional をお使いいただき、誠にありがとうございます。
ご要望については検討させていただきます。
ところで、カーソル位置にある列を選択して、その列を長さによってソートして新規文書を作成するマクロを作成しましたので、もしよろしければお使いください。
if( !editor.EnableTab ) {
alert( "Please enable tabs" );
Quit();
}
editor.ExecuteCommandByID(4461); // select column
s = document.selection.Text
s = s.split("\n").sort(function(a,b) { return a.length - b.length; }).join('\n');
editor.NewFile();
document.selection.Text = s;
また、各列の最小、最大桁数をカウントしてアウトプット バーに表示するマクロも作成したので、もしよろしければ使ってください。
OutputBar.Clear();
OutputBar.Visible = true;
OutputBar.writeln( "Column Min Max" );
document.selection.SetActivePoint( eePosLogical, 1, 1, false );
x = -1;
col = 1;
while( x != document.selection.GetActivePointX( eePosLogical ) ) {
x = document.selection.GetActivePointX( eePosLogical )
nOldHeadingLines = document.HeadingLines;
document.HeadingLines = 0;
editor.ExecuteCommandByID(4461); // select column
document.HeadingLines = nOldHeadingLines;
s = document.selection.Text
a = s.split("\r\n");
a.pop(); // last element is always empty
sTitle = "";
if( a.length > 0 ) {
sTitle = a[0];
}
min = -1;
max = 0;
for( i = nOldHeadingLines; i < a.length; i++ ) {
if( min == -1 || min > a[i].length ) {
min = a[i].length;
}
if( max < a[i].length ) {
max = a[i].length;
}
}
//OutputBar.writeln( "Column " + col + " - min: " + min + ", max: " + max );
OutputBar.writeln( sTitle + " " + min + " " + max );
xView = document.selection.GetActivePointX( eePosView );
if( xView >= 0x08000000 ) { // last column
break;
}
document.selection.SetActivePoint( eePosView, xView, 1, false );
col++;
}
OutputBar.SetFocus();
どちらも JavaScript です。よろしくお願い申し上げます。