Skip to main content
Participant
February 16, 2008
Question

script to insert file name into keywords field of same file

  • February 16, 2008
  • 13 replies
  • 3971 views
Hello,

search a solution, a Script or another, which writes the file name into keywords field of same file (Metadata: Description/Keywords) in "photoshop", "bridge" or better in "Lightroom" .
I found this topic from Mike Hale http://www.ps-scripts.com/bb/viewtopic.php?t=1330
It's possible this script to change this in such a way that it does this:
"script to insert file name into keywords field of same file"

Thanks and best greetings

Wolfgang
This topic has been closed for replies.

13 replies

Kasyan Servetsky
Legend
February 17, 2008
Here is a link to a discussion on adding keywords:
http://www.adobeforums.com/cgi-bin/webx/.3bbdb152/0
They say it's possible to do, but I couldn't get it working yet.

Kasyan
_Gewuerz_Author
Participant
February 17, 2008
Thanks for the script.
Unfortunately, it only works when the Keyword field is empty.
This already helps a bit. I must just work on the pictures with the script at the beginning.
Were better if this could somehow work also later for pictures with all Keywords.

Thanks and best greetings
Wolfgang
Kasyan Servetsky
Legend
February 16, 2008
Hi Wolfgang,

Change line
md.Source = sels.name;
to
md.Keywords = sels.name;

But it works if the file name is the only keyword you are going to use.
//-------------------------------
#target bridge
addNametoMeta = {};

addNametoMeta.execute = function(){
var sels = app.document.selections;
for (var i = 0; i < sels.length; i++){

var md = sels.synchronousMetadata;
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
md.Keywords = sels.name;
}
}

// this script only works in bridge
if (BridgeTalk.appName == "bridge"){

var menu = MenuElement.create( "command", "Save Filename in Keywords", "at the end of Tools");
menu.onSelect = addNametoMeta.execute;
}
//--------------------------------------
Kasyan