3 - 2002
Script 2-1. Пополосный вывод ps-файлов
‘ Объявление объектов и переменных
Dim myInDesign As InDesign.Application
Dim myDocument As InDesign.Document
Dim myPages As InDesign.Pages
Dim myPage As InDesign.Page
Dim myPrintStyles As InDesign.PrinterStyles
Dim myPrintStyle As InDesign.printerStyle
Dim myPrintPreference As InDesign.PrintPreference
Dim strCurrentPage As String
Dim CurrentPage As Long
Private Sub Form_Load()
‘ Инициализация объектов
Set myInDesign = CreateObject(“InDesign.Application.2.0”)
Set myDocument = myInDesign.ActiveDocument
Set myPrintPreference = myDocument.PrintPreferences
Set myPages = myDocument.Pages
Set myPrintStyles = myInDesign.PrinterStyles
‘ Инициализация cписка стилей печати
PrintStyle.Clear
For Each myPrintStyle In myPrintStyles
PrintStyle.AddItem myPrintStyle
Next
PrintStyle.RemoveItem (0)
PrintStyle.ListIndex = 0
‘ Инициализация Диапазона Страниц
FirstPage.Text = myDocument.Pages.Item(1).Name
LastPage.Text = myDocument.Pages._
Item(myDocument.Pages.Count).Name
‘ Инициализация параметров печати
CheckPerPages.Value = 1
CheckPerInk.Value = 0
End Sub
Private Sub PrintStyle_Change()
Set myPrintStyle.Name = PrintStyle.Text
End Sub
Private Sub StartButton_Click()
‘ Определяем стиль печати
myPrintPreference.ActivePrinterStyle = Me.PrintStyle.Text
Set myPrintStyle = myInDesign.PrinterStyles.Item(PrintStyle.Text)
‘ Определяем диапазон печатаемых страниц
myFirstPage = Val(Me.FirstPage.Text)
myLastPage = Val(Me.LastPage.Text)
‘ Запрещаем покрасочную печать при композитном выводе
If myPrintStyle.ColorOutput < idInRIPSeparations Then
Me.CheckPerInk.Value = 0
End If
‘ Постраничная печать
For CurrentPage = myFirstPage To myLastPage
strCurrentPage = Format(CurrentPage)
‘ Выводим сообщение о печати
MessageString.Caption = “Печатается “ & strCurrentPage &_
“ страница”
myPrintPreference.PageRange = strCurrentPage
myPrintStyle.AllPrintersMarks = True
myPrintStyle.FontDownloading = idComplete
‘ Формируем имя файла печати
MsgBox (Str(Len(strCurrentPage)))
MsgBox (Str(Len(Me.LastPage.Text)))
While Len(strCurrentPage) < Len(Me.LastPage.Text)
strCurrentPage = “0” & strCurrentPage
Wend
strCurrentPage = Prefix.Text & strCurrentPage
If Me.CheckPerInk.Value = 1 Then
‘ Печать голубой краски
myPrintStyle.PrintCyan = True
myPrintStyle.PrintMagenta = False
myPrintStyle.PrintYellow = False
myPrintStyle.PrintBlack = False
myPrintStyle.PrintFile = strCurrentPage & “c.ps”
myDocument.PrintOut idPrintWithoutDialog, myPrintStyle
‘ Печать пурпурной краски
myPrintStyle.PrintCyan = False
myPrintStyle.PrintMagenta = True
myPrintStyle.PrintYellow = False
myPrintStyle.PrintBlack = False
myPrintStyle.PrintFile = strCurrentPage & “m.ps”
myDocument.PrintOut idPrintWithoutDialog, myPrintStyle
‘ Печать желтой краски
myPrintStyle.PrintCyan = False
myPrintStyle.PrintMagenta = False
myPrintStyle.PrintYellow = True
myPrintStyle.PrintBlack = False
myPrintStyle.PrintFile = strCurrentPage & “y.ps”
myDocument.PrintOut idPrintWithoutDialog, myPrintStyle
‘ Печать черной краски
myPrintStyle.PrintCyan = False
myPrintStyle.PrintMagenta = False
myPrintStyle.PrintYellow = False
myPrintStyle.PrintBlack = True
myPrintStyle.PrintFile = strCurrentPage & “k.ps”
myDocument.PrintOut idPrintWithoutDialog, myPrintStyle
Else
‘ Печать всех красок в один файл
myPrintStyle.PrintFile = strCurrentPage & “.ps”
myDocument.PrintOut idPrintWithoutDialog, myPrintStyle
End If
Next
Unload Me
End Sub
Private Sub StopButton_Click()
Unload Me
End Sub