InDesign searching images on page

We have switched to InDesign from Quark and I am having trouble coming up with the code to do something that was pretty easy to do in Quark.

I want to search through all of the images used in a document and look at their file part to identify which ones are linked to a certain server. When one is identified I want to set it to fit proportionally and centered. I can’t figure out how to look through all of the images on the page.

Anyone done this before?

InDesign CS2 (although we are upgrading to CS3 shortly so if you have a CS3 solution let me know).

Thanks.

Model: G5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

A starting point is:

set OldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
tell application "Adobe InDesign CS2"
	tell document 1
		set TheLinks to every link
		repeat with i from 1 to count of TheLinks
			set TheImage to file path of item i of TheLinks
			set ThePath to ((text items 1 through ((count of text items of TheImage) - 1) of TheImage) as string) & ":"
			--compare ThePath to server path. To just check the server use text item 1
			fit parent of item i of TheLinks given fill proportionally
		end repeat
	end tell
end tell
set AppleScript's text item delimiters to OldDelim
return ThePath

You need to add in the server name or path to check against.

Matt,

here is a nice one liner for CS3:D


set ServerName to "oud"
tell application "Adobe InDesign CS3"
	tell document 1
		fit (parent of every link whose file path contains ServerName) given fill proportionally
	end tell
end tell

Awesome! I was JUST updated to CS3 and that works perfectly.

Thanks a lot.