InDesign CS2 Hyperlinks

Hello -

We run an automated catalogue producing system, taking information out of FileMaker and putting it into InDesign using XTags and a lot of rather beefy AppleScripts. In this catalogue we have four book jacket images on a page. The images have filenames which are named <13digitISBN>_fc25.tif (for example 7890125123456_fc25.tif); the rectangles containing them have Script Labels Jacket 1 thru Jacket 4.

I am now trying to do the following:

  1. Create a new Hyperlink destination called <13digitISBN>, going to www.foo.com/<13digitISBN>
  2. Apply this Hyperlink destination to the rectangle containing the jacket.

This means that when I make a Smart PDF of my catalogue, the jacket images will be links to a catalogue website.

I can do part 1:

tell application "Adobe InDesign CS2"
	tell active document
		
		tell rectangle "Jacket 1"
			
			set Props to properties of item link of graphic 1
			set TheName to name of Props
		end tell
		
		set TheISBN to text 1 thru 13 of TheName
		set TheURL to "http://www.foo.org/" & TheISBN
		
		try
			make hyperlink URL destination with properties {name:TheISBN, destination URL:TheURL}
		end try
		
	end tell
end tell

But I am having great troubles with part 2. I can’t work out how to actually apply the hyperlink to the jacket. I can’t see anywhere in the properties of the rectangle anywhere to say ‘use this hyperlink’, and I can’t see anywhere in the properties of the hyperlink saying ‘Use this rectangle’!

Any help very gratefully received.

Many thanks,

Hamish

Hello -

Solved. It’s all to do with page item sources, which you can’t view in InDesign. Helpful. As far as I can tell, there’s no page anywhere on the web (!) which has any advice on this one, so I feel slightly warm and glowy for providing an internet first. Hurrah.

Hamish

tell application "Adobe InDesign CS2"
	tell active document
		
		tell rectangle "Jacket 1"
			
			set Props to properties of item link of graphic 1
			set TheName to name of Props
		end tell
		
		set TheISBN to text 1 thru 13 of TheName
		set TheURL to "http://www.foo.org/" & TheISBN
		
		try
			set TheH to make hyperlink URL destination with properties {name:TheISBN, destination URL:TheURL}
		on error
			set TheH to hyperlink URL destination TheISBN
		end try
		
		set TheHSName to "HS" & TheISBN
				
		try
			set TheHS to make hyperlink page item source with properties {name:TheHSName, source page item:rectangle "Jacket 1", hidden:false}
		on error
			set TheHS to hyperlink page item source TheHSName
		end try
		
		make new hyperlink with properties {destination:TheH, source:TheHS, visible:false}
		
	end tell
end tell