InDesign CS2 Scripting Guide.pdf
(
2348 KB
)
Pobierz
Adobe InDesign CS2 Scripting Guide
Adobe
®
InDesign
®
cs
2
Adobe InDesign CS2 Scripting Guide
© 2005 Adobe Systems Incorporated. All rights reserved.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or
electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written consent of Adobe Systems Incorporated. he sotware described in this document is furnished under license and may
only be used or copied in accordance with the terms of such license.
his publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a commitment
by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies, makes
no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and all warranties of
merchantability, fitness for particular purposes, and noninfringement of third party rights.
Any references to company names in sample templates are for demonstration purposes only and are not intended to refer to any actual
organization.
Adobe, the Adobe logo, Acrobat, Adobe PDF, Adobe Creative Suite, Illustrator, InDesign, InCopy, GoLive, and Photoshop are either registered
trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Apple, Mac, Macintosh, and Mac OS are either registered trademarks or trademarks of Apple Computer, Inc., registered in the United States and
other countries. Microsot and Windows are either registered trademarks or trademarks of Microsot Corporation in the United States and other
countries. UNIX is a trademark in the United States and other countries, licensed exclusively through X/Open Company, Ltd.
All other trademarks are the property of their respective owners.
If this guide is distributed with sotware that includes an end user agreement, this guide, as well as the sotware described in it, is furnished under
license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part of this guide
may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise,
without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law
even if it is not distributed with sotware that includes an end user license agreement.
he content of this guide is furnished for informational use only, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that
may appear in the informational content contained in this guide.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
Adobe InDesign CS2 Scripting Guide
Contents i
Contents
1
Introduction .................................................................1
What is in this book ...................................................................................................... 1
Who should read this book ........................................................................................ 1
What you need to use scripting ............................................................................... 1
JavaScript ..... 2
Macintosh .... 2
Windows ...... 2
How to use the scripts in this document .............................................................. 2
Copying examples with long lines .....................................................................................3
Running JavaScript files .........................................................................................................3
Where to find more information .............................................................................. 3
InDesign online scripting resources ..................................................................................4
2
Scripting Basics ...........................................................5
Introduction to scripting ............................................................................................ 5
What is scripting? ......................................................................................................................5
Why use scripting? ...................................................................................................................6
What about macros? ................................................................................................................6
Making script files readable ....................................................................................... 7
Commenting the script ..........................................................................................................7
Continuing long lines in AppleScript and VBScript .....................................................7
Continuing long lines in JavaScript ....................................................................................7
Objects and classes ...................................................................................................... 8
Objects ......... 8
Object references .....................................................................................................................8
Values and variables ..................................................................................................... 9
Values ............ 9
Variables ..... 10
Variable names ........................................................................................................................11
Assigning values to variables .............................................................................................11
Array variables .........................................................................................................................12
Converting values from one type to another ..............................................................12
Finding the value type of a variable ................................................................................13
Operators ....................................................................................................................... 14
Methods ......................................................................................................................... 14
ii Contents
Adobe InDesign CS2 Scripting Guide
Control structures ....................................................................................................... 15
Conditional statements ........................................................................................................15
Loops ........... 16
Subroutines and handlers ........................................................................................ 17
3
Getting Started with InDesign Scripting ...............19
Measurements and positioning ............................................................................. 19
Coordinates ...............................................................................................................................19
Measurement units ................................................................................................................20
The InDesign document object model ............................................................... 21
Looking at the InDesign object model ...........................................................................21
Your first InDesign script ...........................................................................................22
Adding features to “Hello World” ..........................................................................25
Adding a user interface to "Hello World" ............................................................29
Dialog box overview .............................................................................................................29
Adding the user interface ........................................................................................30
Creating a more complex user interface ........................................................................33
Handling errors ............................................................................................................39
Using palettes to manage scripts ..........................................................................40
Using the Scripts palette ......................................................................................................40
Using the Script Label palette ............................................................................................41
Testing and troubleshooting ................................................................................... 42
AppleScript debugging ........................................................................................................42
VBScript debugging ..............................................................................................................42
JavaScript debugging ...........................................................................................................42
4
Using ExtendScript Tools and Features .................43
The ExtendScript Toolkit ...........................................................................................44
Configuring the Toolkit window .......................................................................................44
Selecting a debugging target ...........................................................................................45
Selecting scripts .....................................................................................................................46
Tracking data ............................................................................................................................47
The JavaScript console ........................................................................................................48
The call stack ...........................................................................................................................48
The Script Editor ......................................................................................................................49
Debugging in the Toolkit .....................................................................................................50
Profiling ...... 54
Dollar ($) Object ..........................................................................................................55
Dollar ($) object properties .................................................................................................55
Dollar ($) object functions ...................................................................................................56
ExtendScript Reflection Interface ..........................................................................58
Reflection Object ...................................................................................................................58
ReflectionInfo Object ...........................................................................................................59
Localizing ExtendScript Strings ..............................................................................60
Variable values in localized strings ..................................................................................61
Enabling automatic localization .......................................................................................61
Locale names ...........................................................................................................................62
Testing localization ................................................................................................................62
Global localize function .......................................................................................................63
Adobe InDesign CS2 Scripting Guide
Contents iii
User notification helper functions .........................................................................63
Global alert function .............................................................................................................64
Global confirm function .......................................................................................................64
Global prompt function .......................................................................................................65
Specifying measurement values ...........................................................................66
UnitValue object .....................................................................................................................66
Converting pixel and percentage values .......................................................................67
Computing with unit values ...............................................................................................68
Modular programming support ............................................................................69
Preprocessor directives ........................................................................................................69
Importing and exporting between scripts ...................................................................71
Operator overloading ...............................................................................................72
Application and namespace specifiers ................................................................73
Application specifiers ............................................................................................................73
Namespace specifiers ...........................................................................................................74
Script locations and checking application installation ................................... 74
5
Working with Documents in AppleScript .............75
Basic document management ............................................................................... 76
Creating a new document ...................................................................................................76
Opening a document ............................................................................................................76
Closing a document ...............................................................................................................77
Saving a document ................................................................................................................77
Basic page layout ........................................................................................................78
Defining page size and document length .....................................................................78
Defining bleed and slug areas ...........................................................................................79
Setting page margins and columns .................................................................................80
Changing the pasteboard's appearance .............................................................82
Using guides and grids ..............................................................................................82
Defining guides .......................................................................................................................82
Setting grid preferences ......................................................................................................84
Snapping to guides and grids ............................................................................................84
Changing measurement units and ruler .............................................................85
Defining and applying document presets .........................................................85
Creating a preset by copying values ...............................................................................85
Creating a preset using new values .................................................................................86
Using a preset ..........................................................................................................................87
Setting up master spreads .......................................................................................87
Setting text-formatting defaults ............................................................................89
Setting application text defaults ......................................................................................89
Setting the active document's defaults .........................................................................91
Using text defaults .................................................................................................................91
Adding XMP metadata .............................................................................................. 91
Creating a document template ..............................................................................92
Printing a document ..................................................................................................96
Printing using page ranges .................................................................................................96
Setting print preferences .....................................................................................................96
Using printer presets .............................................................................................................99
Creating printer presets from printing preferences ...................................................99
Plik z chomika:
danielozo1
Inne pliki z tego folderu:
Flash_kurs.rar
(538540 KB)
KursFlash.rar
(164175 KB)
kurs flash.zip
(345625 KB)
Kurs-flash.rar
(449307 KB)
Kurs Flash.iso
(604338 KB)
Inne foldery tego chomika:
▣ Instalki
▣ Różne
●Programy Muzyczne
3gp xxx super
50000 Sterowników Do Windows XP
Zgłoś jeśli
naruszono regulamin