Page 1 of 1

Toggle File Colors ?

Posted: 15 Apr 2017 02:56
by CookieMonster
How can I toggle files between two different colors ? As well how do you colorize shared network folders for a networked computer ?

Re: Toggle File Colors ?

Posted: 15 Apr 2017 08:33
by highend
How can I toggle files between two different colors ?
Which colors, labels / color (or instant color) filters?
As well how do you colorize shared network folders for a networked computer ?
E.g. for a color filter:

Code: Select all

dir:\\<your netbios server name>\folder\*somefolder
Note the "*" in this definition! Without it "*" would be added automatically and then
all subfolders beyond somefolder would be colored as well^^

Re: Toggle File Colors ?

Posted: 16 Apr 2017 06:52
by CookieMonster
Which colors, labels / color (or instant color) filters?
Instant Color Filters. The goal is simple toggle selected files with two different colors, quickly.

Code: Select all

dir:\\<your netbios server name>\folder\*somefolder

Code: Select all

dir:\\<NetworkDriveName>\<sharedFolder>* 
?

Re: Toggle File Colors ?

Posted: 16 Apr 2017 10:42
by highend
I wouldn't do that with instant colorfilters, at least not for selected items (they are not bound to a specific folder / item type)

A version that uses labels:

Code: Select all

    $label1 = 1; // Red
    $label2 = 4; // Green

    $label1List = "";
    $items = get("SelectedItemsPathNames", "|");
    $tags = tagitems(, , , 1);
    while ($i++ < gettoken($items, "count", "|")) {
        if (gettoken($tags, $i, "|") == $label1) { $label1List = $label1List . gettoken($items, $i, "|") . "|"; }
    }
    if ($label1List) { tagitems(, $label2, $label1List); }
    $label2List = formatlist($items, "F", , "!$label1List");
    if ($label2List) { tagitems(, $label1, $label2List); }
Why does that look so complicated? Because it's much faster to use tagitems on a bunch of files only once instead
for each and every single file...

Re: Toggle File Colors ?

Posted: 17 Apr 2017 05:54
by CookieMonster
The above code works on single files as well ?

I placed the code in a button that is to be executed by the right mouse; nothing happens ?

Re: Toggle File Colors ?

Posted: 17 Apr 2017 08:25
by highend
The above code works on single files as well ?
Ofc

Re: Toggle File Colors ?

Posted: 17 Apr 2017 15:25
by CookieMonster
I created a button in the toolbar which should work when right clicking on a file, as the script was placed within the OnRightClick for the button; instead windows default context menu appears ?

Re: Toggle File Colors ?

Posted: 17 Apr 2017 15:29
by highend
A button's script should be fired when you click on a file in the list pane?
You have to right-click the button to fire the script^^

Re: Toggle File Colors ?

Posted: 17 Apr 2017 15:58
by CookieMonster
A button's script should be fired when you click on a file in the list pane?
You have to right-click the button to fire the script^^
I was able to label the file color to red; although I wasn't able to toggle between red, green and off when right clicking on the button to launch the script per file ?

Re: Toggle File Colors ?

Posted: 17 Apr 2017 16:21
by highend
and off
That was never a requirement^^
How can I toggle files between two different colors ?

Code: Select all

    $label1 = 1; // Red
    $label2 = 4; // Green

    $labels = ""; $labels1 = ""; $labels2 = "";
    $items = get("SelectedItemsPathNames", "|");
    $tags = tagitems(, , , 1);
    while ($i++ < gettoken($items, "count", "|")) {
        switch (gettoken($tags, $i, "|")) {
            case $label1:
                $labels1 = $labels1 . gettoken($items, $i, "|") . "|"; break;
            case $label2:
                $labels2 = $labels2 . gettoken($items, $i, "|") . "|"; break;
            case default:
                $labels = $labels . gettoken($items, $i, "|") . "|";
        }
    }
    if ($labels)  { tagitems(, $label1, $labels); }
    if ($labels1) { tagitems(, $label2, $labels1); }
    if ($labels2) { tagitems(, "", $labels2); }

Re: Toggle File Colors ?

Posted: 17 Apr 2017 22:42
by CookieMonster
Works Perfectly, thanks :)