Article View: adobe.scripting.indesign
Article #19902Re: Converting PM 6.5 Script to ID 2.0
From: Olav Kvern
Date: Thu, 14 Nov 2002 04:15
Date: Thu, 14 Nov 2002 04:15
101 lines
4584 bytes
4584 bytes
Vincent--
Here's a quick and dirty VBScript version to get you started. Copy the text from this page to NotePad and save is as a text file with the extension .vbs. Provided your IS folks haven't disabled the Windows Scripting Host, you'll be able to run this by double-clicking the script file.
Rem Business card layout
Dim myInDesign
idMSInches = 2053729891
Set myInDesign = CreateObject("InDesign.Application.2.0")
myName = InputBox("Enter a Name:", "Name", "Utena Tenjou")
myTitle = InputBox("Enter a Title:", "Title", "Revolutionary Girl")
myAddress = InputBox("Enter a Street Address:", "Address", "Ohtori Academy")
myPhone = InputBox("Enter a Telephone Number:", "Phone", "(206) 555-1212")
Set myDocument = myInDesign.Documents.Add
Rem Set the measurement units to inches
myDocument.ViewPreferences.HorzMeasurementUnits = idMSInches
myDocument.ViewPreferences.VertMeasurementUnits = idMSInches
Rem Set the page size
myDocument.DocumentPreferences.PageWidth = 7.5
myDocument.DocumentPreferences.PageHeight = 8.5
Rem Set the page margins to .25 inches
Set myPage = myDocument.Pages.Item(1)
myPage.MarginPreferences.MarginTop = 0.25
myPage.MarginPreferences.MarginLeft = 0.25
myPage.MarginPreferences.MarginBottom = 0.25
myPage.MarginPreferences.MarginRight = 0.25
Rem set up the cut marks on the sides
For myMarkCounter = 1 To 2
If myMarkCounter = 1 Then
myLeftEdge = 0
myRightEdge = 0.125
Else
myLeftEdge = 7.325
myRightEdge = 7.5
End If
For myCounter = 1 To 5
myY = 0.25 + ((myCounter - 1) * 2)
Set myLine = myPage.Lines.Add
myLine.StrokeWeight = 0.25
myLine.StrokeColor = myDocument.Swatches.Item("Registration")
Set myPath = myLine.Paths.Item(1)
myPath.EntirePath = Array(Array(myLeftEdge, myY), Array(myRightEdge, myY))
Next
Next
Rem Set up the cut marks on the top and bottom
For myMarkCounter = 1 To 2
If myMarkCounter = 1 Then
myY1 = 0
myY2 = 0.125
Else
myY1 = 8.325
myY2 = 8.5
End If
For myCounter = 1 To 3
myX = 0.25 + ((myCounter - 1) * 3.5)
Set myLine = myPage.Lines.Add
myLine.StrokeWeight = 0.25
myLine.StrokeColor = myDocument.Swatches.Item("Registration")
Set myPath = myLine.Paths.Item(1)
myPath.EntirePath = Array(Array(myX, myY1), Array(myX, myY2))
Next
Next
Rem Add the text frames to hold the business card content
Set myNameFrame = myPage.TextFrames.Add
myNameFrame.GeometricBounds = Array(0.5, 1.5, 0.75, 3.5)
myNameFrame.TextContents = myName
Set myTitleFrame = myPage.TextFrames.Add
myTitleFrame.GeometricBounds = Array(0.75, 1.5, 1, 3.5)
myTitleFrame.TextContents = myTitle
Set myAddressFrame = myPage.TextFrames.Add
myAddressFrame.GeometricBounds = Array(1.25, 1.5, 1.5, 3.5)
myAddressFrame.TextContents = myAddress
Set myPhoneFrame = myPage.TextFrames.Add
myPhoneFrame.GeometricBounds = Array(1.65, 0.25, 1.9, 2.65)
myPhoneFrame.TextContents = myPhone
myGroupArray = Array(myNameFrame, myTitleFrame, myAddressFrame, myPhoneFrame)
Set myGroup = myPage.Groups.Add(, myGroupArray)
Set myNewGroup = myGroup.Duplicate
myNewGroup.Move , Array(0, 2)
Set myNewGroup = myGroup.Duplicate
myNewGroup.Move , Array(0, 4)
Set myNewGroup = myGroup.Duplicate
myNewGroup.Move , Array(0, 6)
Set myGroup = myGroup.Duplicate
myGroup.Move , Array(3.75, 0)
Set myNewGroup = myGroup.Duplicate
myNewGroup.Move , Array(0, 2)
Set myNewGroup = myGroup.Duplicate
myNewGroup.Move , Array(0, 4)
Set myNewGroup = myGroup.Duplicate
myNewGroup.Move , Array(0, 6)
Let me know what happens!
Thanks,
Ole
Technical Details
Message-ID:
<1de68c0a.14@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newspump.sol.net!news-out.cwix.com!newsfeed.cwix.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de68c0a.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,ee4c9e7edd2bcb69 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-11-13 20:44:05 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newspump.sol.net!news-out.cwix.com!newsfeed.cwix.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Converting PM 6.5 Script to ID 2.0 Message-ID: <1de68c0a.14@WebX.la2eafNXanI> Date: Wed, 13 Nov 2002 20:15:53 -0800 References: <1de68c0a.-1@WebX.la2eafNXanI> Lines: 104 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit