Article View: adobe.scripting.indesign
Article #19887How do I select all?
From: Vincent Macaluso
Date: Wed, 20 Nov 2002 16:52
Date: Wed, 20 Nov 2002 16:52
74 lines
3481 bytes
3481 bytes
I have a document (business card layout) that is 3.5i x 2i.
I'm trying to write a script that will, while I have the document open, select all text blocks. Then, open a new document, and place the blocks in the top left corner of the margins.
Next, I need it to select all again, then step and repeat once to the left 3.5 inches. Then, select all again, and step and repeat 4 times straight down 2 inches. Basically creating a 10-up business card layout.
This is what I have so far, with some psudeocode that I wrote in PMScript (in brackets): (Sorry for the PScript, but it's all I could write to explain what I'm trying to do)
I just can't seem to find ANYTHING in the guidebook. Is it the object-orientedness of VB that is confusing me? Do I have to name all of my text blocks some way, then say:
mySelection = array(nameBlock, addressBlock, phoneBlock)
?
then paste mySelection into the new document? If so, how do I name already existing blocks? I've looked in the ID Scripting guide, but I can't find anything on this.
'''''''' CODE ''''''''
[BEGIN PMSCRIPT
'select all in current page, I cant find how to do this.
--Is anything selected already?
getPMState >> pmState
--if nothing is selected, select all.
if pmState=2
selectAll
endif
--now copy it to the clipboard and open a new page.
copy
[END PMSCRIPT
Rem Business card layout
Dim myInDesign
'I got this from someone else, but
'it was giving errors so I commented it out
'idMSInches = 2053729891
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.Documents.Add
Rem Set the measurement units to inches
'I got this from someone else, but
'it was giving errors so I commented it out
'idMSInches = 2053729891
'myDocument.ViewPreferences.HorzMeasurementUnits = idMSInches
'myDocument.ViewPreferences.VertMeasurementUnits = idMSInches
Rem Set the page size
myDocument.DocumentPreferences.PageWidth = 8.5
myDocument.DocumentPreferences.PageHeight = 11
Rem Set the page margins
Set myPage = myDocument.Pages.Item(1)
myPage.MarginPreferences.MarginTop = 0.93
myPage.MarginPreferences.MarginLeft = 1.149
myPage.MarginPreferences.MarginBottom = 0.5
myPage.MarginPreferences.MarginRight = 0.5
[BEGIN PSCRIPT
--paste our top row. 2 cards, 3.5 inches apart.
multiplepaste 2,3.5i,0i
--select the top row, and copy it 2 inches downwards 4 times.
selectAll
copy
multiplepaste 4,0i,2i
--we cant have it all off-center and stuff, now can we?
--select all ten cards and move them flush with the top left
--corner formed by our guidelines.
selectAll
move left, guide 1
move top, guide 1
[END PMSCRIPT
Technical Details
Message-ID:
<1de6ae99.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!news-hub.siol.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,2c531b5dde9d3835,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-11-20 09:08:06 PST From: "Vincent Macaluso" <nolageek@yahoo.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!news-hub.siol.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: How do I select all? Message-ID: <1de6ae99.-1@WebX.la2eafNXanI> Date: Wed, 20 Nov 2002 08:52:36 -0800 Lines: 84 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit