Skip to main content
edvardkrupke
Known Participant
May 21, 2019
Answered

Modifying IPTC "Job Identifier" through Javascript?

  • May 21, 2019
  • 1 reply
  • 2575 views

Hi!

I need to be able to read/write/modify the field "Job Identifier" through Javascript, but am unable to find the correct tag to do so. I have probably overlooked some obvious reference on the internet, but the only tag I can find that should be related to the ITPC is "activeDocument.info.JobID", and I am unable to get that to work (comes out as "undefined" even if there is data in the field "Job Identifier").

It would be immensely appreciated if anyone could provide a full list of IPTC javascript tags or otherwise guide me to a correct tag to use to solve my problem.

Thank you so much,

Edvard

This topic has been closed for replies.
Correct answer SuperMerlin

This is the way that you can modify any field...

#target photoshop;

if(documents.length){

if (ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript"); 

xmp = new XMPMeta( app.activeDocument.xmpMetadata.rawData ); 

xmp.setProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference", "Job Identifier");

app.activeDocument.xmpMetadata.rawData = xmp.serialize(); 

}


It looks as if you can, here is a list..

app.activeDocument.info.author

app.activeDocument.info.caption

app.activeDocument.info.captionWriter

app.activeDocument.info.headline

app.activeDocument.info.instructions

app.activeDocument.info.keywords

app.activeDocument.info.author

app.activeDocument.info.authorPosition

app.activeDocument.info.credit

app.activeDocument.info.source

app.activeDocument.info.category

app.activeDocument.info.supplementalCategories

app.activeDocument.info.title

app.activeDocument.info.creationDate

app.activeDocument.info.city

app.activeDocument.info.provinceState

app.activeDocument.info.country

app.activeDocument.info.transmissionReference

app.activeDocument.info.copyrightNotice

app.activeDocument.info.ownerUrl

transmissionReference is the one you want.

1 reply

SuperMerlin
Inspiring
May 21, 2019
edvardkrupke
Known Participant
May 21, 2019

Hi SuperMerlin!

Thank you for the provided link - I am however unable to dechipher what I need from there..

What I think is relevant for me is line 37:

   xmp.setProperty(XMPConst.NS_PHOTOSHOP, "TransmissionReference", "Job Identifier");

I am not sure however, and ideally I would access this through the way I access IPTC title, description and keywords;

activeDocument.info.title;

activeDocument.info.caption;

activeDocument.info.keywords;

I'm guessing  there exist such a property - or am I missing something really obvious?

_wckdTall_
Inspiring
November 16, 2023

Unfortunately, @SuperMerlin is no longer active on the forums.

 

To remove the Document Title for an open file, try the following function:

 

#target photoshop

removeTitle();

function removeTitle() {
    if (!documents.length) return;
    if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
    var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
    XMPUtils.removeProperties(xmp,XMPConst.NS_PHOTOSHOP, "Title", XMPConst.REMOVE_ALL_PROPERTIES);
    app.activeDocument.xmpMetadata.rawData = xmp.serialize();
} 

 

 

To batch remove the Document Title from an entire folder of supported images (add or remove file type extensions in the code as required):

 

// https://forums.adobe.com/message/9671488#9671488
// https://forums.adobe.com/message/10576150#10576150
#target photoshop;  
var inputFolder= Folder.selectDialog ("Please select folder to process");  
if(inputFolder != null){  
var fileList  = inputFolder.getFiles(/\.(jpg|jpeg|tif|tiff|psd|psb|png|webp)$/i);  
for(var a in fileList){delDocTitle(fileList[a]);}  
}  
function delDocTitle(selectedFile) {          
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");       
var xmpFile = new XMPFile( selectedFile.fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_UPDATE | XMPConst.OPEN_USE_SMART_HANDLER );   
var xmp = xmpFile.getXMP();  
xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "Title");  
if (xmpFile.canPutXMP(xmp)) {   
        xmpFile.putXMP(xmp);  
         xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);   
         }                
};    

 


Thanks! I'm trying to batch this through bridge, and now noticing for Illustrator files there are additional persistent titles stored in meta aside from Document Title. Is there a way to access title here? I'm guessing this is part of postscript/pdf... Sample below:

%!PS-Adobe-3.0 
%%Creator: Adobe Illustrator(R) 24.0
%%AI8_CreatorVersion: 28.0.0
%%For: (USER_NAME) ()
%%Title: (OLD_FILENAME.ai)
%%CreationDate: 11/15/23 9:12 PM
%%Canvassize: 16383
%%BoundingBox: -431 -586 1300 944

 
For clarifications, I'm using the AddFilenameToTitle() you referenced here:
https://community.adobe.com/t5/bridge-discussions/bridge-script-to-write-filename-to-description-credit-line-andtitle-lines/m-p/10489128