Option for Live Filter Box instead of Type Ahead Find

Features wanted...
Post Reply
admin
Site Admin
Posts: 49995
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Option for Live Filter Box instead of Type Ahead Find

Post by admin »

You could use the new "icon lists" feature (will release 17.90 today) to create a 10 star system (and design your own stars). But I could also extend the current system to 10 stars. Unfortunately there does not seem to be a Unicode character for half-star. But there might be other symbols/solutions.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

photoman
Posts: 33
Joined: 29 Jan 2017 14:36

Re: Option for Live Filter Box instead of Type Ahead Find

Post by photoman »

admin wrote:You could use the new "icon lists" feature (will release 17.90 today) to create a 10 star system (and design your own stars). But I could also extend the current system to 10 stars. Unfortunately there does not seem to be a Unicode character for half-star. But there might be other symbols/solutions.
I don't know much about the "icon lists" feature. I'll look into it. I like the tagging system you have in place for custom fields and ratings because they're stored in a text file. Easy to batch import, export, and manipulate. Also peace of mind that the data will always be accessible and all that work of rating things won't one day be gone because of a new file format. (which has happened to me 2 times already with mp3 player software.)

A ten level rating system would be a great idea. Either using 1/2 stars or 10 full stars. I think it would be good for my photograph catalog rating system too. I have always thought 5 stars just isn't enough to rate things properly. (Maybe it's just me, i'm a very detailed oriented person.) If you want to rate music, movies, or pictures, it seems very lacking to only have 5 different levels. Because 5 means "excellent" or "perfect", so you aren't going to use 5 very often. 3 means average, but if someone told you the movie they just saw was 3 stars, your reaction wouldn't really be positive. You wouldn't necessarily go see the movie. So, 4 makes sense. It's something that is good or very good, and something that you like and have positive feelings about. You'll use this for the things you like.
2 means bad, and 1 means really really bad. Nobody likes anything that is rated a 2 or less.
So for me a 5 star system is kind of close to a yes/no like/dislike system. 4=like, 2,1=dislike, 5 is for the right edge of the bell curve and is used only 5% of the time. It's hard to show levels of how much you like something with only 5 stars.

I just did a quick check of unicode and you're right, there is no half star that I can find.
Just thinking of a quick solution now, I guess using the empty star as a half might be easy to understand. Looks pretty clean to my eyes.

β˜†
β˜…
β˜…β˜†
β˜…β˜…
β˜…β˜…β˜†
β˜…β˜…β˜…
β˜…β˜…β˜…β˜†
β˜…β˜…β˜…β˜…
β˜…β˜…β˜…β˜…β˜†
β˜…β˜…β˜…β˜…β˜…

admin
Site Admin
Posts: 49995
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Option for Live Filter Box instead of Type Ahead Find

Post by admin »

photoman wrote:Also peace of mind that the data will always be accessible and all that work of rating things won't one day be gone because of a new file format. (which has happened to me 2 times already with mp3 player software.)
Exactly why I did it that way.
photoman wrote:Just thinking of a quick solution now, I guess using the empty star as a half might be easy to understand. Looks pretty clean to my eyes.

β˜†
β˜…
β˜…β˜†
β˜…β˜…
β˜…β˜…β˜†
β˜…β˜…β˜…
β˜…β˜…β˜…β˜†
β˜…β˜…β˜…β˜…
β˜…β˜…β˜…β˜…β˜†
β˜…β˜…β˜…β˜…β˜…
Yep, looks good to me, too.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

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

Re: Option for Live Filter Box instead of Type Ahead Find

Post by highend »

You need to show the extra1 column in your list
Save the script in UTF-8 with BOM

Clicking outside the popupmenu -> nothing will happen
Clicking the first empty entry -> Tag will be nulled (no stars)
Happy tagging^^

