VBScript. Adobe CS5 Server
Pubblicità
Pubblicità
Adobe InDesign CS5 Server Scripting Guide
Constructing a document 20
VBScript
Enter the following code in your script or text editor, or open the
DocumentConstruction.vbs
tutorial script.
Set myInDesign = CreateObject("InDesign.Application")
Rem Create a new document.
Set myDocument = myInDesign.Documents.Add()
Rem Set the measurement units and ruler origin.
myDocument.ViewPreferences.HorizontalMeasurementUnits = idMeasurementUnits.idPoints
myDocument.ViewPreferences.VerticalMeasurementUnits = idMeasurementUnits.idPoints
myDocument.ViewPreferences.RulerOrigin = idRulerOrigin.idPageOrigin
Rem Get a reference to the first master spread.
Set myMasterSpread = myDocument.MasterSpreads.Item(1)
Rem Get a reference to the margin preferences of the first page in the master spread.
Set myMarginPreferences = myMasterSpread.Pages.Item(1).MarginPreferences
Rem Now set up the page margins and columns.
myMarginPreferences.Left = 84 myMarginPreferences.Top = 70 myMarginPreferences.Right = 70 myMarginPreferences.Bottom = 78 myMarginPreferences.ColumnCount = 3 myMarginPreferences.ColumnGutter = 14
Rem Page margins and columns for the right-hand page.
Set myMarginPreferences = myMasterSpread.Pages.Item(2).MarginPreferences
myMarginPreferences.Left = 84 myMarginPreferences.Top = 70 myMarginPreferences.Right = 70 myMarginPreferences.Bottom = 78 myMarginPreferences.ColumnCount = 3 myMarginPreferences.ColumnGutter = 14
Adding a baseline grid
:
Now that we have a master spread set up, we add a baseline grid. Add the following script lines (from the appropriate language) to the end of the script you created earlier. Here is a diagram (with the scripting terms shown in their JavaScript form): document gridPreferences baselineDivision baselineStart baselineGridShown
AppleScript
set myGridPreferences to grid preferences set baseline division of myGridPreferences to 14 set baseline start of myGridPreferences to 70 set baseline grid shown of myGridPreferences to true
Scarica
Pubblicità