-- I've never seen that UI feature scripted, so I always use something like this:
set newFD to "HardDrive2:Links-New:" -- new source folder of links
tell application "Adobe InDesign CS6"
tell document 1
set eflag to 0
set myBrokenLinks to object reference of (every link whose status is link missing)
display dialog ("No missing links found.")
set eflag to 1
if eflag = 0 then
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
repeat with i from 1 to count of myBrokenLinks
set oldFP to (file path of item i of myBrokenLinks) as string
set newFP to (newFD & (last text item of oldFP)) as string
relink item i of myBrokenLinks to alias newFP
update every link
set AppleScript's text item delimiters to oldTIDs
Thank you, but I cylce thru 200-400 links, and for each link i "scan" the file path and do various searches onto that string and change it to specific folders, so handling 300 links is kinda slow. But if InDesign could look in every relinked folder for more matches, i could save up 150 links.
Look at my screenshot below. This broken link would handle in a single click, but with scripting i have to cycle thru all my links.
Also this file is merged together in a folder with many logos, if InD would "look for matching broken links in this folder" it would find 100-ish matches.
But if i cant script that – thats a pity…maybe someone else has any ideas how to achiv this with ease.
Shirley Hopkins would know. I noticed she posted an answer to a different question today, so maybe she will offer a definitive answer here.
ps I just had a thought: another possibility is the invoke menu action command.
Actually theres no way to script a selection there, neither there is a menu action doing this.
I can confirm this. Just checked all available menu actions in InDesign.
But we could try a different strategy (not tested, just an idea):
1. Just relink one image in the document.
2. Save the document.
3. Open the document.
And by opening the document we have the chance to relink all missing images by a different preference one can set by scripting:
in the LinkingPreferences of the app.
Maybe that will help?
To expand my idea:
1. Store all unique path names of all linked images in an associative array
2. Use that array to check and relink the first occassions of these images found in the links collection
3. Save the document
4. Close the document
5. Open the document with the preference findMissingLinksAtOpen set to true
6. Save the document
Its a good attemp, but these docs aren't as fast to open/close.
What I read so far, is that he checks for multiple links by checking paths and counting, and then process theses links differently.
I have no time on my hands today, but I will try to mimic that in AS tomorrow…if i understand what he's doing (in JS)
if my basic idea works out, you "only" have to open one particular document two times.
And maybe there is a chance to open documents more quickly as you are doing it right now.
There are some document and app preferences we can put to use here. Mainly in the area of showing/or not showing the image preview proxies.
Also showing only greeked text.
Even not showing the frame of an opened document.
This is an argument in open() method for documents.