🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16592

Re: Images

#16592
From: Iolaire McFadden
Date: Wed, 27 Aug 2003 14:16
63 lines
3137 bytes
Here is a chunk of code that looks for links to PDF files. You should be able to change it to fit your needs.
Good luck,
iolaire

Public myInDesign As InDesign.Application
Public myDocument As InDesign.Document
Public myjunk
Sub convert_links_to_eps()
' update certain links and saves as eps
Dim linkcount
Set myInDesign = CreateObject("InDesign.application.2.0")
myInDesign.Open ("C:\template.indd")
Set myDocument = myInDesign.ActiveDocument
linkcount = myDocument.Links.Count
' loop through the links backwards, you have to do this b/c
' as you update a link it becomes the last link
' i.e. you have 10 links, update #1 it becomes #10
' if you update #10, it stays #10 and you move to #9 next
For linkloop = linkcount To 1 Step -1

myjunk = myDocument.Links.Item(linkloop).Path

' Check that it's not the company's eps logo (I think I'm saving time by skipping)
If UCase(myjunk) <> "\\DRIVE1\COMPANY_LOGO.EPS" Then



lngPos_ = InStrRev(UCase(myjunk), "PHOTOPAGE")
        ' Determine whether portion of string includes PHOTOPAGE
        If lngPos > 0 Then
            ' Check to see if the file name ends with PDF
            Set fso = CreateObject("Scripting.FileSystemObject")
            path_count = Len(myjunk)
            ex_start = path_count - 3
            ex_cont = Mid(myjunk, ex_start, 4)

If UCase(ex_cont) = ".PDF" Then
            'check to see if file exists
            If fso.FileExists(myjunk) Then
            ' so if the file exists I call another subroutine (convert_PDF_to_EPS)
            ' to convert the
            ' PDF to EPS using Illustrator
            convert_PDF_to_EPS
            ' then change link path, relink, and update
            ' second step with lowercase pdf may be unnecessary
            myjunk = Replace(myjunk, ".PDF", ".EPS")
            myjunk = Replace(myjunk, ".pdf", ".EPS")
            myDocument.Links.Item(linkloop).Relink (myjunk)
            Else
            'file doesn't exist, do nothing to prevent error
            End If
            Set fso = Nothing
        Else
        'not PHOTOPAGE - do nothing
        End If
    Else
        ' if not figs do nothing
    End If
Else
' if it is eps logo do nothing
End If
Next
End Sub
Technical Details
Message-ID: <2ccd1193.4@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeeds.sol.net!newsengine.sol.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccd1193.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,3ca4d0049e23b255
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-08-27 07:37:49 PST
From: "Iolaire McFadden" <imcfadden@costar.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeeds.sol.net!newsengine.sol.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: Images
Message-ID: <2ccd1193.4@webx.la2eafNXanI>
Date: Wed, 27 Aug 2003 07:16:47 -0700
References: <2ccd1193.-1@webx.la2eafNXanI>
Lines: 66
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit