Indesign - CS3 script not working with CS4

Hi,
Below is a script that we use to fix broken links for a specific production.
It works with CS3 but not with CS4.
Doesn’t give any errors but the links aren’t fixed.

Anyone any ideas?

set mainFolder to "TS-Leenbakker:"
tell application "Finder"
	set subFolders to every folder of folder mainFolder as alias list
end tell

tell application "Adobe InDesign CS3"
	tell document 1
		set theLinks to every link whose status is link missing
		repeat with i from 1 to count of theLinks
			set thelink to item i of theLinks
			set theName to name of thelink as Unicode text
			repeat with eachFolder in subFolders
				set newpath to (eachFolder as Unicode text) & theName
				try
					relink thelink to newpath
				end try
			end repeat
		end repeat
	end tell
	beep 2
	display dialog "Klaar, bekijk de links."
end tell

–Peter–

Hi Peter,
can I suggest display a dialog on error, may give you some clue!!!

set mainFolder to "TS-Leenbakker:"
tell application "Finder"
	set subFolders to every folder of folder mainFolder as alias list
end tell

tell application "Adobe InDesign CS3"
	tell document 1
		set theLinks to every link whose status is link missing
		repeat with i from 1 to count of theLinks
			set thelink to item i of theLinks
			set theName to name of thelink as Unicode text
			repeat with eachFolder in subFolders
				set newpath to (eachFolder as Unicode text) & theName
				try
					relink thelink to newpath
				on error theError
					display dialog theError
				end try
			end repeat
		end repeat
	end tell
	beep 2
	display dialog "Klaar, bekijk de links."
end tell

Thanks,
Nik

Good idea!!

Error: (translated to English)

Adobe Indesign CS4 got an error: link id 209 of EPS id 208 of rectangle id 213 of page id 190 of spread id 185 of document" NoName-1 doesn’t understand the relink-message/command.

–Peter–

Hi Peter,
if you apply the same on error to the CS3 script is the error message the same? (presuming that the first folder it looks in for the link doesn’t contain it you should get an error)
Thanks,
Nik

using the script with CS3 doesn’t give an error, it relinks the file just fine.
Guess the scripting language in Indesign CS4 has changed.

–Peter–

Hi Peter,
relink was changed in CS4.

Try to use this:
relink thelink to file (newpath as string)

Greets from
TMA

Hi TMA,
Thanks !!!

–Peter–