2 Replies Latest reply on Sep 10, 2015 7:54 AM by andrewh2015739

    Set number of pages in custom XML - InDesign Applescript

    andrewh2015739

      Hi,

       

      Please see my applescript below.

       

      I am trying to write the number of pages within an InDesign document into my custom XMP field.

       

      property pageno : ""

      property xmpDomain : "http://myxmp.com/xmp/1.0/"

       

      (*================================

                                  Get XMP                          

      ================================*)

      on getXMP(thepath)

        global xmpDomain

        tell application "Adobe InDesign CC 2014"

        tell metadata preferences of active document

        set thevalue to get property namespace xmpDomain path thepath

        end tell

        end tell

      end getXMP

       

      (*================================

                                  Set XMP                          

      ================================*)

      on setxmp(thepath, thevalue)

        global xmpDomain

        tell application "Adobe InDesign CC 2014"

        tell metadata preferences of active document

        set property namespace xmpDomain path thepath value thevalue

        end tell

        end tell

      end setxmp

       

       

      tell application "Adobe InDesign CC 2014"

        get number of pages of active document

        set pageno to the result

      end tell

       

      set pagenumber to my getXMP("pagenumber")

       

      set mypagenumber to pageno

       

      if mypagenumber = pageno then

        my setxmp("pagenumber", pageno)

      end if


      but i get the following error message, what am i doing wrong?

       

      error "Adobe InDesign CC 2014 got an error: Invalid value for parameter 'value' of method 'set property'. Expected string, but received 1." number 30477