🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9001

Re: CS1 file path of missing link

#9001
From: Eric
Date: Tue, 19 Sep 2006 22:42
39 lines
2334 bytes
This isn't exactly the script you're asking for, but it is a script that replaces a missing link with a working one. I use it for replacing missing graphics after renaming the files they used to link to.



 
on run 
	tell application "InDesign CS" 
		tell active document 
			--First generate a list of graphics we can possibly replace 
			try 
				set linkNames to {} & (name of every link whose status is equal to link missing) 
			on error 
				display dialog "Apparently there are no missing graphics in this document." buttons "Cancel" default button 1 
			end try

			--Then ask the user to choose from that list 
			set oldGraphic to choose from list linkNames with prompt "Please choose the name of the graphic you wish to replace:" default items {} without multiple selections allowed

			--Next ask them to select a replacement graphic 
			if (count every item of oldGraphic) is equal to 1 then 
				set newGraphicPath to choose file with prompt "Please choose the location of the replacement graphic on the server:" 
				set AppleScript's text item delimiters to ":" 
				set newGraphic to "" & last text item of (newGraphicPath as string) 
			end if

			-- And now replace the oldGraphic with the newGraphic 
			if exists newGraphicPath then 
				display dialog "Okay to replace " & oldGraphic & " with " & newGraphic & "?" 
				-- Relink the files document-wide 
				relink (every link whose name = item 1 of oldGraphic) to newGraphicPath

				--get name of every link whose status = link out of date

				-- Update the newly relinked files document-wide 
				update (every link whose status = link out of date) 
			end if 
		end tell 
	end tell 
end run 
Technical Details
Message-ID: <3bc132da.7@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!ecngs!feeder.ecngs.de!news.germany.com!news.isoc.lu!news.stben.net!webcrossing
References: <3bc132da.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,7cab678820bb9760
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Eric_@_MCA@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: Re: CS1 file path of missing link
Message-ID: <3bc132da.7@webcrossing.la2eafNXanI>
Date: Tue, 19 Sep 2006 15:42:58 -0700
References: <3bc132da.-1@webcrossing.la2eafNXanI>
Lines: 47
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!ecngs!feeder.ecngs.de!news.germany.com!news.isoc.lu!news.stben.net!webcrossing