Code: Select all

    $empty = chr(13);
    $rating = <<<>>>
        $empty
        β˜†
        β˜…
        β˜…β˜†
        β˜…β˜…
        β˜…β˜…β˜†
        β˜…β˜…β˜…
        β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…
        β˜…β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…β˜…
>>>;
    $rating = regexreplace($rating, "^[ ]*");
    $index  = popupmenu($rating, , , , , 1, <crlf>, 0);
    if ($index == 0) { end true; }
    elseif ($index == 1) { $match = ""; }
    else { $match = gettoken($rating, $index, <crlf>); }
    tagitems(1, $match);
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

nerdweed
Posts: 593
Joined: 25 Feb 2012 07:47

Re: Option for Live Filter Box instead of Type Ahead Find

Post by nerdweed »

Thanks Don for implementing the esc functionality and thanks photoman for convincing Don.

photoman
Posts: 33
Joined: 29 Jan 2017 14:36

Re: Option for Live Filter Box instead of Type Ahead Find

Post by photoman »

highend wrote:You need to show the extra1 column in your list
Save the script in UTF-8 with BOM

Clicking outside the popupmenu -> nothing will happen
Clicking the first empty entry -> Tag will be nulled (no stars)
Happy tagging^^
Thanks highend for your code. I've been trying to hack it a little so that it works more consistently with Don's implementation. Don is saving numerical values and you are saving the stars. The advantage to saving numbers is that you can do a search like this: " Rating: > 3". which is very useful. So, I did a dirty hack on your code (because I don't know the syntax of these user scripts at all) to save the values as numbers.

Code: Select all

 $empty = chr(13);
    $rating = <<<>>>
        $empty
        β˜†
        β˜…
        β˜…β˜†
        β˜…β˜…
        β˜…β˜…β˜†
        β˜…β˜…β˜…
        β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…
        β˜…β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…β˜…
>>>;
    $rating = regexreplace($rating, "^[ ]*");
    $index  = popupmenu($rating, , , , , 1, <crlf>, 0);
    if ($index == 0) { end true; }
    elseif ($index == 1) { $match = ""; }
    else { $match = gettoken($rating, $index, <crlf>); }

    if ($match =="") {$valuetosave=""}
    if ($match =="β˜†") {$valuetosave=".5"}
    if ($match =="β˜…") {$valuetosave="1"}
    if ($match =="β˜…β˜†") {$valuetosave="1.5"}
    if ($match =="β˜…β˜…") {$valuetosave="2"}
    if ($match =="β˜…β˜…β˜†") {$valuetosave="2.5"}
    if ($match =="β˜…β˜…β˜…") {$valuetosave="3"}
    if ($match =="β˜…β˜…β˜…β˜†") {$valuetosave="3.5"}
    if ($match =="β˜…β˜…β˜…β˜…") {$valuetosave="4"}
    if ($match =="β˜…β˜…β˜…β˜…β˜†") {$valuetosave="4.5"}
    if ($match =="β˜…β˜…β˜…β˜…β˜…") {$valuetosave="5"}
    tagitems(1, $valuetosave);
This saves properly in Tag.dat, but unfortunately it doesn't display properly because Don does a check on the Rating field, and if it's 1,2,3,4,5 it'll display the stars. But, it seems that it'll take the 1.5,2.5,3.5,4.5, values as integers and truncate the .5 and display the integer number of stars.
So using my hack, you'll get values stored properly and the search "Rating: > 3" will work properly, but you can't see β˜…β˜…β˜…β˜†, you'll only see β˜…β˜…β˜….

Storing the stars allows this search "Rating:β˜…β˜…β˜†" to work, but not "Rating: > β˜…β˜…β˜†".

I guess I could just use a different numeric field and just store numbers, and forget about displaying stars.

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

Re: Option for Live Filter Box instead of Type Ahead Find

Post by highend »

This can be done a little bit easier ;)

Code: Select all

    $empty = chr(13);
    $rating = <<<>>>
        $empty
        β˜†
        β˜…
        β˜…β˜†
        β˜…β˜…
        β˜…β˜…β˜†
        β˜…β˜…β˜…
        β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…
        β˜…β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…β˜…
