3 Replies Latest reply on Oct 14, 2008 1:52 PM by sstanleyau

    Scripting URL Hyperlinks for Images

      Hi,

      Been scripting for a long time, relatively new to InDesign though...I'm trying to make a script that creates unique hyperlinks for all of the images in a document. I can get a list of all the images, but the problem seems to be that I can't seem get the syntax (or maybe references) correct to create the link.

      Here's where I'm at:

      make hyperlink with properties {destination:itemURL, source:testImage}

      I get this error:

      Adobe InDesign CS3 got an error: Invalid value for parameter 'hyperlink source' of event 'make'. Expected hyperlink page item source or hyperlink text source, but received image.

      If I have a reference to an image, can I get the page item reference somehow to put in as the source? Or do I need to rewrite the script so it finds all the page items, checks if they are images, and then creates hyperlinks for the ones that are images?

      Thanks in advance for your kindness and wisdom,

      --Danny
        • 1. Re: Scripting URL Hyperlinks for Images
          sstanleyau Level 4
          You have to make the hyperlink page item source and hyperlink URL<br />destination first. So:<br /><br />        set theSource to make hyperlink page item source with properties<br />{source page item:<ref to your item>}<br />        set theDest to make hyperlink URL destination with properties<br />{name:"Whatever", destination URL:"http://www.blahblah.com"}<br />make hyperlink with properties {destination: theDest , source:theSource}<br /><br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
          • 2. Re: Scripting URL Hyperlinks for Images
            Level 1
            No good deed goes unpunished...so...<br /><br />I think I have everything in place, except the value going in for <ref to your item> would be something like this:<br /><br />image id 355 of rectangle id 354 of page id 194 of spread id 173 of document "Dummy.indd"<br /><br />Which gives me this error:<br /><br />"Expected page item, but received image."<br /><br />So now I'm trying to get the "Page Item," which in this case I'm assuming is the rectangle, and I've tried every syntax variation I can think of and just can't get the script to give me the rectangle if I have the image.<br /><br />I hope I'm at least on the right track here. The question is, how do I get the rectangle ref from the image ref?<br /><br />--Danny
            • 3. Re: Scripting URL Hyperlinks for Images
              sstanleyau Level 4
              On 15/10/08 1:00 AM, "Danny Arsenault" <member@adobeforums.com> wrote:<br /><br />> how do I get the rectangle ref from the image ref<br /><br />Get the parent of it.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>