Article View: adobe.scripting.indesign
Article #19279problem Batch Change of Link Path's(VB)
From: Iolaire McFadden
Date: Thu, 02 Jan 2003 17:10
Date: Thu, 02 Jan 2003 17:10
27 lines
2126 bytes
2126 bytes
Hello, Please could someone help me, I'm trying to write a code to run through a document and change the file names within each link. So C:\WAS logo.pdf would become C:\CHI logo.pdf. The following script seems to work except it only changes the name on about the first 12 links, and leaves the other 24 unchanged. I think I'm grabbing each link based on it's item number.
Sub update_links()
' update the links and saves as pdf
Dim linkcount
Set myInDesign = CreateObject("InDesign.application.2.0")
myInDesign.Open ("C:\Indesign\template.indd")
Set myDocument = myInDesign.ActiveDocument
linkcount = myDocument.Links.Count
region_code = "CHI"
' loop through all of the links
For linkloop = 1 To linkcount
' to fingure out what path it is on
currentpath = myDocument.Links.Item(linkloop).Path
' replace the market code in the PDF
currentpath = Replace(currentpath, "WAS", region_code)
' change the link
myDocument.Links.Item(linkloop).Relink (currentpath)
Set idLink = myDocument.Links.ID(linkloop).Update
Next
End Sub
Can anyone provide me with suggestions on how to proceed or what I'm doing wrong?
Thank you,
iolaire
PS if the formatting is off on this post I'll edit it on the website ASAP so the code is readable.
Technical Details
Message-ID:
<1de73425.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,68c34dc73f9dcdad,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-02 09:38:32 PST From: "Iolaire McFadden" <imcfadden@costar.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: problem Batch Change of Link Path's(VB) Message-ID: <1de73425.-1@WebX.la2eafNXanI> Date: Thu, 2 Jan 2003 09:10:13 -0800 Lines: 25 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit