Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- February 26, 2012 at 4:44 pm #10085userParticipant
hello
in Emeditor, there is a feature to sort lines alphabetically or arithmetically, but how can I sort lines according to their length?
thanks!
February 27, 2012 at 4:25 am #10087zhouzh2ParticipantHi user,
I wrote this macro for you:document.selection.EndOfDocument(false);
endOfDocu = document.selection.GetActivePointY( eePosView );
document.selection.StartOfDocument(false);
document.selection.EndOfLine(false,eeLineView);
currentCursor = document.selection.GetActivePointY( eePosView );
while ( endOfDocu != currentCursor ) {
currentCursor = document.selection.GetActivePointY( eePosView );
numberOfChar = document.selection.GetActivePointX( eePosLogical ) - 1;
document.selection.StartOfLine(false,eeLineView | eeLineHomeText);
document.selection.Text=numberOfChar + ": ";
document.selection.LineDown(false,1);
document.selection.EndOfLine(false,eeLineView);
}
This macro will add numbers which indicate the number of characters of the line to the start of lines.
After that,you can use the “sort” of emeditor.
Than replace “^d+?:s” with NULL to restore orginial line.
Hope it helps. :-)Cheers,
angus. - AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.