Article View: adobe.scripting.indesign
Article #8270Re: Simple scripting (I Hope) :)
From: Iolaire_McFadden
Date: Fri, 20 Oct 2006 13:13
Date: Fri, 20 Oct 2006 13:13
59 lines
2760 bytes
2760 bytes
The following is a very simple script to do this, ID places WMF with no problem. Please note in this code the first page will aways be blank, I'm not taking the time to fix that:-)
' HOW TO
' Place this code in a VB aware app, say the Visual Basic Editor in Excel
' Add a reference to InDesign
' Set the myPath in RunMe, then run
Public myID As InDesign.Application
Public myDoc As InDesign.Document
Public myPage As InDesign.Page
Public myRect As InDesign.Rectangle
Public myPath As String
Public myImage As String
Public loopNum
Public mySizeArray(3)
Sub RunMe()
Set myID = CreateObject("InDesign.Application")
Set myDoc = myID.Documents.Add
' Where are the images?
myPath = "C:\Documents and Settings\imcfadden\Desktop\OCR\images\"
Set fs = CreateObject("Scripting.FileSystemObject")
loopNum = 1
myImage = Dir(myPath)
Do While Not (myImage = "")
create_doc myPath, myImage ' run placing steps
myImage = Dir
loopNum = loopNum + 1
Loop
End Sub
Sub create_doc(myPath, myImage)
'-- NOTE First page will always be blank, this could be fixed, but ...
Set myPage = myDoc.Pages.Add
myID.ViewPreferences.HorzMeasurementUnits = idMSPoints
myID.ViewPreferences.VertMeasurementUnits = idMSPoints
Set myPage = myDoc.Pages.Item(-1)
Set myRect = myPage.Rectangles.Add
fix_sizes Array(36, 36, 756, 576)
myRect.GeometricBounds = mySizeArray
Set myPDF = myRect.Place(myPath + myImage)
myPDF.Item(1).GeometricBounds = mySizeArray()
myRect.Fit (idProportionally)
End Sub
Sub fix_sizes(mySizeArrayStart)
myPageMod = myPage.DocumentOffset Mod 2
If myPageMod = 0 Then
mySizeArray(0) = mySizeArrayStart(0)
mySizeArray(1) = mySizeArrayStart(1)
mySizeArray(2) = mySizeArrayStart(2)
mySizeArray(3) = mySizeArrayStart(3)
Else
mySizeArray(0) = mySizeArrayStart(0)
mySizeArray(1) = mySizeArrayStart(1) + 612
mySizeArray(2) = mySizeArrayStart(2)
mySizeArray(3) = mySizeArrayStart(3) + 612
End If
End Sub
</code?
Technical Details
Message-ID:
<3bc201be.9@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.isoc.lu!news.stben.net!webcrossingReferences:
<3bc201be.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,3e8235dfe12301ad X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Iolaire_McFadden@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: Simple scripting (I Hope) :) Message-ID: <3bc201be.9@webcrossing.la2eafNXanI> Date: Fri, 20 Oct 2006 06:13:25 -0700 References: <3bc201be.-1@webcrossing.la2eafNXanI> Lines: 63 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.isoc.lu!news.stben.net!webcrossing