Skip to main content
Participating Frequently
October 13, 2008
Question

Scripting URL Hyperlinks for Images

  • October 13, 2008
  • 3 replies
  • 635 views
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
This topic has been closed for replies.

3 replies

Inspiring
October 14, 2008
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>
Participating Frequently
October 14, 2008
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
Inspiring
October 13, 2008
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>