Adobe 16001500 Getting Started Guide

Adobe 16001500 - Illustrator CS2 - Mac Manual

Adobe 16001500 manual content summary:

  • Adobe 16001500 | Getting Started Guide - Page 1
    effort of remembering steps and sequences of operations. Illustrator CS2 supports JavaScript, an easy-to-use, platform-independent Illustrator's File>Scripts menu, place the script file in the directory Adobe Illustrator CS2\Presets\Scripts, then restart Illustrator. Each time you launch Illustrator
  • Adobe 16001500 | Getting Started Guide - Page 2
    msgType = ""; 4. This script has to run on objects in a document, so make sure a document is open. // check if a document is open in Illustrator. if( app.documents.length > 0) { 5. If the document is open, get the selected objects. mySelection = app.activeDocument.selection; 6. Check if there were
  • Adobe 16001500 | Getting Started Guide - Page 3
    GettingStarted Illustrator JavaScript 3 8. If no document is open, set the message to reflect that case. else { msgType = "No document Open."; } 9. Finally, print the message. alert( msgType ); 10. Save the file. 11. Run the script, as described in Executing JavaScript Scripts above. The alert box
  • Adobe 16001500 | Getting Started Guide - Page 4
    message to reflect that case. else { msg = "No document Open."; } 6. Print the msg. alert ( msg ); 7. Save the file. To run this example: 1. Launch Illustrator. 2. Open a document with some objects in it or create a document and create some objects in it. 3. Run the script, as described in Executing
  • Adobe 16001500 | Getting Started Guide - Page 5
    its applyTo method: lastStyle.applyTo( app.activeDocument.pageItems[0] ); 10. To reference the first pathItem in the active document use in your text editor, and save it as Example3.js. 2. Create a new blank Illustrator document. // open a new blank document var thisDoc = app.documents.add(); 3.
  • Adobe 16001500 | Getting Started Guide - Page 6
    a 4 point star var star = artLayer.pathItems.star( 300.0, 125.0, 100.0, 20.0, 4 ); 10. So far, the objects we have created simply use the default stroke and fill we set in the now written four JavaScripts for Illustrator. There are more scripts available in the Adobe Technical Info > Scripting >
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

1
Adobe
®
Illustrator
®
CS
2
Scripting
GettingStarted with JavaScript
®
Introduction
Scripting offers an easy way to manipulate Illustrator files programmatically. You can write scripts to create
documents and objects, and to perform many of the operations that you access interactively in Illustrator,
using the palettes and windows. Scripts are particularly useful as a way to automate day-to-day tasks that
are complex and repetitive. You simply write the script once, and then run it any time you need to
accomplish that task. This saves you both time and the effort of remembering steps and sequences of
operations.
Illustrator CS
2
supports JavaScript, an easy-to-use, platform-independent scripting language. A JavaScript
program, or script, takes the form of a text file with the
.js
extension. You can use any text editor to write
your scripts, such as TextEdit, Textpad, or BBEdit.
This overview will help you to become familiar with
Illustrator scripting using JavaScript, by walking you
through some example scripts
that manipulate objects in Illustrator CS
2
.
This document assumes that:
You are familiar with the Illustrator user interface, as described in the
Illustrator CS
2
User Guide.
You are familiar with JavaScript programming language.
You have installed Illustrator CS
2
version 1
2
.0 and an editor to create scripts, such as Textpad or TextEdit.
Executing JavaScript Scripts
To run any script from Illustrator CS
2
:
1.
Choose
File>Scripts>Browse
.
2.
Navigate to your script file.
3.
Double-click the file or click
Open
to run the script.
To make a script available as a menu item under Illustrator’s
File>Scripts
menu, place the script file in the
directory
Adobe Illustrator CS
2
\Presets\Scripts
, then restart Illustrator. Each time you launch
Illustrator, every script found in this location is added as a menu item ,Your script will be listed among the
prebuilt Automation Scripts that are available in this directory.
Accessing and Referencing Objects
When you write a script, you must first decide what file, or
document
, the script should act on. The script
can create a new document, open an existing document, or act on a document that is already open.
The script can create new objects in the document, operate on objects that the user has selected, or
operate on objects that it finds in one of the
object
collections
. The following examples illustrate various
techniques for accessing, referencing, and manipulating Illustrator objects.