Copy link to clipboard
Copied
I am trying to get and set the rating (stars) of JPEG and RAW data with JavaScript, but I cannot find an interface to do this.
I already get the file name and other information. Is there any techniques?
#target bridge
var selectedItems = app.document.selections;
var currentFolder = null;
if (selectedItems.length > 0) {
currentFolder = selectedItems[0].parent.path;
} else {
currentFolder = "~/Pictures";
}
var d = Folder.selectDialog("select folder", currentFolder);
var f = d.getFiles();
for(var i = 0; i < f.length; i++){
alert(f[i].name, f[i].rating); // rating is undefined
}
Copy link to clipboard
Copied
You can't use files, you need to use thumbnails. RAW files don't have a rating. That info is stored in the XMP sidecar which is a separate file.
thumbs = app.document.selections;
for(var i = 0; i < thumbs.length; i++){
thumbs[i].rating = 1;
}
Copy link to clipboard
Copied
Thanks. I misunderstood the implementation.
What I ultimately wanted to do was select two folders with the file dialog and copy the ratings in one folder to the other.
It is easy to do getFiles() from selectDialog(), but is it possible to access the thumbnails (or ratings) in a specific folder as well?
Copy link to clipboard
Copied
You would have to do matching of filenames, have you written that part?