1 Reply Latest reply on Dec 22, 2010 2:23 PM by sstanleyau

    Getting the page of a link

    Johnny Krenek

      Background (probably more than you really need to know): We print newsletters. I am using an Applescript in a FileMaker script that imports info about all links in an InDesign document (Account Number - in the file name, and page number) and then enters the page number into the right account. The purpose of this is to check the document to make sure no ads were left out of the newsletter and track the placement of ads so they are rotated fairly each month.

       

      We were using CS3, but now I need it to work in CS5. The script loops through all links and dumps the info about each link into a table in FileMaker. Everything works except the one line that returns the page number of the link. I could explain the whole thing, but all I really need to know is what the new equivalent to one line of Applescript would be:

       

      set LinkPage to name of parent of parent of parent of link LinkNum

       

      I don't get an error. It just returns a blank "".

       

      Here is my current script:

       

      tell application "Adobe InDesign CS5"

      tell document 1

      set LinkNum to 1

      set myPages to count of pages

      repeat until LinkNum is ((count of links) + 1)

      try

      set LinkPath to file path of link LinkNum

      on error

      set LinkPath to "error on link " & LinkNum

      end try

      try

      set LinkPage to name of parent of parent of parent of link LinkNum

      on error

      set LinkPage to "M"

      end try

      tell application "FileMaker Pro"

      create new record at table "Import"

      set contents of field "Path" of record LinkNum of table "Import" to LinkPath

      set contents of field "Page Number" of record LinkNum of table "Import" to LinkPage

      end tell

      set LinkNum to (LinkNum + 1)

      end repeat

      end tell

      end tell

       

       

      I've looked through all the objects and properties, but I can't find the page number. Thanks in advance if you can help.

        • 1. Re: Getting the page of a link
          sstanleyau Level 4

          There has been a change to what constitutes the parent of a page item in CS5, along with the introduction of a new page item property, parent page. So this:

           

          set LinkPage to name of parent of parent of parent of link LinkNum

          should become:

          set LinkPage to name of parent page of parent of parent of link LinkNum