Translate Ideas and Comments
Choose language:
There was an error during translation

Jason

My feedback

  1. 9 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Jason supported this idea  · 
  2. 9 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Jason supported this idea  · 
  3. 21 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    6 comments  ·  Illustrator (Desktop) Bugs » SDK and Scripting  ·  Flag idea as inappropriate…  ·  Admin →

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    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