Article View: adobe.scripting.indesign
Article #16645Re: [VBS] Printing a Page Range
From: Paul Jurgens
Date: Thu, 21 Aug 2003 20:27
Date: Thu, 21 Aug 2003 20:27
44 lines
2501 bytes
2501 bytes
Below is a slightly more useful version that pops up a "list" of all the document's master page spreads instead of naming a specific spread in the script. You simply need to delete all but one of the master spread names (and all of the semi-colons) and click OK.
I am sure that it could be a much more clean selection list in Visual Basic but this was the only way that I could figure out using VBScript. (If any other ideas, I would welcome them.)
Regards,
Paul
Dim myInDesign
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.ActiveDocument
REM Count the pages and master spreads
numPages = myDocument.Pages.Count
numMasters = myDocument.MasterSpreads.Count
REM Create rough list of master spreads
For m = 1 To numMasters
MasterList = MasterList & ";" & myDocument.MasterSpreads.Item(m).Name
Next
ValidName = 0
REM Select a master and determine if valid
SelectedMaster = InputBox("Below is a list of all the master spreads in this document." & Chr(13) & "Delete all but the one you will use.", "Select Master Spread", MasterList)
For m = 1 To numMasters
If SelectedMaster = myDocument.MasterSpreads.Item(m).Name Then
ValidName = 1
REM Cycle through pages
For p = 1 To numPages
Set myPage = myDocument.Pages.Item(p)
REM If correct master, print page
If myPage.AppliedMaster.Name = SelectedMaster Then
myDocument.PrintPreferences.PageRange = myPage.Name
myDocument.PrintOut idPrintWithoutDialog
End If
Next
End If
Next
If ValidName = 0 Then
MsgBox "The master spread name was not valid.", 48, "Error"
End If
Technical Details
Message-ID:
<2cccfedc.4@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2cccfedc.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,a492f3714138d31a X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-08-21 13:40:04 PST From: "Paul Jurgens" <flynfall@yahoo.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: [VBS] Printing a Page Range Message-ID: <2cccfedc.4@webx.la2eafNXanI> Date: Thu, 21 Aug 2003 13:27:28 -0700 References: <2cccfedc.-1@webx.la2eafNXanI> Lines: 52 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit