Copy link to clipboard
Copied
Using the below code snippet tries to write metadata but fails. An XMP sidecar is created but the template data is not written to it. Please note the differences below it, the first history item uses the script and the second uses the Metadata panel menu item (which works correctly.)
try{
var thumbs = app.document.selections;
var fileMeta = thumbs[0].synchronousMetadata; //new metadata object
fileMeta.applyMetadataTemplate('2022', 'append');
}
catch(e){
alert(e + e.line);
}
<xmpMM:History>
<rdf:Seq>
<rdf:li
stEvt:action="saved"
stEvt:instanceID="xmp.iid:9804ae16-b19f-6145-b31f-3197fea74e2f"
stEvt:when="2022-10-28T15:45:26-04:00"
stEvt:softwareAgent="Adobe Photoshop Camera Raw 15.0"
stEvt:changed="/metadata"/>
<rdf:li
stEvt:action="saved"
stEvt:instanceID="xmp.iid:67edb6b7-cdb4-de46-bf01-0083752faf56"
stEvt:when="2022-10-28T15:45:26-04:00"
stEvt:softwareAgent="Adobe Photoshop Camera Raw 15.0 (Windows)"
stEvt:changed="/metadata"/>
</rdf:Seq>
</xmpMM:History>
Have something to add?