>>>;
    $rating = regexreplace($rating, "^[ ]*");
    $index  = popupmenu($rating, , , , , 1, <crlf>, 0);
    if ($index == 0) { end true; }
    elseif ($index == 1) { $match = ""; }
    else { $match = ($index - 1) / 2; }
    tagitems(1, $match);
And if you don't care about icons but about the visual representation (but ofc this could be done with icons as well...),
a cc script could look like this:

Code: Select all

    $rating = "β˜†|β˜…|β˜…β˜†|β˜…β˜…|β˜…β˜…β˜†|β˜…β˜…β˜…|β˜…β˜…β˜…β˜†|β˜…β˜…β˜…β˜…|β˜…β˜…β˜…β˜…β˜†|β˜…β˜…β˜…β˜…β˜…";
    $tag = tagitems(1, , <cc_item>);
    if !($tag) { return; }
    else { return gettoken($rating, $tag * 2, "|"); }
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

photoman
Posts: 33
Joined: 29 Jan 2017 14:36

Re: Option for Live Filter Box instead of Type Ahead Find

Post by photoman »

highend wrote:This can be done a little bit easier ;)

Code: Select all

    $empty = chr(13);
    $rating = <<<>>>
        $empty
        β˜†
        β˜…
        β˜…β˜†
        β˜…β˜…
        β˜…β˜…β˜†
        β˜…β˜…β˜…
        β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…
        β˜…β˜…β˜…β˜…β˜†
        β˜…β˜…β˜…β˜…β˜…
>>>;
    $rating = regexreplace($rating, "^[ ]*");
    $index  = popupmenu($rating, , , , , 1, <crlf>, 0);
    if ($index == 0) { end true; }
    elseif ($index == 1) { $match = ""; }
    else { $match = ($index - 1) / 2; }
    tagitems(1, $match);
Thanks. Given the current state of things, I think I'm going to go with keeping it simple and abandon the stars. Just a 0 or 1 to 10 rating, and 2 keyboard shortcuts, + and - keys to increment and decrement the rating.

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

Re: Option for Live Filter Box instead of Type Ahead Find

Post by highend »

and abandon the stars
Why that?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

photoman
Posts: 33
Joined: 29 Jan 2017 14:36

Re: Option for Live Filter Box instead of Type Ahead Find

Post by photoman »

highend wrote:
and abandon the stars
Why that?
Well, because there doesn't seem to be a way to display the stars AND save them as numbers between 1 to 5 in tag.dat. If they aren't saved as numbers, then I can't search for "Rating: > 3", i.e. show me all the mp3s in this folder that have a high rating so I can make a playlist (for example).

By the way, I've written the code for increment and decrement ratings. Do you know why it runs so slowly and what the faster way is? It's so slow that I can watch each files rating update individually in the listbox.

Code: Select all

   foreach($ff, <get selecteditemspathnames |>) {
      $x=tagitems(1,,$ff) - 1;
      if $x < -1 {$x= -1}
      if $x == 0{$x=""}
      tagitems(1,$x,$ff);
   }

Code: Select all

   foreach($ff, <get selecteditemspathnames |>) {
      $x=tagitems(1,,$ff) + 1;
      if $x > 11 {$x=11}
      if $x == 0 {$x=""}
      tagitems(1,$x,$ff);
   }
