InDesign CS2 - Relink one file to another

I am attempting to set up a function to relink graphics in an InDesign doc from one to another with applescript. I got as far as this and I can’t get any further. I can get a list of the graphics but the relinking section I can’t get past.

tell application "Adobe InDesign CS2"
	set blah to (choose file) as alias
	set usedGraphics to file path of every link of front document as list
	repeat with i from 1 to count items in usedGraphics
		set currentGraphic to item i of usedGraphics as alias
		relink link currentGraphic to link blah
	end repeat
end tell

This forum rocks.
Chuckles :smiley:

not sure why you would want to do this, but I’m sure you have your reasons…

tell application "Adobe InDesign CS2"
	set blah to (choose file) as alias
	set usedGraphics to links of front document as list
	repeat with i from 1 to count items in usedGraphics
		set currentGraphic to item i of usedGraphics
		relink currentGraphic to blah
	end repeat
end tell

I work at a daily newspaper in the prepress dept. We use advertisements week to week with changes each time, and store the ads in a folder per the week it ran. For archiving purposes, each week, with each ad, we would manually copy the pics in a repeating ad from the week we got it to the current week, then relink them. I am figuring out a way to automate this process. I already have had it working for some months using MultiAd Creator, and now im working on setting it up for InDesign.

Thanks for the solution. Greatly appriciated. I am going to post all my major scripts in the code exchange soon…when I finish and debug them. They are all based on our prepress workflow, and save us oodles of time.
Chuckles :smiley: