• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Copy Filename to IPTC Keywords

New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Hi all,

I'd like to copy filename to keywords. I've read this forum but I can't find a solution to my case.. So if someone could help me and tell me how to do that I'll be very happy. I don't have any javascript skills, so if someone would push me forward, that'll be nice.

I'm using Bridge CS3, MacOS 10.5.8. I'd like to use it with Automator, or if someone has better solution, please let me know.

Thanks,

Pete

TOPICS
Scripting

Views

14.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 09, 2010 Jun 09, 2010

This will put the filename only no extension..


#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/";
    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');
    md.Keywords = md.Keywords + ";" + Name;
  }
}
if (BridgeTalk.appName == "bridge"){
var menu = MenuElement.create( "command", "Save Filename in Keyw

...

Votes

Translate

Translate
Valorous Hero ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

This should do it..


#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 = md.Keywords + ";" + sels.name;
  }
}

if (BridgeTalk.appName == "bridge"){

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Thank you Paul 😃

What should I do next? I've already save your javascript to .jsx with ESTK, but how could I get it running? Where in system should I save it?

I'm using Adobe CS3, MacOS 10.5.8

I'm sorry about my questions, but I'm not familiar with these..

Thanks again,

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

I saved the .jsx inside system folder "Application Support/Adobe/Bridge CS3 Extensions/Adobe Workflow Automation" and it works. 😃

Thank you Paul!

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Start Bridge
Edit - Preferences - Startup Scripts
Click the "Reveal" button, this will open the folder where the script should be put.
Close and re-start Bridge, accept the new script.
Select the documents that require the filename added and then select the script from the bottom of the Tools menu.

Hope this helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Thanks Paul,

is there chance to edit the javascript so, that filetype (".tif", "jpg") is executed from the keywords?

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Sorry but I don't understand what you are after Pete?  executed?

Do you mean no that the extensions are to be removed for .tif & .jpg or even all extensions to be removed.?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Sorry my bad english..

I'd like to remove the filetype extension from keywords. Filename is copying ok, but extension ".tif" or ".jpg" goes also to keywords. If it's possible to remove filetype extension so that'll not be shown in keywords? Is it possible?

I'll remove filetype extensions now manually. That's because of the structure of the imagebank I'm using, the imagebank doesn't recognize keywords if they're not exact, keywords have to be without dots (.) The search engine doesn't find anything if I'm typing "image", if the image contains "image.tif" in keywords...

Thanks again for helping me, 😃

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

This will put the filename only no extension..


#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/";
    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');
    md.Keywords = md.Keywords + ";" + Name;
  }
}
if (BridgeTalk.appName == "bridge"){
var menu = MenuElement.create( "command", "Save Filename in Keywords", "at the end of Tools");
  menu.onSelect = addNametoMeta.execute;
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

That's it! Done!

Thank you very much, Paul!

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Hi!

Is there any chance to separate keywords with commas within this script? , or ;? So that the empty space between words will be replaced with commas? That should not affect to the filename, commas should be only in keywords.

Thanks,

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 30, 2011 Mar 30, 2011

Copy link to clipboard

Copied

What if I wanted to use the name of the folder the files are in rather than the file name?

Say, I have a folder and within it many subfolders. I want to display all of the files within that folder and its subfolders, select all images and transfer the subfolder names into Description filed in IPTC.

Thank you for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 30, 2011 Mar 30, 2011

Copy link to clipboard

Copied

This should do it....

#target bridge  
   if( BridgeTalk.appName == "bridge" ) { 
addFolderName = MenuElement.create("command", "Add FolderName to Description", "at the end of Tools");
}
addFolderName.onSelect = function() {
   addFolderNameToDescription();
   }
function addFolderNameToDescription(){
if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var sels =  app.document.selections;
for(var a in sels){
            var thumb = sels;
            if(thumb.type != 'file') continue;
            app.synchronousMode = true;
            va...
.spec.parent.name ); 
            var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMA...


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 31, 2011 Mar 31, 2011

Copy link to clipboard

Copied

Thank you very much!

Unfortunately, the situation is more complicated than that. Some of the folder names use accented characters and those do not transfer well. Example:

1. Folder name in Bridge

1-04-2011 12-27-29 AM.gif

2. Result in the IPTC Description field

1-04-2011 12-28-11 AM.gif

Can this be resolved?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 31, 2011 Mar 31, 2011

Copy link to clipboard

Copied

Please try this now...


#target bridge  
   if( BridgeTalk.appName == "bridge" ) { 
addFolderName = MenuElement.create("command", "Add FolderName to Description", "at the end of Tools");
}
addFolderName.onSelect = function() {
   addFolderNameToDescription();
   }
function addFolderNameToDescription(){
if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var sels =  app.document.selections;
for(var a in sels){
            var thumb = sels;
            if(thumb.type != 'file') continue;
            app.synchronousMode = true;
            va...
.spec.parent.name) ); 
            var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORM...


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 31, 2011 Mar 31, 2011

Copy link to clipboard

Copied

Thank you. Even before I try, can you possibly add some comments for the purposes of learning?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 31, 2011 Mar 31, 2011

Copy link to clipboard

Copied

Seems to be working fine now. Thanks a lot.

Anna

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2011 May 07, 2011

Copy link to clipboard

Copied

Hello Paul,

Thank you for these scripts!

I'm trying to tweak this script to write the Folder Name to the IPTC Keyword field instead of the Description field. This works (when I substitute "subject" for "description") but only when the Keyword field is empty.

What's the trick to append keywords?

Thank you in advance,

-Saïd

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 07, 2011 May 07, 2011

Copy link to clipboard

Copied

Please try this...

#target bridge
addFolderNametoMeta = {};
addFolderNametoMeta.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 = md.Keywords + ";" + decodeURI(sels.spec.parent.name);
  }
}
if (BridgeTalk.appName == "bridge"){
var menu = MenuElement.create( "command", "Save FolderName in Keywords", "at the end of Tools");
  menu.onSelect = addFolderNametoMeta.execute;
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2011 May 07, 2011

Copy link to clipboard

Copied

Thanks Paul.

Works like a charm!

i'd tried

> decodeURI(sels.spec.parent.name)

that I pulled form another script but, of course, that didn't work.

You've rescued me from disorientation in the Javascript Tools Guide, popping various Folder Object Properties and hoping one would work 😉

Naturally, no good deed goes unpunished! (Though if you have a solution to this following one then I will donate to your favorite charity).

The next time-saving query that comes to mind is this: File and Folder names are (for me) often concatenated. This means when I add them to Keywords, I must manually edit the text to return it to individual (hence searchable) words. Is there a way to run a script such as this so that the filename (for example) pops up in a dialogue box for manual editing before applying to the XMP field? This would be a real timesaver when applying this script to batches of files.

Much Obliged

-Saïd

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 08, 2011 May 08, 2011

Copy link to clipboard

Copied

Hi Said, glad that worked, I wonder if this script might help you?

http://www.ps-scripts.com/bb/viewtopic.php?f=19&t=2364&sid=c8a1c6d5d06e0a1127cc473f6ac3466d

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2011 May 08, 2011

Copy link to clipboard

Copied

Paul, you are a Wizard! And an exceedingly generous and

responsive one too.

Alas, the “Add/Replace/Remove Keyword” script does not seem

to work with CS5 (ln 12). The script installs okay but appears

nowhere within Bridge.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 08, 2011 May 08, 2011

Copy link to clipboard

Copied

Ah, it can be difficult to find, it is in the context menu.

Mouse Right click (menu) and select "Add-Replace-Remove Keyword" on a PC

Not sure on the Mac I think it is ctrl/click to get the context menu.

Hope this helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2011 May 08, 2011

Copy link to clipboard

Copied

There it is! Sweet.

Doesn’t quite do what I had in mind (automatically populate

the Replace field with the keyword(s) for subsequent editing)

but after a good night’s sleep, I think this will work fine.

My thought would be next-to-impossible to implement on batches.

Well... unless the dialogue contained a “Go to next file”

button and automatically re-populated the Replace field.

However, this beggar will not be choosy.

Thanks much

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2011 Aug 17, 2011

Copy link to clipboard

Copied

Paul,

Being a total noob here, is there a way to use this script but only access the filesnames first 7 alpha numerical values, so that the filenames first 7 alphanumeric characters go to the keywords?? absolutely love this script,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines