Paul-Riggott / PS-Scripts

Photoshop Scripts
193 stars 73 forks source link

KeyWordCount.jsx doesn't work - produces errors and stops / crashes Bridge | edit: I found your script which works #3

Closed astx123 closed 6 years ago

astx123 commented 6 years ago

First it doesn't appear anywhere (or I didn't find it), and then these errors appears:

JavaScript error (...\KeyWordCount.jsx:5) undefined is not an object JavaScript error (Metadata:5): undefined is not an object

Can you fix this useful script?

astx123 commented 6 years ago

Here is your other script which works, if anyone needs it. Just enable the "inspector" panel in Window.

`

target bridge

function KeyDetails(){
var pp = new InspectorPanel("With Compliments");
this.panelRef = pp;
var zzz = [["Number Of Keys","[[javascript:getDetails()]]"]];
var tp = new TextPanelette("File an Keyword Details", "", "[[this]]", zzz);
pp.registerPanelette(tp);
app.registerInspectorPanel(pp);
}
function getDetails(){
var retval = "";
for(var i=0; i < app.document.selections.length; i++) {
var thumb = app.document.selections[i];
var selectedFile = thumb.spec;
md = new Thumbnail(selectedFile).synchronousMetadata;
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
var keys = md.Keywords;
retval +=decodeURI(thumb.spec.name)+" Keywords = "+keys.length+"\n";
}
return retval;
}
KeyDetails(); `