Unlinking graphics in InDesign.

Can anyone tell me why this doesn’t work? I get an error number -1708 in the replies window, but the script continues to run, and the file remains linked in InDesign. (This is just a portion of the code, btw)

place alias (titlePageLogo) on theLogoFrame
			fit theLogoFrame given content to frame
			tell theLogoFrame
				unlink alias (titlePageLogo) of
			end tell

The unlink command is for the link not the frame, so you will need the object reference for the link to embed the image (unlink) into the InDesign file.

tell application "Adobe InDesign CS4"
	set theImage to item 1 of selection -- graphic selected
	set theLink to item link of theImage -- gets the link
	unlink theLink -- embeds the graphic
end tell

So given your example you could make the following changes"

set theImage to place alias (titlePageLogo) on theLogoFrame
fit theLogoFrame given content to frame
unlink (item link of item 1 of theImage) -- ID returns a list above for theImage so we need to get the first item

Hi Jerome.

Sorry for the delay, I’ve been away for a few days.

Thankyou … that worked like a charm. It always seems so obvious once it’s explained clearly!

Many thanks.