ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

sorting units of text

<< < (4/7) > >>

skwire:
- the script seemed to work perfectly, except for the very first item. the very first item always stayed on top (like this: dfbaacbc -> daabbccf).-me_7834539 (July 02, 2012, 07:59 AM)
--- End quote ---

That's odd as I didn't experience this in my, albeit minimal, testing.  Can you PM me a short sample text file that this happens with?

- I have not yet thoroughly tested the script, but so far it seems to work very nicely. I did a test if any characters (or tabstops) are lost (German keyboard, all keys incl. using modifiers shift and alt-gr), but everything seemed fine.-me_7834539 (July 02, 2012, 07:59 AM)
--- End quote ---

If you run into situations where this occurs, you will probably have to switch to AutoHotkey_L which handles Unicode.

oh... and would it be difficult to add to the script that blank lines be removed after the sorting?  :-[ :Thmbsup:
-me_7834539 (July 02, 2012, 08:32 AM)
--- End quote ---

Sure, can do. Did you mean ALL blank lines, e.g.,:

cat1    Here is some cat1 text.
        Here is some continued cat1 text.
cat2    Here is some cat2 text.
        Here is some continued cat2 text.
        Here is some more continued cat2 text.
        Here is even more continued cat2 text.
cat3    Here is some cat3 text.
        Here is some continued cat3 text.

me_7834539:
hello jody,

what do you mean by "all" blank lines? only one "type" of blank lines would have been possible in the text example you gave, which are blank lines that separate each item from another.

different "types" of blank lines are, afaics, only thinkable if there are several items of the same category involved (which typically is the case, of course). if this is what you meant, here's an example:

this is original, non-transformed text:

(note: the line numbering is not part of the text, obviously)

--- Code: Text ---cat1    Here is some cat1 text.        Here is some continued cat1 text. cat3    Here is some cat3 text.        Here is some continued cat3 text. cat2    Here is some cat2 text.        Here is some continued cat2 text.        Here is some more continued cat2 text. cat2    Here is ANOTHER cat2 item.
this is what your original script currently does:


--- Code: Text ---cat1    Here is some cat1 text.        Here is some continued cat1 text. cat2    Here is ANOTHER cat2 item. cat2    Here is some cat2 text.        Here is some continued cat2 text.        Here is some more continued cat2 text. cat3    Here is some cat3 text.        Here is some continued cat3 text.
here is what I meant by removing blank lines:


--- Code: Text ---cat1    Here is some cat1 text.        Here is some continued cat1 text.cat2    Here is ANOTHER cat2 item.cat2    Here is some cat2 text.        Here is some continued cat2 text.        Here is some more continued cat2 text.cat3    Here is some cat3 text.        Here is some continued cat3 text.
here is what is it would look like if it differentiated between blank lines that sperated items, versus seperating blocks of same-category-items. I suppose this would be a bit difficult to code and is not really necessary, though it would be neat, of course.


--- Code: Text ---cat1    Here is some cat1 text.        Here is some continued cat1 text. cat2    Here is ANOTHER cat2 item.cat2    Here is some cat2 text.        Here is some continued cat2 text.        Here is some more continued cat2 text. cat3    Here is some cat3 text.        Here is some continued cat3 text.
(side rematk: I am now outing myself as a total idiot, I just noticed that the script temporarily replaces blank lines by §, I am curious as to why this does not break text that originally contains §.)

and here is an example of text where your script will not sort the first item:


--- Code: Text ---qqq     this is a test line (q) aaa     this is a test line (a) ccc     this is a test line (c1) bbb     this is a test line (b) ccc     this is a test line (c2)  ------------------------------- here's the faulty result: qqq     this is a test line (q) aaa     this is a test line (a) bbb     this is a test line (b) ccc     this is a test line (c1) ccc     this is a test line (c2)
thanks for your efforts!!

matthias

skwire:
here is what I meant by removing blank lines:


--- Code: Text ---cat1    Here is some cat1 text.        Here is some continued cat1 text.cat2    Here is ANOTHER cat2 item.cat2    Here is some cat2 text.        Here is some continued cat2 text.        Here is some more continued cat2 text.cat3    Here is some cat3 text.        Here is some continued cat3 text.-me_7834539 (July 02, 2012, 09:37 AM)
--- End quote ---

Yep, I was just making sure you wanted it this way.

(side rematk: I am now outing myself as a total idiot, I just noticed that the script temporarily replaces blank lines by §, I am curious as to why this does not break text that originally contains §.)-me_7834539 (July 02, 2012, 09:37 AM)
--- End quote ---

If that character is in the original text, it should break the script.  I chose that character since it's rarely used.  However, if you do happen to use it on a regular basis, we can change it to some other, rarely-used character.

and here is an example of text where your script will not sort the first item:-me_7834539 (July 02, 2012, 09:37 AM)
--- End quote ---

That's very strange as it sorts fine for me.   :huh:  You could try changing the sorting line in the script this:

    Sort, myText, CL D§

thanks for your efforts!!-me_7834539 (July 02, 2012, 09:37 AM)
--- End quote ---

You're welcome.  Thanks very much for the donation.   :D

me_7834539:
hello, the script's behavior is all a bit too voodoo to me... hmm. first of all:

this:
qqq   testtest

ppp   testtest

will sort correctly for you? that's really strange. I am using windows notepad and win-i as a shortcut; win 7 32bit (German). autohotkey recently installed.

(side remark, I suppose the capital D in your suggestion is of no importance, I seem to get identical results). so, adding CL yields lots of errors:

qqq   test1a

qqq   test1b

aaa   test2

ppp   test3

....is turned into......:

§aaa   test2

ppp   test3

qqq   test1bÂqqq   test1a

however, note that aaa is now the first item.

what is strange, too: text is NOT broken when it contains "§". (I tested this in your original script, not in the one with CL added).

me_7834539:
btw, I am wondering if donation coder is the right forum for discussing AHK... seems like the ahk forums might solve the problem faster at this point... just an idea though.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version