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

Copy filename to iptc description with changes

Guest
Jul 19, 2010 Jul 19, 2010

Hello,

I'm looking for a script for copying the filename of a tiff to the description in that same file's iptc, with a couple of contextual changes to the name.

Those changes are:

replace any = with :

replace any * with /

add the prefix "CMS:"

So here's an example:

input

filename: 87*37=6.tif

description:

output

filename: 87*37=6.tif

description: CMS:87/37:6

I had a script that did some of these things for a while, but it was quite slow and I don't know how to rewrite it.

Thank you in advance for any help,

Lewis

TOPICS
Scripting
640
Translate
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 ,
Jul 19, 2010 Jul 19, 2010
LATEST

This is the same script as before with an extra line to change the asterisk..


#target bridge  
   if( BridgeTalk.appName == "bridge" ) { 
FileNameToDesc = MenuElement.create("command", "Add FileName to Description", "at the end of Thumbnail");
}
FileNameToDesc.onSelect = function () {
   updateFileName();
   }
     
function updateFileName(){
loadXMPLib();
var Prefix = "CMS:";
var sels = app.document.selections;
for(var a in sels){
var thumb = new Thumbnail(sels);
   if(thumb.hasMetadata){
      var selectedFile = thumb.spec;   
      var myXmpFile = new XMPFi...

.name).replace(/\.[^\.]+$/, '');
      Name = Name.replace(/\*/g,'/');
        Name = Prefix + Name.re...






















Translate
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