Jason

My feedback

3 results found

  1. 11 votes
    How important is this to you?
    Jason supported this idea  · 
  2. 11 votes
    How important is this to you?
    Jason supported this idea  · 
  3. 22 votes
    How important is this to you?
    An error occurred while saving the comment
    Jason commented  · 

    Illustrator 25.4 update broke scripts that try to read XMP data that worked in previous versions of Illustrator.

    It appears to be getting the error on this line:

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

    Below is an example script to read font data that worked in 25.3, but errors loading the library in 25.4

    // load XMP Library

    function loadXMPLibrary() {

    if (!ExternalObject.AdobeXMPScript) {

    try {

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

    } catch (e) {

    alert('Unable to load the AdobeXMPScript library!');

    return false;

    }

    }

    return true;

    }

    // unload XMP Library

    function unloadXMPLibrary() {

    if (ExternalObject.AdobeXMPScript) {

    try {

    ExternalObject.AdobeXMPScript.unload();

    ExternalObject.AdobeXMPScript = undefined;

    } catch (e) {

    alert('Unable to unload the AdobeXMPScript library!');

    }

    }

    }

    // list used fonts

    function list_fonts () {

    var doc = app.activeDocument;

    var fontsInfo = [];

    loadXMPLibrary ();

    fontsInfo.push (getFontsInfo (doc.fullName));

    unloadXMPLibrary ();

    var info = fontsInfo.join ('\n\n');

    return info;

    }

    // search used fonts

    function getFontsInfo(file) {

    var arr = [],

    xmpFile,

    oXmp,

    fontNumber,

    i,

    path,

    fontfamily,

    fontface,

    ns = 'http://ns.adobe.com/xap/1.0/t/pg/';

    xmpFile = new XMPFile(file.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);

    oXmp = xmpFile.getXMP();

    fontNumber = oXmp.countArrayItems(ns, 'xmpTPg:Fonts');

    xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);

    if (fontNumber) {

    for (i = 1; i <= fontNumber; i++) {

    path = XMPUtils.composeArrayItemPath(ns, 'xmpTPg:Fonts', i);

    fontfamily = oXmp.getStructField(ns, path, XMPConst.TYPE_FONT, 'fontFamily');

    fontface = oXmp.getStructField(ns, path, XMPConst.TYPE_FONT, 'fontFace');

    arr.push([fontfamily+' '+fontface]);
    }
    }

    return arr.join(', ');

    }

    alert ("Fonts used in this document: \n" + list_fonts ());

    Jason shared this idea  · 

Feedback and Knowledge Base