Article View: adobe.scripting.indesign
Article #1142Re: CS4 fails to Relink images
From: Olav_Kvern
Date: Tue, 17 Feb 2009 23:16
Date: Tue, 17 Feb 2009 23:16
29 lines
1842 bytes
1842 bytes
Hi Sheldon,
re: " I was told by Adobe support that the two can not co-exist on the same machine."
That's incorrect. I wonder where in the world they got that idea.
There's always a danger, when iterating through links, that you'll end up pointing at an object reference that is no longer valid. When you relink a link, the original link object is destroyed and a new link object is created. The links collection, therefore, shuffles. Does your problem go away if you iterate in reverse order?
Also, it looks to me as if the Relink method now wants a File object (as shown in the JavaScript version above), rather than just a string. Here's an example in VBSCript form.
Set myInDesign = CreateObject("InDesign.Application.CS4")
Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set myDocument = myInDesign.Documents.Item(1)
For X = myDocument.Links.Count To 1 Step -1
Set myLink = myDocument.Links.Item(X)
strFile = "C:\test.jpg"
Rem If Not myLink.Status = idLinkStatus.idNormal Then
If strFile <> myLink.FilePath Then
myLink.Relink myFileSystemObject.GetFile(strFile)
myLink.Update
End If
End If
Next
Thanks,
Ole
Technical Details
Message-ID:
<59b7e4e5.5@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7e4e5.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,e0a4293cc33906b2 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Olav_Kvern@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: CS4 fails to Relink images Message-ID: <59b7e4e5.5@webcrossing.la2eafNXanI> Date: Tue, 17 Feb 2009 15:16:38 -0800 References: <59b7e4e5.-1@webcrossing.la2eafNXanI> Lines: 33 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit