#10825

Yutaka Emura
Keymaster

Hello,

This macro should sort the selected text from long to short.

document.selection.text = ((document.selection.text.split("n")).sort(function(a,b){return b.length-a.length})).join('n');

If you want to sort lines from short to long, please use this:

document.selection.text = ((document.selection.text.split("n")).sort(function(a,b){return a.length-b.length})).join('n');

Please select the whole document (CTRL + A) before you run this macro if you want to sort the entire document.

Thanks!