(And yes, I'm using a -1 to 11 rating scale with 0 blanked out.) Might as well build on some added flexibility!

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

Re: Option for Live Filter Box instead of Type Ahead Find

Post by highend »

Well, because there doesn't seem to be a way to display the stars AND save them as numbers between 1 to 5 in tag.dat.
But my last posting contains two scripts that do exactly this?

The tagging script shows stars in the popupmenu and saves values up to 5 in the tag.db corresponding to the selected stars and the cc script reads these values
and displays stars again. Ofc you can search for Rating: >3 in this case (if your column is named "Rating")...

Regarding your script(s).
Maybe the list is refreshed on each loop? Try to suppress it with the setting command + AutoRefresh / WatchDuringFileOp

Apart from that you could build star rating lists instead of tagitems on each loop (for each found tag value one list that contains the file names)
and then use tagitems on these lists (instead of tagging 100 items you only need to use tagitems only a few times)
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

photoman
Posts: 33
Joined: 29 Jan 2017 14:36

Re: Option for Live Filter Box instead of Type Ahead Find

Post by photoman »

highend wrote:
Well, because there doesn't seem to be a way to display the stars AND save them as numbers between 1 to 5 in tag.dat.
But my last posting contains two scripts that do exactly this?

The tagging script shows stars in the popupmenu and saves values up to 5 in the tag.db corresponding to the selected stars and the cc script reads these values
and displays stars again. Ofc you can search for Rating: >3 in this case (if you column is named "Rating")...

Regarding your script(s).
Maybe the list is refreshed on each loop? Try to suppress it with the setting command + AutoRefresh / WatchDuringFileOp

Apart from that you could build star rating lists instead of tagitems on each loop (for each found tag value one list that contains the file names)
and then use tagitems on these lists (instead of tagging 100 items you only need to use tagitems only a few times)
Maybe I didn't understand a few things about your post. In the first script, there was a popup menu to select stars, but the star column in the listbox didn't display properly.
I didn't know what to do with the second script but that's probably because i don't know what "a cc script could look like this:" means. Maybe that was my problem.
As for updating the ratings, using Don's right-click on the ratings column and select, tags all the files instantaneously. Even with 200 files selected. My script with just 40 files not only is slow, but jacks up my CPU usage and makes the cpu fan speed up and get fairly noisy! :lol:

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

Re: Option for Live Filter Box instead of Type Ahead Find

Post by highend »

Add a custom column und use my "cc" script with it. That displays the stars as rating...
cc.png
cc.png (12.39 KiB) Viewed 1085 times
Even with 200 files selected
Tagging 200 files with one call to tagitems is different from calling it two hundred times...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

photoman
Posts: 33
Joined: 29 Jan 2017 14:36

Re: Option for Live Filter Box instead of Type Ahead Find

Post by photoman »

highend wrote:Add a custom column und use my "cc" script with it. That displays the stars as rating...
aaahhh! Now it all makes sense. CC=custom column. I never played with that before.
Tagging 200 files with one call to tagitems is different from calling it two hundred times...
Yes, I got it now. That is a very true statement! Sorry, this is the first time I've looked at the scripting code so I'm not used to it yet.
By the way, to anyone who is interested, although there is no half star unicode character, we came up with this empty star system to represent a half star. Another idea would be to use the 1/2 symbol. I think some people might like that. I actually prefer the empty star.

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

Re: Option for Live Filter Box instead of Type Ahead Find

Post by highend »

Btw, one way to reduce the necessary tagitems calls:

Code: Select all

    // Decrement stars by one
    $list = "";
    foreach($item, <get selecteditemspathnames |>) {
        $tag = tagitems(1, , $item) - 1;
        if ($tag < -1) { $tag = -1; }
        if (!$tag) { $tag = ""; }
        $list = $list . $tag . "|" . $item . <crlf>;
    }

    foreach($rating, formatlist(regexmatches($list, "^[0-9.,]+"), "des")) {
        $matches = regexmatches($list, "^$rating\|.*?(?=\r?\n)");
        $matches = regexreplace(formatlist($matches, "des"), "^$rating\|");
        tagitems(1, $rating, $matches);
    }
    #485; // Refresh list
It builds a list of ratings for all files and then filters it and goes only over all ratings that need to change
So even if you would use it on 1000 files and e.g. you've only given 3 and 5 stars, tagitems would only
be called two times (one time for 3 and one time for 5)
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Post Reply