Use Filename as Basis to Set Various Metadata Properties


hi,

 

i have folders full of images. filenames in form of

 

artist#event#photographer#randomnumber.jpg but potentially

 

artist @ event photographer - randomnumber.jpg. i'm happy use whichever easier. can set delimiter want , vary if needed

 

i have seen few examples filename set title, description etc i'm having no luck editing files need. ideally i'd like

 

document title: artist @ event photographer

author: photographer

description: artist @ event photographer courtesy of company name

keywords: artist, event, photographer, company name

 

i presume possible hoping kind soul out there help!

 

thanks in advance,

 

jj

here example, don't know going company name?

this example using first filename example....

 

 

//to run extendscript toolkit #target bridge app.document.deselectall(); var thumbs = app.document.getselection("jpg"); for(var in thumbs){ var f =thumbs[a].spec; var parts = decodeuri(f.name).replace(/- \d+.jpg$/i,'').split('#'); if(parts.length == 3){ setmetadata( file(f), parts )     } } function setmetadata( file, parts ){ var title = parts[0].tostring() + " @ " + parts[1].tostring() + " " + parts[2].tostring(); var desc = parts[0].tostring() + " @ " + parts[1].tostring() + " " + parts[2].tostring(); var author = parts[2].tostring(); if ( !externalobject.adobexmpscript ) externalobject.adobexmpscript = new externalobject('lib:adobexmpscript');         var xmpf = new xmpfile( file(file).fsname, xmpconst.unknown, xmpconst.open_for_update );         var xmp = xmpf.getxmp();         xmp.deleteproperty(xmpconst.ns_dc, "title");         xmp.appendarrayitem(xmpconst.ns_dc, "title", title, 0, xmpconst.alias_to_alt_text);         xmp.setqualifier(xmpconst.ns_dc, "title[1]", "http://www.w3.org/xml/1998/namespace", "lang", "x-default");         xmp.deleteproperty(xmpconst.ns_dc, "description");         xmp.setlocalizedtext( xmpconst.ns_dc, "description", null, "x-default", desc );         xmp.deleteproperty(xmpconst.ns_dc, "creator");          xmp.appendarrayitem(xmpconst.ns_dc, "creator", author, 0, xmpconst.array_is_ordered);         for(var s in parts){         xmp.appendarrayitem(xmpconst.ns_dc, "subject", parts[s], 0,xmpconst.prop_is_array);         }       if (xmpf.canputxmp( xmp )) {          xmpf.putxmp( xmp );       }       xmpf.closefile( xmpconst.close_update_safely ); }    


More discussions in Bridge Scripting


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support