Site logo

Metadata

Read/write 'Author Title' in the active document

main();

function main() {
	var doc = app.activeDocument;
	var oldProperty = doc.metadataPreferences.getProperty("http://ns.adobe.com/photoshop/1.0/", "photoshop:AuthorsPosition");
	doc.metadataPreferences.setProperty("http://ns.adobe.com/photoshop/1.0/", "photoshop:AuthorsPosition", "My updated author title");
}

Read/write 'IPTC Contact - City' in the active document

var myDoc = app.activeDocument;
myDoc.metadataPreferences.setProperty("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrCity", 'Kiev');
var cityStr = myDoc.metadataPreferences.getProperty("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrCity");
alert(cityStr);

Get profile of selected image

var link = app.selection[0].graphics[0].itemLink;
var linkXmp = link.linkXmp;
var profile = linkXmp.getProperty("http://ns.adobe.com/photoshop/1.0/", "ICCProfile");
alert(profile);

Read width and height in pixels of the link

var myDoc = app.activeDocument;
var myLink = myDoc.allGraphics[0].itemLink;
var myLinkXmp = myLink.linkXmp;
var myLinkWidth = myLinkXmp.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:ImageWidth");
var myLinkLength = myLinkXmp.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:ImageLength");
alert("Pixel dimentions of the first link:\nWidth: " + myLinkWidth + " pixels\nHeight: " + myLinkLength + " pixels");

Indesign script to automatically insert document title metadata based on file name

Storing custom data into InDesign file via XMP

Extract Metadata with Adobe XMP [Part 1]

Extract Metadata with Adobe XMP [Part 2]

Extract file preview stored in Adobe XMP data

Fill InDesign XMP info from document content

Writing info to link´s metadata in InDesign

Write layer info in metadata in Photoshop

Metadata of links by Martin Fischer

 

Go back to the main InDesign code samples page