re-link /swap images in Indesign CS3

Can anyone help me with the following:

I have a lot of images with the extension .eps or .psd, the lowres images of these files are called .eps.lay or .psd.lay
What I would like is to have a script that replaces those lowres images with the highres ones.
The lowres and highres images are always in the same folder.

Thanks in advance.

–Peter–

I don’t have time to write the whole thing but I can get you started. The basic form to relink is:

relink link “Name of Link as it appears in the Link palette” to (full path to the new link file)

tell application "Adobe InDesign CS3"
		tell document 1
				relink link "Name of Link" to (pathName & "NewFile.ext")
				try
					update link "Name of Link"  --sometimes the new link comes up modified. I don't know why.
				end try
		end tell
	end tell

Peter:

I don’t know what kind of environment you’re using this in but this is what OPI is for. Have you considered looking into this?

Jim Neumann
BLUEFROG

Thanks soo far.
One qestion though…

How do I define the variable “pathName”