6 Replies Latest reply on Apr 20, 2008 9:28 PM by Martin Fischer

    How to List Placed Tiffs into a BY PAGE???

      Dear Scripting team,

      Is there a way to list the name of graphics (links) on each page and make a list like:

      file1.tif Page 1
      file2.tif page 3
      file4.tif page 5
      file5.tif page 8

      I can list the graphic names with this:

      ************************************************************

      Set myInDesign = CreateObject ("InDesign.Application.CS3")

      for each element in myindesign.ActiveDocument.links

      msgbox(element.name)

      next

      ************************************************************

      BUT I can not get the page where the graphic is contained as my list above or say something like... myindesign.ActiveDocument.pages.item(1).links because it give me an error... i mean.. ican't specify the page where I wanto to get the links and also can't know the page number where the element (link) is contained...

      ANY IDEAS?? Thank you!! Thank you!!!
        • 1. Re: How to List Placed Tiffs into a BY PAGE???
          [Jongware] Most Valuable Participant
          >myindesign.ActiveDocument.pages.item(1).links [..] give me an error<br /><br />That's because pages do not have a links property. Whatever manual you saw that in, throw it out, and use the proper Help manual. Pages have an allGraphics property, which conveniently "Lists all graphics contained by the Page." (from the ESTK2 Help). Rather <br />i unconventiently <br />is that this graphic type first contains a link, and the link then contains a filename -- you have to string'em all together by hand.<br /><br />Try this instead. It iterates over all your pages (first loop) and over all images on that page (2nd loop). This one is sure to display the items in order of appearance (which is possibly different when iterating over all links in your document at once).<br /><br />>for (var p=0; p<app.activeDocument.pages.length; p++)<br /><br />>     for (var g=0; g<app.activeDocument.pages[p].allGraphics.length; g++)<br /><br />>          app.activeDocument.selection[0].contents = app.activeDocument.selection[0].contents+"\r"+app.activeDocument.pages[p].allGraphics[g]. itemLink.name+" Page "+app.activeDocument.pages[p].name;<br /><br />[Before running this, draw an empty text frame and place your text cursor in that.]
          • 2. Re: How to List Placed Tiffs into a BY PAGE???
            Level 1
            Thanks for your answer!! At least this give a good idea. I use Vbscript but I think I can understand.

            Do you have a complete guide?? because the scripting guides available show only how to put an image but nothing else... and I couldn't find the CS3 Reference... :(

            If I can't complete it I will let you know... thank you!!!
            • 3. Re: How to List Placed Tiffs into a BY PAGE???
              [Jongware] Most Valuable Participant
              I wouldn't know where to start searching for VBscript ...

              For JS, it's rather sneaky hidden inside the ESTK2 editor, in the Help menu. That didn't quite work for me, so when I found the XML data file, I wrote an XSLT stylesheet to convert it to linked HTML. (That's 3 technojibe terms in a single sentence!) You can download this version from http://www.jongware.binaries.indesigncs3jshelp.zip

              Do note, it's for JS only. VBscript has other case rules.
              • 4. Re: How to List Placed Tiffs into a BY PAGE???
                Level 1
                Hi sipirily,

                The parent of the link is the frame containing the graphic. The parent of the frame is *usually* a page, but it can sometimes be a group, a character, or another page item. If you know that all of your images are placed as independent graphics (i.e., not in groups, not embedded in text, and not pasted inside another frame), then you can use something like this:

                Rem Given a link "myLink"...
                myPageName = myLink.Parent.Parent.Name
                Rem Display information about the link in a message box.
                MsgBox myLink.name & " appears on page " & myPageName

                If your graphics are not independent graphics, you'll need to do a little bit more work--what we call "climbing the parent tree"--to find the page containing the graphic. Let us know, and we'll show you our various solutions to that problem.

                Thanks,

                Ole
                • 5. Re: How to List Placed Tiffs into a BY PAGE???
                  Jukka Lauhalahti
                  Hi!

                  I'm interested this topic too. I have a 1000+inline images placed and i need to "export" links list with page reference. Only solution seems to be scripting.

                  I have done some scripting with applescript but some pointers would be appreciated.
                  • 6. Re: How to List Placed Tiffs into a BY PAGE???
                    Martin Fischer Level 2
                    Hi Jukka,

                    maybe the JS LinkExport_and_PreflightImages_1.2.jsx is of some kind of interest for you.
                    It catches some more info about the links. But you can cut away the info you don't need.

                    http://www.hilfdirselbst.ch/foren/Link_Export_Skript_%2B_%C4nderungen_P343595.html#343595

                    Martin Fischer