Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Scripting to Pull Metadata

Return to Member Forum

  • Author
    Posts
    • #82163
      Jeremy Brown
      Member

      Hi all again.
      Is is possible to pull information out of the metadata via scripting?
      Here’s what I have in the Description field of the File Info:
      ver=1.10, layout=OSP_Wild_Crops, id=209P

      I need to pull out the version # and place it into a text box so that I can use that in a text variable. I’d rather place the version # one place (File Info) and have it appear in the footer of every page.

      Is this possible? Let me know if I’m thinking too much beyond ID’s scope ? I know a bit of JS and am familiar with scripting, but don’t know the particulars yet of how to do what I need.

      Thanks.

    • #82164
      Peter Kahrel
      Participant

      Something like this:

      versionNumber = '';
      descr = app.activeDocument.metadataPreferences.description;
      if (descr !== '') {
        version = descr.match (/ver=([\d.]+)/);
        if (version !== null) {
          versionNumber = version[1];
        }
      }

      Get the description field from the document’s metadata object
      Match digits and dots following ‘ver=’
      If there is a match, it’s an array, you want item 1

      Peter

    • #82177
      Jeremy Brown
      Member

      Hi Peter.
      Thanks for the information. I’ll work it out.

      Thanks.

Viewing 2 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads