3 Replies Latest reply on Sep 7, 2015 3:15 AM by Dirk Becker

    [CS6 Applescript] tag object with existing XMLTag

    tizianofaion

      Hi everyone.

      i have an applescript that creates some text frame into the active document.

      For every of this textFrame i want that scripts use a specific tag to tag the textframe.

      For example i want that the first textFrame has tag "PaginaTipo" associated ( obviously i've created the tag PaginaTipo )

       

      This is the script i'm using

      !

       

      set typeFile to "Samples"

      global typeTag

      set sampleCode to 12101

      tell application "Adobe InDesign CS6"

        set myPub to active document

        tell myPub

        set XMLTags to (every XML tag)

        repeat with tagz in XMLTags

        set theName to name of tagz

        if theName is equal to "PaginaTipo" then

        set typeTag to object reference of tagz

        end if

        end repeat

        log typeTag

        set myEveryItem to every page

        repeat with myItem in myEveryItem

        tell myItem

        set mySamplesTextFrame to make text frame with properties {geometric bounds:{"-23 mm", "0 mm", "-5 mm", "133.646 mm"}}

        set contents of mySamplesTextFrame to typeFile

        set applied font of characters of mySamplesTextFrame to "Impact"

        set font style of characters of mySamplesTextFrame to "Regular"

        set point size of characters of mySamplesTextFrame to 45

        set fill color of characters of mySamplesTextFrame to "Black"

        set markup tag of mySamplesTextFrame to typeTag

        --

        set myCodeTextFrame to make text frame with properties {geometric bounds:{"-23 mm", "140 mm", "-5 mm", "273.646 mm"}}

        set contents of myCodeTextFrame to sampleCode as string

        set applied font of characters of myCodeTextFrame to "Impact"

        set font style of characters of myCodeTextFrame to "Regular"

        set point size of characters of myCodeTextFrame to 45

        set fill color of characters of myCodeTextFrame to "Black"

        exit repeat

        end tell

        end repeat

        end tell

      end tell


      but i got error at line set markup tag of mySamplesTextFrame to typeTag

      Can anyone help me ?

      thanks in advance