InDesign CC Image relinking problem

Hi Everyone

We are having a problem with InDesign CC. We are trying to use Q2ID to convert Quark 7.5 files to InDesigh CC.
Almost everything working Except the image linking.
Because the Image File Links are broken, Indesign HELPS??? by adding the local HD name to the Link file Path.
Therefore it completely fails when trying to relink.

The path is correct except for the local added part.

So I am trying to use AppleScript to fix the problem and have failed in doing so.
Please look at what I have and point me in the right direction.

Thank you in advance for your help
Oakley

What I have so far:

–I START BY SELECTING AN IMAGE BOX THEN RUN THIS SCRIPT
–IT FINDS THE IMAGE FILE BUT I DON’T KNOW HOW TO GET INDESIGN TO UPDATE IT.

tell application “Adobe InDesign CC”
set imagepath to file path of item link of item 1 of all graphics of selection
set linkName to name of item link of item 1 of all graphics of selection

--This does not work to get scale or positioning 
--I thought I might have to specify this to keep these parameters
set theScale to properties of item link of item 1 of all graphics of selection

end tell

display dialog “Name of the link is <” & linkName & “>” buttons {“Cancel”, “OK”} default button “OK”
–set imagepath to file path of item link of item 1 of all graphics of rectangle 1

–INDESIGN ADDs THE LOCAL HD TO THE PATH NAME THEREFORE IT CAN NEVER UPDATE
–IN MY CASE IT ADDS “Macintosh HD:”
–THIS STRIPS OFF THE INITIAL PATH NAME ADDED BY INDESIGN
if imagepath starts with “Macintosh HD:” then
–display dialog “Local HD Crap” buttons {“Cancel”, “OK”} default button “OK”

set CharCount to number of characters in imagepath
set CleanName to characters 14 thru CharCount of imagepath as string
--display dialog "<" & CleanName & ">" buttons {"Cancel", "OK"} default button "OK"

else
set CleanName to imagepath as string
end if

–THIS VARIFIES THE EXISTANCE OF THE IMAGE FILE it works every time
–tell application “Adobe Photoshop CC”
– open file CleanName
–end tell

–i got these examples from MacScripter
tell application “Adobe InDesign CC”

--THIS DOES NOT WORK
--relink link "Name of Link" to (pathName & "NewFile.ext")
relink link linkName to alias CleanName

    --THIS DOES NOW WORK EITHER
relink link linkName to CleanName

--THIS DOES NOT WORK EITHER EITHER
try
	update link linkName --This still uses the bad Path
	
end try

end tell

–HELP – HOW DO I FIX THIS

Hi Oakman

I stripped out the comments in your script and changed the relink section. This works for me. You need to tell the document to relink, and I put file (rather than alias) to get it to work.


tell application "Adobe InDesign CC"
	set imagepath to file path of item link of item 1 of all graphics of selection
	set linkName to name of item link of item 1 of all graphics of selection
end tell

display dialog "Name of the link is <" & linkName & ">" buttons {"Cancel", "OK"} default button "OK"

if imagepath starts with "Macintosh HD:" then
	set CleanName to characters 14 thru CharCount of imagepath as string
else
	set CleanName to imagepath as string
end if

tell application "Adobe InDesign CC"
	tell document 1
		
		relink link linkName to file CleanName
		
	end tell
end tell

Model: MacBook Pro 2.7 GHz Core i7 16GB RAM
Browser: Safari 537.31
Operating System: Mac OS X (10.8)

Thanks for the help Divster.

Sorry to take so long to get back to you… I got derailed into several other projects and am just getting back to this one.

Oakley