Article View: adobe.scripting.indesign
Article #19281Re: problem Batch Change of Link Path's(VB)
From: Iolaire McFadden
Date: Thu, 02 Jan 2003 19:32
Date: Thu, 02 Jan 2003 19:32
27 lines
2157 bytes
2157 bytes
Ok, a little time and everything becomes clear - I solved my problem - InDesign changes the order of links as they are updated the updated item is moved to the end, so the item number changes, item 1 is updated, moves to item 45, so then item 2 is item 1 and when you try to grab item 2 you get the old item that was numbered 3.
So I needed to grab the items in reverse order, highest to lowest.
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 = linkcount To 1 Step -1
' to figure 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
It works like a charm now!
Thanks,
iolaire
Technical Details
Message-ID:
<1de73425.0@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!news-in.nuthinbutnews.com!news.stealth.net!news.stealth.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de73425.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,68c34dc73f9dcdad X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-02 11:38:07 PST From: "Iolaire McFadden" <imcfadden@costar.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!news-in.nuthinbutnews.com!news.stealth.net!news.stealth.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: problem Batch Change of Link Path's(VB) Message-ID: <1de73425.0@WebX.la2eafNXanI> Date: Thu, 2 Jan 2003 11:32:09 -0800 References: <1de73425.-1@WebX.la2eafNXanI> Lines: 22 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit