🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18139

Re: [VB] Placing Multiple Images into set templates

#18139
From: roberto soto
Date: Fri, 25 Apr 2003 14:49
55 lines
2418 bytes
Hi Brian,

Here the code: I create a folder with 3 images, Img1.jpg, Img2.jpg and Img3.jpg
open a document and create 3 empty pictures rectangles frame (F) any where in the document

The script with place the images there after,

Now just personalize the counter as you need and meabe some error rutine in case the images is not found.

Is important first count how many rectangles you have in the document and after insert the images inside, two loops and is quite fast.

Roberto

===========================

Dim InD As InDesign.Application

Private Sub Command1_Click()
    Dim myRectangles As New Collection
    Dim i As Integer

Counter = 1
    InDFilePattern = "Img"
    IndPath = "C:\Test\"
    InDExt = ".jpg"

Set InD = CreateObject("InDesign.Application.2.0")

If InD.Documents.Count <> 0 Then

Set InDWindow = InD.ActiveWindow
        Set InDSpread = InDWindow.ActiveSpread
        Set InDDocument = InD.ActiveDocument
        Set InDPage = InDDocument.Pages.Item(1)

InDImageNumber = InputBox("How many images do you want placed into the composite?", _
                "Composite Image Count", "15")

For InDCounter = 1 To InDDocument.AllPageItems.Count
            Set InDPageItem = InDDocument.AllPageItems.Item(InDCounter)
            a = TypeName(InDPageItem)
            If TypeName(InDPageItem) = "Rectangle" Then
                myRectangles.Add InDPageItem
            End If
        Next

For i = 1 To myRectangles.Count
            myNumber = Str(i)
            myImage = IndPath & InDFilePattern & Mid$(myNumber, 2, Len(myNumber)) & InDExt
            myRectangles.Item(i).Place myImage
        Next

End If

End Sub
Technical Details
Message-ID: <1de8dd3e.6@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de8dd3e.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,458bf860275b79ec
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-04-25 08:07:46 PST
From: "roberto soto" <roberto1soto@hotmail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: [VB] Placing Multiple Images into set templates
Message-ID: <1de8dd3e.6@WebX.la2eafNXanI>
Date: Fri, 25 Apr 2003 07:49:50 -0700
References: <1de8dd3e.-1@WebX.la2eafNXanI>
Lines: 61
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit