What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How can I add filename to keyword ?


fateme

New Member
Messages
2
Likes
0
Hi
I want to add image name to keyword in file info and can't do it manually . because I have 4000 picture .
what can I do ?
could you help me and send the script to solve this problem ?
 
This is best done in Adobe Bridge

To install copy the code into a PLAIN TEXT editor and save it out with a .jsx extension to the correct folder.
The correct folder can be found by going to the Preferences - Startup Scripts and click "Reveal My Startup Scripts"
This will open the folder where the script is to be saved.
Close and restart Bridge then accept the new script.
To use:
Select the files you want to add the filename to.
Tools - Add Filename to Keywords

JavaScript:
#target bridge   
   if( BridgeTalk.appName == "bridge" ) { 
folderTokeys = MenuElement.create("command", "Add Filename to Keywords", "at the end of Tools");
}
folderTokeys.onSelect  = function () {   
var thumbs = app.document.selections;
if (ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
for(var a =0;a<thumbs.length;a++){
var selectedFile =  new Thumbnail(thumbs[a]); 
var Name = decodeURI(selectedFile.spec.name).replace(/\.[^\.]+$/, '');
app.synchronousMode = true;
var xmp = new XMPMeta(selectedFile.synchronousMetadata.serialize());
xmp.appendArrayItem(XMPConst.NS_DC, "subject", Name, 0,XMPConst.PROP_IS_ARRAY);
var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
selectedFile.metadata = new Metadata(newPacket);
    }
ExternalObject.AdobeXMPScript.unload();
ExternalObject.AdobeXMPScript = undefined;
};
 

Back
Top