🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20086

Page Size and Orientation NOT working

#20086
From: Bill Clements
Date: Wed, 06 Nov 2002 21:27
86 lines
4770 bytes
Hi, 

I'm having a difficult time of setting the page size and orientaion for a new document, and I can't find where I went wrong. Could someone please help, and spot my error? 

The page size I would like is 253mm x 177mm Landscape, with margins of 25mm top and bottom and 6mm Left and Right. 

Here is my failed effort: 

Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.Documents.Add 
Set myDocPreferences = myDocument.DocumentPreferences 
myPageWidth = CDbl(txtPageW.Text) 'myDocument.DocumentPreferences.PageWidth 
myPageHeight = CDbl(txtPageH.Text) 'myDocument.DocumentPreferences.PageHeight 
myDocPreferences.PageWidth = myPageWidth 
myDocPreferences.PageHeight = myPageHeight 
'myPageOrientation = idLandscape 'Exposed, but move it onto Opt Section!!!!! 
myDocPreferences.PageOrientation = idLandscape 
myDocPreferences.WeightChangesBoundingBox = True 
myDocPreferences.PagesPerSpread = 1 'Can be exposed on Form 

Dim myFileSystemObject As FileSystemObject 
'Dim myDocument As InDesign.Document 
'Dim myViewPreferences As InDesign.ViewPreference 
Dim myFiles As Files 
Dim myFolder As Folder 

Set myFileSystemObject = CreateObject("Scripting.FileSystemObject") 

Set myViewPreferences = myDocument.ViewPreferences ' Set the ruler origin to the page origin (i.e., not spread or spine) 
myViewPreferences.RulerOrigin = idPageOrigin ' Make sure that the measurement units are mm, if they aren't already. 
myViewPreferences.HorzMeasurementUnits = idMSMillimeters 
myViewPreferences.VertMeasurementUnits = idMSMillimeters 

myDocument.ZeroPoint = Array(0, 0) ' Reset the zero point. 
'--------------------------------------------------------------------------- 
Rem This will minimise InDesign, to speed up the script 
    If chkMinimise.Value = 1 Then 
        AppActivate "Adobe InDesign 2.0.1" 
        SendKeys "% n" 
        AppActivate "Adobe InDesign 2.0.1" 
    End If 
'---------------------------------------------------------------------------- 

'---------------------------------------------------------------------------- 
'If the Remove Empty Frames from Last Page box is checked, remove empty frames from all pages. 
If chkRemove.Value = 1 Then 
    myRemoveEmptyFrames = True 
Else 
    myRemoveEmptyFrames = False 
End If 
'----------------------------------------------------------------------------- 

myNumberOfRows = Int(txtRows.Text) 'Exposed 
myNumberOfColumns = Int(txtColumns.Text) 'Exposed 
'----------------------------------------------------------------------------- 
' Get the folder name from the text field. 
myFolderName = txtFolderName.Text 'Exposed 
Set myFolder = myFileSystemObject.GetFolder(myFolderName) 

' If there's not folder name, throw an error. 
If myFolderName = "" Then 
    myErrorMessage = "Please select a folder and try again." 
    GoTo myError 
End If 
'------------------------------------------------------------------------------ 
'------------------------------------------------------------------------------ 
myFramesPerPage = myNumberOfRows * myNumberOfColumns 

txtImagesPerPage.Text = myFramesPerPage 'Put it into the txtImagePerPage.Text field (Worked!) 
'------------------------------------------------------------------------------ 
' Get the number of JPG files in the folder... 
myNumberOfFrames = 0 
For Each myFile In myFolder.Files 
    If (InStr(myFile.Name, ".JPG") <> 0) Or (InStr(myFile.Name, ".jpg") <> 0) Or (InStr(myFile.Name, ".TIF") <> 0) Or (InStr(myFile.Name, "tif") <> 0) Then 
        myNumberOfFrames = myNumberOfFrames + 1 
    End If 
Next 
Rem myNumberOfFrames is now set. 
txtTotalImages.Text = myNumberOfFrames 'Put it into text field txtTotalImages.Text 
'------------------------------------------------------------------------------ 
myNumberOfPages = CInt(myNumberOfFrames / myFramesPerPage) 
If myNumberOfPages = 0 Then 
    myNumberOfPages = myNumberOfPages + 1 
End If 
Rem myNumberOf
Technical Details
Message-ID: <1de67ce8.-1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,e817c558ea6d46ce,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-11-06 13:40:02 PST
From: "Bill Clements" <clementsbill@hotmail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Page Size and Orientation NOT working
Message-ID: <1de67ce8.-1@WebX.la2eafNXanI>
Date: Wed, 6 Nov 2002 13:27:33 -0800
Lines: 108
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit