Page 4 of 8

Posted: Sat Jan 15, 2011 11:05 pm
by Infocatcher
KDJ
I think, for remove/extracts lines and reverse order should used buttons.

Posted: Sun Jan 16, 2011 7:07 pm
by KDJ
Infocatcher wrote:I think, for remove/extracts lines and reverse order should used buttons.
I did LinesSort.js, but buttons instead of boxes were not good.

Posted: Mon Jan 17, 2011 3:13 pm
by Instructor
KDJ wrote:Well, actually in Format plugin is not option "case sensitive".
May partially solve the problem ColumnsSort.js script.
It is possible via external call with code 1.

Posted: Mon Jan 17, 2011 6:49 pm
by KDJ
Instructor wrote:It is possible via external call with code 1.
Indeed. Sorry, I had not noticed this before.

Seperator by any character(s) instead of "\r" only

Posted: Tue Jan 18, 2011 5:26 am
by cnnnc
How about make Seperator by any character(s) instead of "\r" only?
Example - Seperator ";" for following:

Code: Select all

*.rar;*.zip;*.ace;*.arc;*.arj;*.jar;*.cab;*.7z;*.lzh;*.tar;*.bz2;*.gz;*.uha;*.sqx;*.kgb;*.dir;*.uue;*.xxe;*.deb;*.gzip;*.uc2;*.sbc;*.pak;*.tgz;*.bgz
Sort by StringAscending, and then I get:

Code: Select all

*.7z;*.ace;*.arc;*.arj;*.bgz;*.bz2;*.cab;*.deb;*.dir;*.gz;*.gzip;*.jar;*.kgb;*.lzh;*.pak;*.rar;*.sbc;*.sqx;*.tar;*.tgz;*.uc2;*.uha;*.uue;*.xxe;*.zip

Re: Seperator by any character(s) instead of "\r"

Posted: Tue Jan 18, 2011 6:37 pm
by KDJ
cnnnc wrote:How about make Seperator by any character(s) instead of "\r" only?
I think you should use Replace.
Main menu -> Edit -> Replace...
What: \n
With: ;
Select Esc-sequences, and then press Replace all.
All line-end characters will be replaced by a semicolon.

Re: Seperator by any character(s) instead of "\r"

Posted: Wed Jan 19, 2011 5:43 am
by cnnnc
KDJ wrote:I think you should use Replace.
...
You get me wrong.
As you mean if I want to sort my string, I have to replace ";" with "\r", and then sort it, finally replace "\r" back to ";".
But my string only in one line, and I just want to get a "aTxt" like this:

Code: Select all

    var pSeperator = ";";
    // ...
    aTxt  = AkelPad.GetSelText(1 /*\r*/).split(pSeperator);
and then sort "aTxt", in this way I can do it easily, not:

Code: Select all

    aTxt  = AkelPad.GetSelText(1 /*\r*/).split("\r");
Your LinesSort.js is Great, but it's only used to deal with the situation of seperator is "\r".

Posted: Wed Jan 19, 2011 7:51 am
by Fr0sT
Quite useful suggestion IMHO

Re: Seperator by any character(s) instead of "\r"

Posted: Wed Jan 19, 2011 6:41 pm
by KDJ
cnnnc wrote:You get me wrong...
LinesSort.js script is designed to sort lines, and not to sort the words contained between any separators.
Therefore, as separator of strings used newline character (\r or \n).
Maybe, on the basis of LinesSort.js, I'll write a script to sort words (eg. WordsSort.js).
Meanwhile, you can deal with, replacing semicolons with end-line characters and vice versa.
Original string:

Code: Select all

*.zip;*.arj;*.7z;*.rar
Replace ";" with "\n":

Code: Select all

*.zip
*.arj
*.7z
*.rar
Sort lines using Format plugin or LinesSort.js script:

Code: Select all

*.7z
*.arj
*.rar
*.zip
Replace "\n" with ";":

Code: Select all

*.7z;*.arj;*.rar;*.zip

Re: Seperator by any character(s) instead of "\r"

Posted: Wed Jan 19, 2011 7:43 pm
by KDJ
Well, the script is almost ready.
Sorting strings contained between the semicolons:

Code: Select all

AkelPad.ReplaceSel(AkelPad.GetSelText().replace(/;/g, "\r"), 1);
AkelPad.Call("Format::LineSortStrAsc");
AkelPad.ReplaceSel(AkelPad.GetSelText().replace(/\r/g, ";"), 1);

Posted: Thu Jan 20, 2011 12:46 pm
by Fr0sT
cnnnc
you can easily modify the script yourself, just add separator as parameter or do the query for it in the beginning of the script

Posted: Fri Jan 21, 2011 12:09 am
by cnnnc
KDJ
It's work. Thank you.

Posted: Thu Jan 27, 2011 6:59 pm
by KDJ
cnnnc
I wrote ListSort.js script that sorts lists separated with any separator, in each line, by using Format plugin.

Posted: Fri Jan 28, 2011 3:05 am
by cnnnc
KDJ
I test it. It works very well if I needn't to undo/redo. Its undo/redo is not convenient, because they are a new operation, not just like Akelpad as.
After all it has been quite good. Thank you.

Posted: Sat Jan 29, 2011 10:12 pm
by KDJ
cnnnc
In ListSort.js I changed the action of Undo/Redo. Now it is compatible with AkelPad.