var XMP = new File("~/Desktop/XMP.txt"); XMP.open("e"); XMP.write(app.activeDocument.XMPString);
Why can't I write a XMPString to a file? The file stays empty. I can print XMPString using alert, so I feel like I am missing something obvious but I don't see it. Much obliged.
Hello if you want to add new xmp to ai doc, you can use serialize method's XMPMeta object and assign the resul to app.activeDocument.XMPString.
New XMP is saved with document when you save document.
I think you are missing the file close statement i.e.
So if app.activeDocument.XMPString has a value then adding close should write the string to the file
Thanks but still fiel stays empty.
var XMP = new File("~/Desktop/XMP.txt"); XMP.encoding = "UTF-8"; XMP.open("e"); XMP.write(app.activeDocument.XMPString); XMP.close;
Thsnks, it works!!