How to Set Ratings
How to Set Ratings
Are there any other options available for editing a file's rating other than right-clicking in the ratings column?
If you select the small tiles or thumbnail views, there doesn't seem to be a way to set the rating other than changing the view first.
If you select the small tiles or thumbnail views, there doesn't seem to be a way to set the rating other than changing the view first.
Re: How to Set Ratings
A script would work (please save it with UTF-8 from an editor, otherwise the stars could
get lost! in the "Scripts" folder inside the XY data folder, as e.g.: Rating.xys) and load it from
a button on the toolbar or via a user defined command (and a belonging keyboard shortcut)...
The code for a button to load the script could be:
YOU NEED TO ADAPT the $column variable in the script to reflect the ex1-ex5 column you
are using!
get lost! in the "Scripts" folder inside the XY data folder, as e.g.: Rating.xys) and load it from
a button on the toolbar or via a user defined command (and a belonging keyboard shortcut)...
The code for a button to load the script could be:
Code: Select all
::load "Rating";
are using!
Code: Select all
$column = "ex1"; // The "extra" column used
$empty = chr(13);
$rating = <<<>>>
$empty
★
★★
★★★
★★★★
★★★★★
>>>;
$rating = regexreplace($rating, "^[ ]*");
$index = popupmenu($rating, , , , , 1, <crlf>, , 0);
if ($index == 0) { end true; }
elseif ($index == 1) { tagitems($column, ""); } // Empty rating
else { tagitems($column, $index - 1); } // Rating 1 - 5
One of my scripts helped you out? Please donate via Paypal
Re: How to Set Ratings
Thanks for your help, although I think I am doing something wrong. I'm new to scripting, but I was able to follow the example in the help file listed under scripts:
// some little test scripts
"Go to C:\"
goto "C:\"
"Go to System Folder"
goto "%winsysdir%"
"Go to XYplorer Folder"
goto "<xypath>"
My ratings column is called Rating and I used the first extra column. I tried renaming the example you gave to $column = "Rating"; // The "extra" column used
// some little test scripts
"Go to C:\"
goto "C:\"
"Go to System Folder"
goto "%winsysdir%"
"Go to XYplorer Folder"
goto "<xypath>"
My ratings column is called Rating and I used the first extra column. I tried renaming the example you gave to $column = "Rating"; // The "extra" column used
- Attachments
-
- ratingScript.png (31.35 KiB) Viewed 2734 times
Re: How to Set Ratings
You removed the indentation in the script code that I posted.
Because of this you get the output that you see in your
screenshot. Try to copy and paste the code into your
editor again and don't mess with the indentation this time
You can leave the $column variable as it is, it already uses the
first extra column.
Because of this you get the output that you see in your
screenshot. Try to copy and paste the code into your
editor again and don't mess with the indentation this time
You can leave the $column variable as it is, it already uses the
first extra column.
One of my scripts helped you out? Please donate via Paypal
Re: How to Set Ratings
@highend I hope you don't mind me posting this but because I'd modified your posted script for myself to make a few changes that suit my use case better, I thought I might share it, my scripting skills are still in their development stage so use my version at your own peril, but I haven't had any problems while using it. All credit goes to @highend for his initial work.
I think I am a little OCD because I like my stars to go from 5 down to 0 like how they are arranged when using the actual column to set ratings, instead of the opposite way round, so I modified @highends code to behave like this and also to display a check mark when you have a previous rating already set as well as an extra empty item to clear the rating that only displays when there is already a rating set.
As explained in the post above this and still applicable here you may need to adjust the $column variable to match the Extra column you are using for ratings, any of these are valid values ex1,ex2,ex3,ex4,ex5
I think I am a little OCD because I like my stars to go from 5 down to 0 like how they are arranged when using the actual column to set ratings, instead of the opposite way round, so I modified @highends code to behave like this and also to display a check mark when you have a previous rating already set as well as an extra empty item to clear the rating that only displays when there is already a rating set.
As explained in the post above this and still applicable here you may need to adjust the $column variable to match the Extra column you are using for ratings, any of these are valid values ex1,ex2,ex3,ex4,ex5
Code: Select all
$column = "ex:Rating"; // ############ SET THIS VALUE ############
$rating = <<<>>>
★★★★★
★★★★
★★★
★★
★
>>>;
$tag = tagitems($column);
if ($tag Like "#" && $tag <= 5) {
$result = "";
foreach ($line, $rating, <crlf>) {
if ($tag == strlen($line)) {
$result = $result . $line . ";;;2<crlf>";
} else {
$result = $result . $line . <crlf>;
}
}
$rating = $result . <crlf> . chr(13);
}
$index = popupmenu($rating, , , , , 1, <crlf>, , 0);
switch ($index) {
case "0":
end true;
case "1":
tagitems($column, 5);
break;
case "2":
tagitems($column, 4);
break;
case "3":
tagitems($column, $index);
break;
case "4":
tagitems($column, 2);
break;
case "5":
tagitems($column, 1);
break;
case "6":
tagitems($column, "");
break;
}
Last edited by jupe on 16 Dec 2017 15:31, edited 1 time in total.
Re: How to Set Ratings
NopeI hope you don't mind me posting this
Maybe you should make a note that the user needs to name the column "Rating", otherwise
the script would find no tag entries...
In that case I would at least check if that column really exists:
Code: Select all
if !(gettokenindex("Rating", setcolumns(, 64), ",", "")) {
status "'Rating' column does NOT exist, aborted!", "8B4513", "stop"; end true;
}
One of my scripts helped you out? Please donate via Paypal
Re: How to Set Ratings
Thanks to both of you for your help.
I'm not sure if this should go on a separate post or not but I just noticed that changing a file's rating does not update the modified time, but that seems to be across the board with any file operations done in xyplorer.
I'm not sure if this should go on a separate post or not but I just noticed that changing a file's rating does not update the modified time, but that seems to be across the board with any file operations done in xyplorer.
Re: How to Set Ratings
Ofc it doesn't. The file itself isn't modified because this tag is written to the tag.dat database file...I just noticed that changing a file's rating does not update the modified time
That depends on the operation^^but that seems to be across the board with any file operations done in xyplorer
One of my scripts helped you out? Please donate via Paypal
Re: How to Set Ratings
Hi highend, hi jupe -
I tried to implement this with the expectation that it would tag items with numbers 1-5. It does add a number to the extra column that I named Rating, but it doesn't seem to create the tag entry that I expected it to. Should it create the same kind of tag entry that I would otherwise have done manually?
I tried to implement this with the expectation that it would tag items with numbers 1-5. It does add a number to the extra column that I named Rating, but it doesn't seem to create the tag entry that I expected it to. Should it create the same kind of tag entry that I would otherwise have done manually?
Re: How to Set Ratings
Where, in the tag.dat file?but it doesn't seem to create the tag entry that I expected it to
If you mean this, did you save your tags (File - Settings Special - Save Tags) afterwards?
One of my scripts helped you out? Please donate via Paypal
Re: How to Set Ratings
@highend -
Correct, it did not save to tag.dat and I didn't use the tag saving methodology you mentioned, but I have never had to with other tags.
Correct, it did not save to tag.dat and I didn't use the tag saving methodology you mentioned, but I have never had to with other tags.
Re: How to Set Ratings
Tags aren't saved immediately. Either you do it manually, have a necessary setting (still doesn't do it instantly) or exit the current instance (with saving settings)...
One of my scripts helped you out? Please donate via Paypal
Re: How to Set Ratings
I understand, but I usually just "save settings" to commit them and not the option that you used.highend wrote:Tags aren't saved immediately. Either you do it manually, have a necessary setting (still doesn't do it instantly) or exit the current instance (with saving settings)...
Re: How to Set Ratings
I don't understand what you mean exactly, but if you want to save tags file to disk instantly when you are using one of the above scripts, just add this to the bottom of the script (with indentation):
Code: Select all
#195;
Re: How to Set Ratings
What I mean is that I'm clicking the disk icon ("Save Settings"), which saves all settings, correct?
I looked in the tag.dat file and the ratings (1-5) are making it into the file, but they're not being returned as result when I search by tag. Ideas?
I looked in the tag.dat file and the ratings (1-5) are making it into the file, but they're not being returned as result when I search by tag. Ideas?