Skip to main content
Inspiring
January 27, 2019
Answered

Image title (no extension) to the IPTC Job Identifier

  • January 27, 2019
  • 3 replies
  • 3468 views

Hi

I use Bridge and Photoshop latest versions

Ive seen references to something similar that I need but not using the IPTC field Job Identifier.

I need to batch script it using Bridge (for many images)

If anyone can help, that would be very useful.

I do this so the original title of the image isn't lost when I rename the file title (not IPTC title) to something meaningful. This helps me locate the original files (PSD's etc) in the future.

Much appreciated for any help

Simon

This topic has been closed for replies.
Correct answer SuperMerlin

Something like this...?

It puts the filename without the extension into the Job Identifier field for selected files.

#target bridge;

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

if(!MenuElement.find("TReference")){

var filenameToRef = new MenuElement( "command", "Filename to Job ID", "at the end of Tools", "TReference" );

}}

filenameToRef.onSelect = function () {

if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

var sels =  app.document.selections;

app.synchronousMode = true;

for(var a in sels){

var thumb = sels;

var newname = decodeURI(sels.spec.name).replace(/\..+$/,'');

var xmp = new XMPMeta(thumb.synchronousMetadata.serialize());

xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference");

xmp.setProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference", newname);

var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);

thumb.metadata = new Metadata(newPacket);

}

app.synchronousMode = false;

};

Participant
April 21, 2020

Hi SuperMerlin

 

I tried running your script but when I select the files in Bridge and go to Tools - Filename to Job ID nothing happens, no error message, nothing. Any idea why that is or what I can do to make it work?

 

Thanks.

Participating Frequently
December 16, 2024

Hello - found this thread as I am looking to do this too and I can't get it to work. Nothing updates, nothing happens, no error messages either when I go to Tools - Filename to Job ID.


Stephen Marsh
Community Expert
Community Expert
December 17, 2024

I just tested and it works in Bridge v2024.

 

It writes the filename sans extension to the IPTC Status > Job Identifier field.

 

Just to make sure that the code is correctly set in the transition from old to new forum software formatting, here is a copy that I previously saved back in 2019:

 

// https://forums.adobe.com/thread/2588538
#target bridge;  
if( BridgeTalk.appName == "bridge" ) {    
if(!MenuElement.find("TReference")){  
var filenameToRef = new MenuElement( "command", "Filename to Job ID", "at the end of Tools", "TReference" );  
}}  
filenameToRef.onSelect = function () {   
if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');  
var sels =  app.document.selections;  
app.synchronousMode = true;  
for(var a in sels){  
var thumb = sels[a];  
var newname = decodeURI(sels[a].spec.name).replace(/\..+$/,'');  
var xmp = new XMPMeta(thumb.synchronousMetadata.serialize());  
xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference");  
xmp.setProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference", newname);  
var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);  
thumb.metadata = new Metadata(newPacket);  
}  
app.synchronousMode = false;  
};

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Stephen Marsh
Community Expert
Community Expert
January 28, 2019

Hi Simon, what exactly do you mean by “title” and “file title”?

Do you mean the filename? If so more below...

Otherwise, if you meant something else by “title” and “file title” and not filename, can you show the metadata field in Bridge with a screenshot so that it is clear which exact metadata fields you mean?

__________________

There is a dedicated XMP metadata field that is intended to hold an original filename so that a renamed file can be reverted back to the original filename:

<xmpMM:PreservedFileName>

This “PreservedFileName” metadata can easily be added in Bridge using the Batch Rename tool, without requiring a script:

Bridge ships with an option to restore the filename from the PreservedFileName metadata:

This can also be leveraged using other software, for example with ExifTool. Adding the filename to the PreservedFileName metadata tag:

exiftool '-XMP-xmpMM:PreservedFileName<${filename}' -r 'path to file or top level folder'

Restoring the filename from the PreservedFileName metadata tag:


exiftool '-FileName<XMP-xmpMM:PreservedFileName' -r 'path to file or top level folder'

Inspiring
January 28, 2019

Hi,

Yes, filename, and yes I have found the 'preserve' function in bridge.

The preserve function was only useful if id use the renaming function in bridge (which I wasn't using), I was just renaming file names in Finder, with a unique descriptive name.

EXAMPLE

I have 100 images

IMG_001 to IMG_100

I selected 3 of them to use for now (keep the rest just in case)

So I rename those three with nice descriptive titles.

This script copies the original filename to a IPTC field so I never loose the title, allowing me to find any related files ie PSD's etc

Stephen Marsh
Community Expert
Community Expert
January 28, 2019

Yes, I understand what you want and that is exactly my point – the <xmpMM:PreservedFileName> field is already designated to hold the filename, it can be batch applied to many files using the Batch Rename tool with no need for scripting and it also allows for easy recovery of the filename, again without scripting. This field can also be searched on too.

P.S. For others saving script code for the first time, instructions here:

Prepression: Downloading and Installing Adobe Scripts

SuperMerlin
SuperMerlinCorrect answer
Inspiring
January 27, 2019

Something like this...?

It puts the filename without the extension into the Job Identifier field for selected files.

#target bridge;

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

if(!MenuElement.find("TReference")){

var filenameToRef = new MenuElement( "command", "Filename to Job ID", "at the end of Tools", "TReference" );

}}

filenameToRef.onSelect = function () {

if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

var sels =  app.document.selections;

app.synchronousMode = true;

for(var a in sels){

var thumb = sels;

var newname = decodeURI(sels.spec.name).replace(/\..+$/,'');

var xmp = new XMPMeta(thumb.synchronousMetadata.serialize());

xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference");

xmp.setProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference", newname);

var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);

thumb.metadata = new Metadata(newPacket);

}

app.synchronousMode = false;

};

Inspiring
January 27, 2019

Thanks for a fast answer, looks perfect (lol I have no idea if it is)

I forgot to say, total noob here. Ive cut and pasted the text into TextEdit (Mac) and saved it as xxx.jsx

Ive put that file in Bridge, startup scripts, but I'm now stuck what to do next.

Can I bother you again for even more help?

Thank you , much appreciated

Simon

Inspiring
January 27, 2019

UPDATE

ah HA, it had a hidden extension, rtf. so deleted that and now its appeared in Bridge scripts.....exciting!!!

hmm but I still can't find a way of running the script on one or more images or a folder of images.

UPDATE

Tried copying your script into AppleScript incase is needed compiling first, that didn't work (probably because it was a totally wrong thing to try lol)

I think ill wait, or ill end up deleting the internet by mistake.