(*
Attempt to make a script to automatically relink missing links. All links are on a server volume.
I moved thousands of images from one server volume to another. That's why I need this script.
Can anyone tell me what goes wrong here? Or answer Questions 1, 2 and 3?
*)
tell application "Adobe InDesign CS5"
tell document 1
set allLinks to (every link whose status is link missing)
if (count of allLinks) > 0 then
repeat with thisLink in allLinks
set props to properties of thisLink
set padje to get file path of props -- seems to be a POSIX path. Q1: Why does the link info in the InDesign CS5 links panel sometimes display a posix path and sometimes an applescript path?
if padje contains "KS_Documenten/Projecten_NZ" then
set AppleScript's text item delimiters to "KS_Documenten/Projecten_NZ"
set newlink to text items of padje
set AppleScript's text item delimiters to "Klanten_A_Z/T" -- part of the new path to the file
set newlink to newlink as text -- Q2: why does this not compile with "as string" instead of "as text"
set AppleScript's text item delimiters to ""
relink thisLink to newlink -- Q3: why does this NOT work? Error is: Adobe InDesign CS5 got an error: Invalid value for parameter 'to' of method 'relink'. Expected alias or string or string, but received "/Volumes/Klanten_A_Z/T/TopClass/• Vaste Items/Logo topclass group wit.ai".
end if
end repeat
end if
end tell
end tell
Bert.