list sorted by name plus "show grid"

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
glusberg
Posts: 115
Joined: 04 Dec 2010 17:47

list sorted by name plus "show grid"

Post by glusberg »

When looking at a list, sorted by name, and "show grid" turned on, the color background changes whenever the first word changes. Could I change it to two words (i.e.: first-name Last-name)?
I suspect this is possible, but am unable to come up with keywords that would lead me to the answers (or to ask the question correctly, i guess).
Thanks!

highend
Posts: 13276
Joined: 06 Feb 2011 00:33

Re: list sorted by name plus "show grid"

Post by highend »

No clue what you mean...

Maybe: Configuration | Colors and Styles | Styles | Grid style
Zebra Stripes: Alternate Rows (2)?
One of my scripts helped you out? Please donate via Paypal

glusberg
Posts: 115
Joined: 04 Dec 2010 17:47

Re: list sorted by name plus "show grid"

Post by glusberg »

( i was afraid i wasn't able to be clear, sorry)
I do want the zebra stripes. Right now, the zebra changes when the first word on the filename changes (grouping all files that start with Chris, and changing when the first word changes to Chrissie). What I would like is for the first two words to be considered. So that there would be a break (zebra change?) between "Chris Womersley" and "Chris Wooding".
Makes more sense now? I'm not sure it does...

highend
Posts: 13276
Joined: 06 Feb 2011 00:33

Re: list sorted by name plus "show grid"

Post by highend »

I guess that's not possible. The "Smart Names" entries for "Grid Style" do not seem to
differentiate between more than the first word...

You could try to create a script that does set color filters to do this kind of logic...
One of my scripts helped you out? Please donate via Paypal

glusberg
Posts: 115
Joined: 04 Dec 2010 17:47

Re: list sorted by name plus "show grid"

Post by glusberg »

Nah. But thank you for trying.

highend
Posts: 13276
Joined: 06 Feb 2011 00:33

Re: list sorted by name plus "show grid"

Post by highend »

Just as an experiment:

Code: Select all

    $highlightedColor    = "000000,EDF3FE";
    $nonHighlightedColor = "000000,FFFFFF";

    $items = listpane(, , , <crlf>);
    $filter = ""; $color = $highlightedColor; $lastFirstTwoWords = "";
    while ($i++ < gettoken($items, "count", <crlf>)) {
        $item = gettoken($items, $i, <crlf>);
        $base = gpc($item, "base");
        // Get the first two words of a (base) item name
        $firstTwoWords = regexmatches($base, "^\w+( \w+)?");
        // Toggle colors if the next following item is different
        if ($firstTwoWords != $lastFirstTwoWords) {
            if ($color == $highlightedColor) { $color = $nonHighlightedColor; }
            else { $color = $highlightedColor; }
        }
        // Add to the filter
        $filter = $filter . "$item>$color||";
        $lastFirstTwoWords = $firstTwoWords;
    }
    $filter = trim($filter, "|", "R");
    colorfilter($filter);
Be careful, it will crash XY if the $filter get's too long (too many items) :mrgreen:

Will probably file a bug report for that...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: list sorted by name plus "show grid"

Post by admin »

How many items crashed it?

highend
Posts: 13276
Joined: 06 Feb 2011 00:33

Re: list sorted by name plus "show grid"

Post by highend »

It seems it's (currently, not tested any limits further) not about the number of files
but it crashes on a specific file name...

Create an empty directory, put this file into it:

Code: Select all

[UTF-8].txt
Run the script. It crashes XY (even with the current beta in a fresh instance).

Just remove the 8 from the file name. No crash
Add the 8 again and remove the brackets. No crash
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: list sorted by name plus "show grid"

Post by admin »

That's exactly what I fixed in v18.50.0209. Don't tell me it crashes. It does not crash here.

highend
Posts: 13276
Joined: 06 Feb 2011 00:33

Re: list sorted by name plus "show grid"

Post by highend »

No crash in 209.

But there is another problem...

Create a folder named:

Code: Select all

Dokumente [1]
Put some test files in it

Run the script

The colorfilter won't get applied. It doesn't like the "[1]"
in the folder name.

With the same files in a folder named "Dokumente 1"
it works flawlessly
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: list sorted by name plus "show grid"

Post by admin »

Good thinking (which I assume was behind constructing this evil example :biggrin: )! Next version fixes that.

Post Reply