of 309 /309
b c Adobe ® Illustrator ® cs 2 AppleScript Reference

Illustrator CS2 AppleScript Scripting Reference · Adobe Illustrator CS2 AppleScript Scripting Reference 4 Working with symbols and symbol items..... .....53

  • Author
    others

  • View
    10

  • Download
    0

Embed Size (px)

Text of Illustrator CS2 AppleScript Scripting Reference · Adobe Illustrator CS2 AppleScript Scripting...

  • bbc

    Adobe I

    llust

    rato

    r cs2

    AppleScript Reference

  • 2005 Adobe Systems Incorporated. All rights reserved.

    Adobe Illustrator CS2 AppleScript Reference for Macintosh.

    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. The software described in this document is furnished under license and may only be used or copied in accordance with the terms of such license.

    This 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, and Illustrator 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 trademarks of Apple Computer, Inc., registered in the United States and other countries. Microsoft, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark of The Open Group.

    All other trademarks are the property of their respective owners.

    If this guide is distributed with software that includes an end user agreement, this guide, as well as the software 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 software that includes an end user license agreement.

    The 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.

  • 3

    Contents

    1 Introduction ............................................................................................................................... 35About this Manual........................................................................................................................................................................35What is Scripting?.........................................................................................................................................................................35

    Why use scripting?.................................................................................................................................................................36What about actions? .............................................................................................................................................................36

    Script Support in Adobe Illustrator CS2 ...............................................................................................................................36Executing scripts ....................................................................................................................................................................37

    Installing scripts ...............................................................................................................................................................37Executing other scripts ..................................................................................................................................................37

    System requirements for Mac OS.....................................................................................................................................38Changes to AppleScript support in Adobe Illustrator CS2......................................................................................38

    2 Scripting Basics .......................................................................................................................... 39Object Model Concepts .............................................................................................................................................................39

    Object classes and containers ...........................................................................................................................................40Object inheritance .................................................................................................................................................................40Object elements .....................................................................................................................................................................40Object references...................................................................................................................................................................40

    Scripting Concepts.......................................................................................................................................................................41Comments ................................................................................................................................................................................41Long script lines......................................................................................................................................................................41Value types ...............................................................................................................................................................................41Variables ....................................................................................................................................................................................42

    Variable naming ...............................................................................................................................................................42Script properties...............................................................................................................................................................42

    Operators ..................................................................................................................................................................................43Commands ...............................................................................................................................................................................43Conditional statements .......................................................................................................................................................43Control structures ..................................................................................................................................................................44Handlers ....................................................................................................................................................................................44

    Testing and Troubleshooting ..................................................................................................................................................45About error handling............................................................................................................................................................45

    AppleScript Bibliography ..........................................................................................................................................................46

    3 Scripting Illustrator ................................................................................................................... 47The Illustrator Object Model ....................................................................................................................................................47

    Looking at Illustrator objects and commands.............................................................................................................47Your first Illustrator script....................................................................................................................................................48Adding features to "Hello World".....................................................................................................................................48

    Object References ........................................................................................................................................................................49Objects that cannot be created by a script...................................................................................................................50Object containment: document vs. layer ......................................................................................................................50

    Working with Document Contents........................................................................................................................................51Working with selections ......................................................................................................................................................51Working with paths ...............................................................................................................................................................52Working with color ................................................................................................................................................................52

  • Adobe Illustrator CS2AppleScript Scripting Reference 4

    Working with symbols and symbol items.....................................................................................................................53Working with text art............................................................................................................................................................53

    Content of a text range..................................................................................................................................................54Character and paragraph styles .................................................................................................................................54

    Measurement Units .....................................................................................................................................................................54Unit conversion to points....................................................................................................................................................55Em space units ........................................................................................................................................................................55Coordinates..............................................................................................................................................................................55Fixed points..............................................................................................................................................................................56Zero point .................................................................................................................................................................................56Fixed rectangle .......................................................................................................................................................................56Page item positioning and dimensions .........................................................................................................................56

    Printing Illustrator Documents................................................................................................................................................57Transformation Matrices............................................................................................................................................................58Working with Variables and Datasets ...................................................................................................................................59Launching and Quitting Illustrator from a Script..............................................................................................................59User Interaction Levels ...............................................................................................................................................................59

    4 AppleScript Objects................................................................................................................... 61application ......................................................................................................................................................................................62

    application elements ............................................................................................................................................................62application object properties ............................................................................................................................................62best type ...................................................................................................................................................................................62browser available ..................................................................................................................................................................62class ............................................................................................................................................................................................62current document .................................................................................................................................................................62default type .............................................................................................................................................................................62flattener presets .....................................................................................................................................................................62free memory ...........................................................................................................................................................................62frontmost .................................................................................................................................................................................62name ..........................................................................................................................................................................................62PDF presets ..............................................................................................................................................................................62PPDs ...........................................................................................................................................................................................62print presets ............................................................................................................................................................................62printers ......................................................................................................................................................................................62properties .................................................................................................................................................................................63scripting version ....................................................................................................................................................................63selection ...................................................................................................................................................................................63settings .....................................................................................................................................................................................63tracing presets ........................................................................................................................................................................63user interaction level ...........................................................................................................................................................63version .......................................................................................................................................................................................63application commands ........................................................................................................................................................63

    brush, brushes ..............................................................................................................................................................................65brush object properties .......................................................................................................................................................65best type ...................................................................................................................................................................................65class ............................................................................................................................................................................................65container ..................................................................................................................................................................................65default type .............................................................................................................................................................................65index ..........................................................................................................................................................................................65name ..........................................................................................................................................................................................65

  • Adobe Illustrator CS2AppleScript Scripting Reference 5

    properties .................................................................................................................................................................................65brush object commands .....................................................................................................................................................65

    character..........................................................................................................................................................................................67character object elements ..................................................................................................................................................67character object properties................................................................................................................................................67aki left ........................................................................................................................................................................................67aki right .....................................................................................................................................................................................67alignment .................................................................................................................................................................................67alternate glyphs .....................................................................................................................................................................68auto leading ............................................................................................................................................................................68baseline direction .................................................................................................................................................................68baseline position ...................................................................................................................................................................68baseline shift ...........................................................................................................................................................................68best type ...................................................................................................................................................................................68capitalization ..........................................................................................................................................................................68character offset ......................................................................................................................................................................68class ............................................................................................................................................................................................68connection forms ..................................................................................................................................................................68container ..................................................................................................................................................................................68contents ....................................................................................................................................................................................68contextual ligature ...............................................................................................................................................................68default type .............................................................................................................................................................................68discretionary ligature ...........................................................................................................................................................68figure style ...............................................................................................................................................................................69fill color .....................................................................................................................................................................................69fractions ....................................................................................................................................................................................69horizontal scale ......................................................................................................................................................................69index ..........................................................................................................................................................................................69italics ..........................................................................................................................................................................................69kerning ......................................................................................................................................................................................69kerning method .....................................................................................................................................................................69language ..................................................................................................................................................................................70leading ......................................................................................................................................................................................70length ........................................................................................................................................................................................70ligature ......................................................................................................................................................................................70no break ....................................................................................................................................................................................70ordinals .....................................................................................................................................................................................70ornaments ...............................................................................................................................................................................70overprint fill .............................................................................................................................................................................70overprint stroke .....................................................................................................................................................................70properties .................................................................................................................................................................................70proportional metrics ............................................................................................................................................................70rotation .....................................................................................................................................................................................71selection ...................................................................................................................................................................................71size ..............................................................................................................................................................................................71story ...........................................................................................................................................................................................71strike through .........................................................................................................................................................................71stroke color ..............................................................................................................................................................................71stroke weight ..........................................................................................................................................................................71stylistic alternates .................................................................................................................................................................71swash .........................................................................................................................................................................................71

  • Adobe Illustrator CS2AppleScript Scripting Reference 6

    TCY horizontal ........................................................................................................................................................................71TCY vertical ..............................................................................................................................................................................71text font ....................................................................................................................................................................................71titling .........................................................................................................................................................................................71tracking .....................................................................................................................................................................................71Tsume ........................................................................................................................................................................................71underline ..................................................................................................................................................................................71vertical scale ............................................................................................................................................................................71warichu characters after break .........................................................................................................................................71warichu characters before break .....................................................................................................................................71warichu enabled ....................................................................................................................................................................71warichu gap ............................................................................................................................................................................72warichu justification .............................................................................................................................................................72warichu lines ...........................................................................................................................................................................72warichu scale ..........................................................................................................................................................................72character object commands ..............................................................................................................................................72

    character style, character styles ..............................................................................................................................................74character style object properties......................................................................................................................................74aki left ........................................................................................................................................................................................74aki right .....................................................................................................................................................................................74alignment .................................................................................................................................................................................74alternate glyphs .....................................................................................................................................................................74alternate ligature ...................................................................................................................................................................74auto leading ............................................................................................................................................................................74baseline direction .................................................................................................................................................................74baseline position ...................................................................................................................................................................74baseline shift ...........................................................................................................................................................................74best type ...................................................................................................................................................................................74capitalization ..........................................................................................................................................................................75class ............................................................................................................................................................................................75connection forms ..................................................................................................................................................................75contextual ligature ...............................................................................................................................................................75container ..................................................................................................................................................................................75default type .............................................................................................................................................................................75discretionary ligature ...........................................................................................................................................................75figure style ...............................................................................................................................................................................75fill color .....................................................................................................................................................................................75font .............................................................................................................................................................................................75fractions ....................................................................................................................................................................................75horizontal scale ......................................................................................................................................................................75index ..........................................................................................................................................................................................75italics ..........................................................................................................................................................................................75kerning method .....................................................................................................................................................................75language ..................................................................................................................................................................................76leading ......................................................................................................................................................................................76ligature ......................................................................................................................................................................................76name ..........................................................................................................................................................................................76OpenType position ...............................................................................................................................................................76ordinals .....................................................................................................................................................................................76ornaments ...............................................................................................................................................................................76overprint fill .............................................................................................................................................................................76

  • Adobe Illustrator CS2AppleScript Scripting Reference 7

    overprint stroke .....................................................................................................................................................................76properties .................................................................................................................................................................................76proportional metrics ............................................................................................................................................................77rotation .....................................................................................................................................................................................77size ..............................................................................................................................................................................................77strike through .........................................................................................................................................................................77stroke color ..............................................................................................................................................................................77stroke weight ..........................................................................................................................................................................77stylistic alternates .................................................................................................................................................................77swash .........................................................................................................................................................................................77TCY horizontal ........................................................................................................................................................................77TCY vertical ..............................................................................................................................................................................77titling .........................................................................................................................................................................................77tracking .....................................................................................................................................................................................77Tsume ........................................................................................................................................................................................77underline ..................................................................................................................................................................................77vertical scale ............................................................................................................................................................................77warichu characters after break .........................................................................................................................................77warichu characters before break .....................................................................................................................................77warichu enabled ....................................................................................................................................................................77warichu gap ............................................................................................................................................................................77warichu justification .............................................................................................................................................................78warichu lines ...........................................................................................................................................................................78warichu scale ..........................................................................................................................................................................78

    CMYK color info.............................................................................................................................................................................79CMYK color info object properties...................................................................................................................................79cyan ............................................................................................................................................................................................79magenta ...................................................................................................................................................................................79yellow ........................................................................................................................................................................................79black ...........................................................................................................................................................................................79

    color info..........................................................................................................................................................................................80color management options......................................................................................................................................................81

    color management options object properties ............................................................................................................81intent .........................................................................................................................................................................................81name ..........................................................................................................................................................................................81profile kind ..............................................................................................................................................................................81

    color separation options............................................................................................................................................................82color separation options object properties..................................................................................................................82convert spot colors ...............................................................................................................................................................82inks .............................................................................................................................................................................................82over print black ......................................................................................................................................................................82separation mode ...................................................................................................................................................................82

    compound path item, compound path items...................................................................................................................83compound path item object elements ..........................................................................................................................83compound path item object properties........................................................................................................................83properties .................................................................................................................................................................................83compound path item object commands ......................................................................................................................83

    coordinate options ......................................................................................................................................................................85coordinate options object properties ............................................................................................................................85emulsion ...................................................................................................................................................................................85fit to page .................................................................................................................................................................................85

  • Adobe Illustrator CS2AppleScript Scripting Reference 8

    horizontal scale ......................................................................................................................................................................85orientation ...............................................................................................................................................................................85position .....................................................................................................................................................................................85tiling ...........................................................................................................................................................................................85vertical scale ............................................................................................................................................................................85

    dataset, datasets ...........................................................................................................................................................................86dataset object properties....................................................................................................................................................86best type ...................................................................................................................................................................................86class ............................................................................................................................................................................................86container ..................................................................................................................................................................................86default type .............................................................................................................................................................................86index ..........................................................................................................................................................................................86name ..........................................................................................................................................................................................86properties .................................................................................................................................................................................86dataset object commands ..................................................................................................................................................86

    document, documents...............................................................................................................................................................88document object elements ................................................................................................................................................88document object properties..............................................................................................................................................89best type ...................................................................................................................................................................................89class ............................................................................................................................................................................................89color space ...............................................................................................................................................................................89crop marks ...............................................................................................................................................................................89crop style ..................................................................................................................................................................................89current dataset .......................................................................................................................................................................89current layer ............................................................................................................................................................................89current view ............................................................................................................................................................................89default fill color ......................................................................................................................................................................89default fill overprint .............................................................................................................................................................89default filled ............................................................................................................................................................................89default stroke cap .................................................................................................................................................................89default stroke color ..............................................................................................................................................................89default stroke dash offset ..................................................................................................................................................89default stroke dashes ...........................................................................................................................................................90default stroke join .................................................................................................................................................................90default stroke miter limit ....................................................................................................................................................90default stroke overprint ......................................................................................................................................................90default stroke width .............................................................................................................................................................90default stroked .......................................................................................................................................................................90default type .............................................................................................................................................................................90file path .....................................................................................................................................................................................90geometric bounds ................................................................................................................................................................90height ........................................................................................................................................................................................90index ..........................................................................................................................................................................................90inks .............................................................................................................................................................................................90Kinsoku set ..............................................................................................................................................................................90modified ...................................................................................................................................................................................90Mojikumi set ...........................................................................................................................................................................90name ..........................................................................................................................................................................................90output resolution ..................................................................................................................................................................91page origin ..............................................................................................................................................................................91print tiles ..................................................................................................................................................................................91

  • Adobe Illustrator CS2AppleScript Scripting Reference 9

    properties .................................................................................................................................................................................91ruler origin ...............................................................................................................................................................................91ruler units .................................................................................................................................................................................91selection ...................................................................................................................................................................................91show placed images ............................................................................................................................................................91split long paths ......................................................................................................................................................................91stationery .................................................................................................................................................................................91tile full pages ...........................................................................................................................................................................91use default screen .................................................................................................................................................................91variables locked .....................................................................................................................................................................91visible bounds ........................................................................................................................................................................91width ..........................................................................................................................................................................................91document object commands ............................................................................................................................................91

    ellipse................................................................................................................................................................................................94ellipse object properties......................................................................................................................................................94bounds ......................................................................................................................................................................................94inscribed ...................................................................................................................................................................................94reversed ....................................................................................................................................................................................94ellipse object commands ....................................................................................................................................................94

    EPS save options ...........................................................................................................................................................................96EPS save options object properties .................................................................................................................................96CMYK PostScript ....................................................................................................................................................................96compatibility ...........................................................................................................................................................................96compatible gradient printing ...........................................................................................................................................96embed all fonts ......................................................................................................................................................................96embed linked files .................................................................................................................................................................96flatten output .........................................................................................................................................................................96included document thumbnails ......................................................................................................................................96overprint ...................................................................................................................................................................................96PostScript .................................................................................................................................................................................97preview .....................................................................................................................................................................................97

    Flash export options....................................................................................................................................................................98Flash export options object properties..........................................................................................................................98artboard clipping ..................................................................................................................................................................98background color ..................................................................................................................................................................98background layers ................................................................................................................................................................98blend animation ....................................................................................................................................................................98compressed .............................................................................................................................................................................98convert text to outlines .......................................................................................................................................................98curve quality ...........................................................................................................................................................................98export style ..............................................................................................................................................................................98flatten output .........................................................................................................................................................................98frame rate .................................................................................................................................................................................98generate HTML ......................................................................................................................................................................98image format ..........................................................................................................................................................................98JPEG method ..........................................................................................................................................................................98JPEG quality .............................................................................................................................................................................99layer order ................................................................................................................................................................................99looping ......................................................................................................................................................................................99read only ..................................................................................................................................................................................99replacing ..................................................................................................................................................................................99

  • Adobe Illustrator CS2AppleScript Scripting Reference 10

    resolution .................................................................................................................................................................................99flattening options...................................................................................................................................................................... 100

    flattening options object properties............................................................................................................................ 100clip complex regions ......................................................................................................................................................... 100convert strokes to outlines ............................................................................................................................................. 100convert text to outlines .................................................................................................................................................... 100flattening balance .............................................................................................................................................................. 100gradient resolution ............................................................................................................................................................ 100overprint ................................................................................................................................................................................ 100rasterization resolution .................................................................................................................................................... 100

    font options ................................................................................................................................................................................. 101font options object properties ....................................................................................................................................... 101download fonts ................................................................................................................................................................... 101font substitution kind ....................................................................................................................................................... 101

    GIF export options .................................................................................................................................................................... 102GIF export options object properties .......................................................................................................................... 102antialiasing ........................................................................................................................................................................... 102artboard clipping ............................................................................................................................................................... 102color count ........................................................................................................................................................................... 102color dither ........................................................................................................................................................................... 102color reduction ................................................................................................................................................................... 102dither percent ...................................................................................................................................................................... 102horizontal scaling ............................................................................................................................................................... 102information loss .................................................................................................................................................................. 102interlaced .............................................................................................................................................................................. 102matte ...................................................................................................................................................................................... 102matte color ........................................................................................................................................................................... 102saving as HTML ................................................................................................................................................................... 102transparency ........................................................................................................................................................................ 102vertical scaling ..................................................................................................................................................................... 103web snap ............................................................................................................................................................................... 103

    gradient, gradients ................................................................................................................................................................... 104gradient object elements................................................................................................................................................. 104gradient object properties............................................................................................................................................... 104best type ................................................................................................................................................................................ 104class ......................................................................................................................................................................................... 104container ............................................................................................................................................................................... 104default type .......................................................................................................................................................................... 104entire gradient .................................................................................................................................................................... 104gradient type ....................................................................................................................................................................... 104index ....................................................................................................................................................................................... 104name ....................................................................................................................................................................................... 104properties .............................................................................................................................................................................. 104gradient object commands............................................................................................................................................. 104

    gradient color info .................................................................................................................................................................... 106gradient color info object properties .......................................................................................................................... 106angle ....................................................................................................................................................................................... 106gradient ................................................................................................................................................................................. 106hilite angle ............................................................................................................................................................................ 106hilite length .......................................................................................................................................................................... 106length ..................................................................................................................................................................................... 106

  • Adobe Illustrator CS2AppleScript Scripting Reference 11

    matrix ..................................................................................................................................................................................... 106origin ...................................................................................................................................................................................... 106

    gradient stop, gradient stops................................................................................................................................................ 107gradient stop object properties..................................................................................................................................... 107best type ................................................................................................................................................................................ 107class ......................................................................................................................................................................................... 107color ........................................................................................................................................................................................ 107container ............................................................................................................................................................................... 107default type .......................................................................................................................................................................... 107index ....................................................................................................................................................................................... 107midpoint ................................................................................................................................................................................ 107properties .............................................................................................................................................................................. 107ramp point ............................................................................................................................................................................ 107gradient stop object commands................................................................................................................................... 107

    gradient stop info...................................................................................................................................................................... 109gradient stop info object properties............................................................................................................................ 109color ........................................................................................................................................................................................ 109midpoint ................................................................................................................................................................................ 109ramp point ............................................................................................................................................................................ 109

    graph item, graph items ......................................................................................................................................................... 110graph item object properties.......................................................................................................................................... 110content variable ................................................................................................................................................................. 110properties .............................................................................................................................................................................. 110graph item object commands........................................................................................................................................ 110

    graphic style, graphic styles .................................................................................................................................................. 111graphic style object properties ...................................................................................................................................... 111best type ................................................................................................................................................................................ 111class ......................................................................................................................................................................................... 111container ............................................................................................................................................................................... 111default type .......................................................................................................................................................................... 111index ....................................................................................................................................................................................... 111name ....................................................................................................................................................................................... 111properties .............................................................................................................................................................................. 111graphic style object commands .................................................................................................................................... 111

    gray color info............................................................................................................................................................................. 113gray color info object properties................................................................................................................................... 113gray value .............................................................................................................................................................................. 113

    group item, group items......................................................................................................................................................... 114group item object elements ........................................................................................................................................... 114group item object properties ......................................................................................................................................... 114clipped ................................................................................................................................................................................... 114properties .............................................................................................................................................................................. 114group item object commands ....................................................................................................................................... 114

    Illustrator preferences.............................................................................................................................................................. 117Illustrator preferences object properties.................................................................................................................... 117best type ................................................................................................................................................................................ 117class type ............................................................................................................................................................................... 117default type .......................................................................................................................................................................... 117properties .............................................................................................................................................................................. 117PDF file options ................................................................................................................................................................... 117Photoshop file options ..................................................................................................................................................... 117

  • Adobe Illustrator CS2AppleScript Scripting Reference 12

    Illustrator save options............................................................................................................................................................ 118Illustrator save options object properties .................................................................................................................. 118compatibility ........................................................................................................................................................................ 118compressed .......................................................................................................................................................................... 118embed ICC profile .............................................................................................................................................................. 118embed linked files .............................................................................................................................................................. 118flatten output ...................................................................................................................................................................... 118font subset threshold ....................................................................................................................................................... 118PDF compatible .................................................................................................................................................................. 118

    ink.................................................................................................................................................................................................... 120ink object properties.......................................................................................................................................................... 120name ....................................................................................................................................................................................... 120properties .............................................................................................................................................................................. 120

    ink properties.............................................................................................................................................................................. 121ink properties object properties............................................................................