You are on page 1of 54

ADOBE

Copyright 2009 Adobe Systems Incorporated. All rights reserved.


Adobe
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
non-infringement 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, Illustrator, InDesign, and Photoshop are either registered trademarks or trademarks of Adobe
Systems Incorporated in the United States and/or other countries.
Apple, Mac OS, and Macintosh 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. JavaScriptTM 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.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

AppleScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
JS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
VBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
DOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . 13
. . . . . . . . . . . . . . . . . . . . . . . . 14
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17
18
19
19
19
21
21
21
22
22

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23
24
24
25

Tell AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
AppleScript VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AppleScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AppleScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AppleScriptAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32
32
32
32
35
35
35
36

Adobe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

40
40
41
42

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
if else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

AppleScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
ESTK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

AppleScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Adobe

Adobe

Adobe

1
Adobe Photoshop Adobe InDesign

Adobe

Mac OS
X

AppleScript

JavaScript

Windows
X

VBScriptVisual Basic VBA

JavaScript

AppleScript
AppleScript Apple
1
AppleScript Mac OS Apple
Mac OS
/ /AppleScript/

VBScript
VBScript Microsoft Visual Basic ActiveX
Scripting CS5 Visual Basic
VBScript VBA Visual Basic
VBScript Microsoft Office
Visual Basic Editor Visual Basic Editor

JavaScript
JavaScript Web
AppleScript JavaScript
: ExtendScript JavaScript
ExtendScript Adobe
2 JavaScript
.js .jsx

JavaScript AppleScript Visual Basic


X

Windows Mac OS
JavaScript

Adobe Illustrator InDesign


Photoshop .jsx
AppleScript Visual Basic

Startup Scripts
.jsx

JavaScript Adobe
ESTKExtendScript Tool KitESTK
ESTK
2

ESTK

Macintosh / / /Adobe Utilities/ExtendScript


Toolkit CS5
Windows Program FilesAdobeAdobe UtilitiesExtendScript Toolkit
CS5

JavaScript

: 5

AS
1. Adobe

tell application "Adobe Photoshop CS5"


make document
end tell

2.

JS
1. ESTK
2. JavaScript Console
app.documents.add()

3.
X

F5

VBS
1. 2 Adobe

Set appRef = CreateObject("Photoshop.Application")


appRef.Documents.Add()

2. .vbs create_doc.vbs
3. Windows

Windows OS Mac OS
Adobe

documentAS
makeJS add() VBS Add
AS
JS VBS

Adobe

Adobe

10

DOM
DOM
DOM

Adobe DOM

InDesign Illustrator

Photoshop

:
ESTK

: DOM

DOM
Photoshop AS art layerJS artLayersVBS ArtLayers

AS

tell application "Adobe Illustrator CS5"


make document
make layer in document
end tell

JS

app.documents.layers.add()

VBS

Set appRef = CreateObject("Illustrator.Application")


docRef.Documents.Add
appRef.Documents.Layers.Add

3
X

11

myDoc
8

AS

AS set
to
tell application "Adobe Illustrator CS5"
set myDoc to make document
end tell

JS

JS var =

var myDoc = app.documents.add()

VBS

VBS Set
=
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add

document
Photoshop AS art layerJS artLayersVBS
ArtLayers

AS

tell application "Adobe Illustrator CS5"


set myDoc to make document
make layer in myDoc
end tell

tell application "Adobe Illustrator CS5"


set myDoc to make document
set myLayer to make layer in myDoc
end tell

JS

12

var myDoc = app.documents.add()


myDoc.layers.add()

var myDoc = app.documents.add()


var myLayer = myDoc.layers.add()

VBS

Set appRef = CreateObject("Illustrator.Application")


Set docRef = appRef.Documents.Add
docRef.Layers.Add

Set appRef = CreateObject("Photoshop.Application")


Set docRef = appRef.Documents.Add
Set layerRef = docRef.Layers.Add

myLayer
myLayer myLayer

: contents

Illustrator CS5
InDesign Photoshop

AS

tell application "Adobe Illustrator CS5"


set myDoc to make document
set myLayer to make layer in myDoc
set myTextFrame to make text frame in myLayer
set contents of myTextFrame to "Hello world!"
end tell

JS

var myDoc = app.documents.add()


var myLayer = myDoc.layers.add()
var myTextFrame = myLayer.textFrames.add()
myTextFrame.contents = "Hello world!"

VBS

Set
Set
Set
Set

appRef = CreateObject("Illustrator.Application")
docRef = appRef.Documents.Add
layerRef = docRef.Layers.Add
frameRef = layerRef.TextFrames.Add
myTextFrame.Contents = "Hello world!"

x c
theDocument myLayer

13

Art Layer
Document docdocRef
layerlayerRef layerRef2

my
myDocmyLayermyTextFrame

myFirstPage
my_first_page

JavaScript VBScript thisString thisstring


ThisString AppleScript

JS VBSAS

channel channels
art layer art layers artLayers

Give me the first document in the collection

AS documents document 1

JavaScript 0
JS documents[0]

VBS Documents(0)

VBS 1

document layer

AS

14

tell application "Adobe InDesign CS5"


make document
make layer in document 1
make text frame in layer 1 of document 1
end tell

: AppleScript

14

JS

JavaScript []

app.documents.add()
app.documents[0].layers.add()
app.documents[0].layers[0].textFrames.add()

: JS 0

VBS

VBScript

appRef.Documents.Add
appRef.Documents(1).Layers.Add
appRef.Documents(1).Layers(1).TextFrames.Add

AS 1 2
AppleScript

JS
JS
0 1 3
2
[0]
[1] 2 [2]
[2] [2]

VBS VBS 1
JS

: JS VBS
Open all files in this folder and change the first layers

color to white

: 1

15

: Photoshop art
layer art layers layer set layer sets
art layer layer set layers
InDesign rectangle rectangles
text frame text frames rectangle
text frame page items
page items

)
X

AS current

current
current
current
current

document
layer
channel
view

JS active JS

activeDocument
activeLayer
activeChannel
activeView
X

VBS JS

ActiveDocument
ActiveLayer
ActiveChannel
ActiveView

16

AS

tell application "Adobe Illustrator CS5"


make document
make layer in current document
end tell

JS

app.documents.add()
app.activeDocument.layers.add()

: activeDocument s

VBS

Set appRef = CreateObject("Illustrator.Application")


docRef.Documents.Add
appRef.ActiveDocument.Layers.Add

: ActiveDocument s

1.
2.
3.

5.9 1.0 realfixedshortlongdouble

true false

: /
X

Adobe

21

17

ASJS VBS

x y

AS JS VBS
Z

AS {}
JS []
VBS Array: Array()
Z

AS

{3,4,5} {"string1", "string2", "string3"}

JS

[3,4,5] ["string1", "string2", "string3"]

VBS

Array(3,4,5) Array("string1", "string2", "string3")

AS

{{x1, y1}, {x2, y2}, {x3, y3}}

JS

[[x1, y1], [x2, y2], [x3, y3]]

VBS

Array(Array(x1, y1), Array(x2, y2), Array(x3, y3))

AS
AS set of
layer name
tell application "Adobe Illustrator CS5"
set myDoc to make document
set myLayer to make layer in myDoc
set name of myLayer to "My New Layer"
end tell
properties 1
/ :
properties
tell application "Adobe Illustrator CS5"
set myDoc to make document
set myLayer to make layer in myDoc
set properties of myLayer to {name:"My New Layer", visible:false}
end tell

: "My New Layer"


visible false
16

18

tell application "Adobe Illustrator CS5"


set myDoc to make document
set myLayer to make layer in myDoc with properties {name:"My New Layer"}
end tell
tell application "Adobe Illustrator CS5"
set myDoc to make document
set myLayer to make layer in myDoc with properties {name:"My New Layer",
visible:false}
end tell

JS
JS
.=

var myDoc = app.documents.add()


var myLayer = myDoc.layers.add()
myLayer.name = "My New Layer"

var myDoc = app.documents.add()


var myLayer = myDoc.layers.add()
myLayer.name = "My New Layer"
myLayer.visible = false

: "My New Layer"


visible false
16

JS with with with


()
with {Enter
with }
var myDoc = app.documents.add()
var myLayer = myDoc.layers.add()
with(myLayer){
name = "My New Layer"
visible = false
}
with myLayer.
with

JS 1 properties
{}
: /
,
var myDoc = app.documents.add()
var myLayer = myDoc.layers.add()
myLayer.properties = {name:"My New Layer", visible:false}

19

VBS
VBS .
=
Set appRef = CreateObject("Illustrator.Application")
Set myDoc = appRef.Documents.Add
Set myLayer = myDoc.Layers.Add
myLayer.Name = "My First Layer"

1 1

Set appRef = CreateObject("Illustrator.Application")


Set myDoc = appRef.Documents.Add
Set myLayer = myDoc.Layers.Add
myLayer.Name = "My First Layer"
myLayer.Opacity = 65
myLayer.Visible = false

: "My New Layer"


Visible false
16

Adobe name

save as 23

Documents

AS
AS display dialog ()
count
: document documents

20

documents

tell application "Adobe Photoshop CS5"


display dialog (count documents)
set myDoc to make document
display dialog (count documents)
end tell

myName myName
tell application "Adobe Photoshop CS5"
set myDoc to make document
set myName to name of myDoc
display dialog myName
end tell

JS
JS alert ()
alert() alert
length
documents

: document
documents
alert(app.documents.length)
var myDoc = app.documents.add()
alert(app.documents.length)

var myDoc = app.documents.add()


alert(myDoc.name)

VBS
VBS MsgBox ()
MsgBox MsgBox
Count
Documents

: Document
Documents
Set appRef = CreateObject("Photoshop.Application")
MsgBox(appRef.Documents.Count)
Set myDoc = appRef.Documents.Add
MsgBox(appRef.Documents.Count)

Set appRef = CreateObject("Photoshop.Application")


Set myDoc = appRef.Documents.Add
MsgBox(myDoc.Name))

21

landscape portrait 2
verticaluprighthorizontalon its side

:
3

AS
AS
dark green
tell application "Adobe Illustrator CS5"
set myDoc to make document
set myLayer to make layer in myDoc
set layer color of myLayer to dark green
end tell

: dark green
set layer color of myLayer to "dark green"

JS
JS .

Adobe
X

InDesign :
Z

UIColor
var myDoc = app.documents.add()
var myLayer = mydoc.layers.add()
myLayer.layerColor = UIColor.darkGreen

22

Illustrator :
Z

RulerUnits
var myDoc = app.documents.add()
myDoc.rulerUnits = RulerUnits.Centimeters

BlendModes
var myDoc = app.documents.add()
var myLayer = myDoc.layers.add()
myLayer.blendingMode = BlendModes.COLORBURN
X

Photoshop
Z

LayerKind
var myDoc = app.documents.add()
var myLayer = mydoc.artLayers.add()
myLayer.kind = LayerKind.TEXT

VBS
VBS
Set appRef = CreateObject("Photoshop.Application")
Set docRef = appRef.Documents.Add
Set layerRef = docRef.ArtLayers.Add
layerRef.Kind = 2

3 x 5
1

AS

tell application "Adobe Illustrator CS5"


set myDoc to make document with properties {height:10, width:7}
set docHeight to height of myDoc
set docWidth to width of myDoc
set myDoc with properties {height:docHeight - 2, width:docWidth - 2}
end tell

JS

var myDoc = app.documents.add(7, 10)


var docHeight = myDoc.height
var docWidth = myDoc.width
myDoc.resizeCanvas((docHeight - 2), (docWidth - 2))

VBS

Set appRef = CreateObject("Photoshop.Application")


Set myDoc = appRef.Documents.Add(7, 10)
docHeight = myDoc.Height
docWidth = myDoc.Width
myDoc.ResizeCanvas docWidth - 2, docHeight - 2

23

: MsgBox Adobe
Windows

ASVBS JS
print/print()/PrintOut /

AS

AS

tell application "Adobe InDesign CS5"


print current document
end tell

JS

JS ()

app.activeDocument.print()

VBS

VBS
Set appRef = CreateObject("Photoshop.Application")
appRef.ActiveDocument.PrintOut

24

merge
{}

: InDesign Illustrator Photoshop


AS art layerJS artLayersVBS ArtLayers

AS
tell application "Adobe InDesign CS5"
set myDoc to make document
set myLayer to make layer in myDoc
set myLayer2 to make layer in myDoc
merge myLayer2 with {myLayer}
end tell

JS

var myDoc = app.documents.add()


var myLayer = myDoc.layers.add()
var myLayer2 = myDoc.layers.add()
myLayer2.merge(myLayer)

VBS

Set appRef = CreateObject("InDesign.Application")


Set myDoc = appRef.Documents.Add
Set myLayer = myDoc.Layers.Add
Set myLayer2 = myDoc.Layers.Add
myLayer2.Merge(myLayer)

25

AS
AS 2
X

make
document
make document

2
location name

tell application "Adobe InDesign CS5"


set myDoc to make document
tell myDoc
set myLayer to make layer at beginning of myDoc with properties {name:"Lay1"}
set myLayer2 to make layer with properties {name:"Lay2"} at end of myDoc
end tell
end tell

JS
JS

: 3

undefined 4000
5000 72My Document
Photoshop CS5
app.documents.add(4000, 5000, 72, "My Document", NewDocumentMode.BITMAP)

app.documents.add(4000, 5000, undefined, "My Document", NewDocumentMode.BITMAP)

: undefined

app.documents.add(4000, 5000)

Tell AS 26

VBS
VBS

undefined 4000
5000 72My Document
Photoshop CS5
Set appRef = CreateObject("Photoshop.Application")
Set myDoc = appRef.Documents.Add(4000, 5000, 72, "My Document", 5)

Set appRef = CreateObject("Photoshop.Application")


Set myDoc = appRef.Documents.Add(400, 500, undefined, "My Document", 5)

: undefined

Set appRef = CreateObject("Photoshop.Application")


Set myDoc = appRef.Documents.Add(4000, 5000)

undefined

Tell AS
AppleScript /
tell application " "
end tell
tell tell
tell

tell application "Adobe InDesign CS5"


set myDoc to make document
set myLayer to make layer in myDoc
set myLayer2 to make layer in myDoc
end tell

tell
tell

27

tell application "Adobe InDesign CS5"


set myDoc to make document
tell myDoc
set myLayer to make layer
set myLayer2 to make layer
end tell
end tell
tell end tell
tell

AS toJS VBS
= layerRef
2 layerRef

AS

AS set
tell application "Adobe Illustrator CS5"
set docRef to make document
set layerRef to make layer in myDoc with properties {name:"First Layer"}
set layerRef to make layer in myDoc with properties {name:"Second Layer"}
end tell

JS

JS = var
var
var docRef = app.documents.add()
var layerRef = myDoc.layers.add()
layerRef.name = "First Layer"
layerRef = myDoc.layers.add()
layerRef.name = "Second Layer"

VBS

VBS Set
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add
Set layerRef = docRef.Layers.Add
layerRef.Name = "First Layer"
layerRef = docRef.Layers.Add
layerRef.Name = "Second Layer"

AS

var myDoc = app.activeDocument

JS

var myDoc = app.activeDocument

VBS

Set appRef = CreateObject("Illustrator.Application")


Set docRef = appRef.ActiveDocument

28

2
X

1 1

AS

AS 1 2 --
(* *)
tell application "Adobe InDesign CS5"
--This is a single-line comment
print current document --this is a partial-line comment
--the hyphens hide everything to their right from the scripting engine
(* This is a multi-line
comment, which is completely
ignored by the scripting engine, no matter how
many lines it contains.
The trick is to remember to close the comment.
If you dont the rest of your script is
hidden from the scripting engine!*)
end tell

JS

JS 1 2 //
/* */
//This is a single-line comment
app.activeDocument.print() //this part of the line is also a comment
/* This is a multi-line
comment, which is completely
ignored by the scripting engine, no matter how
many lines it contains.
Don?t forget the closing asterisk and slash
or the rest of your script will be commented out...*/

VBS

29

VBS Remremark 'VBS

'This is a comment.
Set appRef = CreateObject("Photoshop.Application")
Rem This is also a comment.
appRef.ActiveDocument.PrintOut 'This part of the line is a comment.
' This is a multi-line
' comment that requires
' a comment marker at the beginning
' of each line.
Rem This is also a multi-line comment. Generally, multi-line
Rem comments in VBS are easier for you to identify (and read) in your scripts
Rem if they begin with a single straight quote (') rather than if they begin
Rem with Rem, because Rem can look like any other text in the script
' The choice is yours but isn?t this more easily
' identifiable as a comment than the preceding
' four lines were?

AppleScript VBScript
AppleScript VBScript 1

: 1

AS

Option+Return
tell application "Adobe InDesign CS5"
set myDoc to make document
set myLayer to make layer in myDoc with properties {name:"My First Layer"} at the
beginning of myDoc (* without the line break character, AS would consider this
line an incomplete statement*)
(* note that line continuation characters are not required in a multi-line comment
such as this one*)
set myLayer2 to make layer in myDoc with properties {name:"My Other Layer"}
before myLayer
end tell

VBS

_
: 2

: JavaScript
ExtendScript

30

VBScript JavaScript

1 JavaScript myFiles 4

var myFiles = new Array ()


myFiles[0] = "clouds.bmp"
myFiles[1] = "clouds.gif"
myFiles[2] = "clouds.jpg"
myFiles[3] = "clouds.pdf"

clouds.gif
open(myFiles[1])

VBScript
Dim myFiles (4)
myFiles(0) = "clouds.bmp"
myFiles(1) = "clouds.gif"
myFiles(2) = "clouds.jpg"
myFiles(3) = "clouds.pdf"
appRef.Open myFiles(1)

: VBS (1) (1) (0)


VBS VBScript
13

make ASadd() JS Add


VBS

AS

tell application "Adobe Photoshop CS5"


make document
end tell

JS

app.documents.add()

VBS

Set appRef = CreateObject("Photoshop.Application")


appRef.Documents.Add()

make AS
add() JS
Add VBS
Adobe

31

44

Adobe

Adobe

Adobe PDF CD
Adobe

AppleScript
AppleScript Apple

AppleScript
: /AppleScript/

1.

Adobe
2. Adobe

AppleScriptAS
AS

1.
2.
:

32

33

3.
Z

anything
Can return:
/

r/o

1.

2.

3.

Can return:

AppleScript
40 Adobe

34

1.

2.
:

[ ]

Can accept:/

1.

2.

3.

[ ]

Can accept:

35

JavaScript
Adobe ExtendScript Tools KitESTKAdobe
JavaScript
Adobe JavaScript
JavaScript

VBScript
Microsoft Office Visual Basic Adobe
VBScript
:

VBScript
VBS
1. Microsoft Office Visual Basic Editor
2. Visual Basic Editor
OK
3. Creative Suite

4. Visual Basic
5. Adobe

CS5

36

VBScript
VBS

Adobe

Photoshop CS5 Ps
PsColorProfileTypePsBitsPerChannelType

InDesign CS5 id
idRenderingIntentidPageOrientation
Adobe Illustrator CS5 Ai
AiCropOptionsAiBlendModes
Z

37

1.

VBS Kind
2 TextLayer
Set appRef = CreateObject("Photoshop.Application")
Set docRef = appRef.Documents.Add
Set layerRef = docRef.ArtLayers.Add
layerRef.Kind = 2 'PsTextLayer

38

1.

2.

39

[ ]

1.

[ ]

Adobe

40

Adobe

CD

AS

AS
1

InDesign document

character style

indexnamerangerelativesatisfying a testID

layer

indexnamerangerelativesatisfying a testID

story

indexnamerangerelativesatisfying a testID

document
character stylelayer story

tell application "Adobe InDesign CS5"


set myDoc to make document
set myCharStyle to make character style in myDoc with properties {name:"Bold"}
set myLayer to make layer in myDoc
set myStory to make story in myDoc
end tell

stroke style document

tell application "Adobe InDesign CS5"


set myDoc to make document
set myStrokeStyle to make stroke style in myDoc with properties {name:"Erratic"}
end tell

Adobe

41

Photoshop art layer

bounds

[y1, x1, y2, x2]

kind

LayerKind

name

string

opacity

number (double)

0.0 100.0

textItem

TextItem

: kind = LayerKind.TEXT kind

visible

Boolean

true

AS

tell application "Adobe Photoshop CS5"


set myDoc to make document
set myLayer to make art layer in myDoc
set properties of myLayer to {kind:text layer, name:"Captions", opacity:45.5,
visible:true}
set contents of text object in myLayer to "Photo Captions"
end tell

: bounds

Adobe

JS

var myDoc = app.documents.add()


var myLayer = myDoc.artLayers.add()
alert(myLayer.bounds) // can't set the property because it is read-only
myLayer.kind = LayerKind.TEXT
myLayer.name = "Captions"
myLayer.opacity = 45.5 // can use a decimal point because the type is not integer
myLayer.textItem.contents = "Day 1: John goes to school"
//see the properties table for the textItem object to find the contents property
myLayer.visible = true

VBS

Set appRef = CreateObject("Photoshop.Application")


Set docRef = appRef.Documents.Add
Set layerRef = docRef.Layers.Add
msgBox(layerRef.Bounds) ' can?t set the property because it is read-only
layerRef.Kind = 2
layerRef.Name = "Captions"
layerRef.Opacity = 45.5 // can use a decimal point because the type is not integer
layerRef.TextItem.Contents = "Day 1: John goes to school"
//see the Properties table for the TextItem object to find the Contents property
layerRef.Visible = true

42

: JS VBS

documents.layers
layers.textFrames

NewDocumentMode DocumentFill

[]

Document

Adobe

43

Photoshop CS5 add

add
[width]
[, height]
[, resolution])
[, name]
[, mode])
[, initialFill]
[, pixelAspectRatio])

UnitValue
UnitValue
number (double)
string
NewDocumentMode
DocumentFill
number (double)

Document

(pixelAspectRatio
0.10 10.00

width height
UnitValue
5 7

AS

make document with properties {width:5, height:7}

JS

app.documents.add(5, 7)

VBS appRef.Documents.Add(5, 7)
X

mode initialFill

AS

make documement with properties {width:5, height:7, resolution:72, name:"Diary",


mode:bitmap, initial fill:transparent, pixel aspect ratio: 4.7}

JS

app.documents.add(5, 7, 72, "Diary", NewDocumentMode.BITMAP,


DocumentFill.TRANSPARENT, 4.7)

VBS

appRef.Documents.Add(5, 7, 72, "Diary", 5, 3, 4.7 )

if
Adobe
1

if
if
1
1
65%

AS

AS if if then if end if

tell application "Adobe Photoshop CS5"


--modify the hard-drive name at the beginning of the filepath, if needed
set myFilepath to alias "c:Applications:Adobe Photoshop CS5:Samples:Ducky.tif"
open myFilepath
set myDoc to current document
tell myDoc
if (art layer count = 1) then
set myLayer to make art layer with properties {fill opacity:65}
end if
end tell
end tell

: AS =
Ducky.tif if

if (art layer count < 1) then

JS

JS if if if {}

var myDoc = app.open(File("/c/Program Files/Adobe/Adobe Photoshop


CS5/Samples/Ducky.tif"));
if(myDoc.artLayers.length == 1){
var myLayer = myDoc.artLayers.add()
myLayer.fillOpacity = 65
}

44

45

: JavaScript ===

Ducky.tif if

if(myDoc.artLayers.length < 1){

VBS

VBS if If Then if End If


Set appRef = CreateObject("Photoshop.Application")
Set myDoc = appRef.Open("/c/Program Files/Adobe/Adobe
Photoshop_CS5/Samples/Ducky.tif")
If myDoc.ArtLayers.Count = 1 Then
Set myLayer = myDoc.ArtLayers.Add
myLayer.FillOpacity = 65
End If

: VBS
Ducky.tif if

If myDoc.ArtLayers.Count < 1 Then

if else

1
50 2
65 if else

AS

tell application "Adobe Photoshop CS5"


--modify the hard-drive name at the beginning of the filepath, if needed
set myFilepath to alias "c:Applications:Adobe Photoshop CS5:Samples:Ducky.tif"
open myFilepath
set myDoc to current document
tell myDoc
if (count of art layers < 2) then
set fill opacity of current layer to 50
else
set fill opacity of current layer to 65
end if
end tell
end tell

JS

var myDoc = app.open(File("/c/Program Files/Adobe/Adobe Photoshop


CS5/Samples/Ducky.tif"));
if(myDoc.artLayers.length < 2){
myDoc.activeLayer.fillOpacity = 50
}
else{
myDoc.activeLayer.fillOpacity = 65
}

VBS

46

Set appRef = CreateObject("Photoshop.Application")


Set myDoc = appRef.Open("/c/Program Files/Adobe/Adobe Photoshop CS5/_
Samples/Ducky1.tif")
If myDoc.ArtLayers.Count < 2 Then
myDoc.ActiveLayer.FillOpacity = 50
Else
myDoc.ActiveLayer.FillOpacity = 65
End If

repeat ASJS VBS

Adobe 9

DOM layer

true

AS

tell application "Adobe Illustrator CS5"


set myDoc to current document
tell myDoc
set myLayerCount to (count layers)
set myCounter to 1
repeat while myCounter <= (myLayerCount + 1)
set myLayer to layer myCounter
set myLayer with properties {visible:true}
--the next statement increments the counter to get the next layer
set myCounter to myCounter + 1
end repeat
end tell
end tell

myLayerCount myCounter 2
1

JS

var myDoc = app.activeDocument


var myLayerCount = myDoc.layers.length
for(var myCounter = 0; myCounter < myLayerCount; myCounter++)
{var myLayer = myDoc.layers[myCounter]
myLayer.visible = true}

for JavaScript 1
AppleScript myLayerCount myCounter 2
1
for 3 myCounter++ ++ 1
1

47

for

1. myCounter 0
2. myCounter myLayerCount myLayer
myCounter myLayer true

3. myCounter 1 myCounter myLayerCount


4. myCounter myLayerCount myCounter myLayer
myLayer true myCounter 1
5. myCounter myLayerCount
VBS

Set appRef = CreateObject("Illustrator.Application")


Set myDoc = appRef.ActiveDocument
For Each object in myDoc.Layers
object.Visible = True
Next

VBScript For Each Next Layers


Visible True
myDoc
Layers

:
object x
Set appRef = CreateObject("Illustrator.Application")
Set myDoc = appRef.ActiveDocument
For Each x in myDoc.Layers
x.Visible = True
Next

Adobe
Adobe 6

ESTK

true false

AS

tell
end
with
set

JS

var
if
else
with

VBS

Dim
Set
MsgBox

AppleScript
AppleScript

48

ESTK

49

Cant get object


parent-objectparent-object
tell

Expected "" but found end of script

Requested property not available for this object

: 1

ESTK
ESTK
X

ESTK

JavaScript
artLayer

myDoc.name = "My Document'


myDoc.name = 'My Document'
myDoc.name = "My Document"

JavaScript

Shift+F5

JavaScript

element is undefined
var

VBScript

50

undefined is not an object

app

VBScript
VBScript Windows

AppleScript
AppleScript
X AppleScript for the Internet: Visual QuickStart GuideEthan Wilde Peachpit Press
1998 ISBN 0-201-35359-8
X AppleScript Language Guide: English DialectApple Inc. Addison-Wesley Publishing Co.
1993 ISBN 0-201-40735-3
X Danny Goodman's AppleScript Handbook 2 Danny Goodman iUniverse 1998

ISBN 0-966-55141-9
X

Apple Inc. AppleScript Web


www.apple.com/applescript

JavaScript
JavaScript
X JavaScript: The Definitive GuideDavid Flanagan OReilly Media Inc. 2002

ISBN 0-596-00048-0
X JavaScript BibleDanny Goodman Hungry Minds Inc. 2001 ISBN 0-7645-4718-6
X Adobe ScriptingChandler McWilliams Wiley Publishing, Inc. 2003 ISBN 0-7645-2455-0

VBScript
VBScript VBA
X Learn to Program with VBScript 6
John Smiley Active Path 1998

ISBN 1-902-74500-0
X Microsoft VBScript 6.0 ProfessionalMichael Halvorson Microsoft Press 1998

ISBN 1-572-31809-0
X VB & VBA in a Nutshell
Paul Lomax O'Reilly 1998 ISBN 1-56592-358-8
X

Microsoft Developers NetworkMSDN Web


msdn.microsoft.com/scripting

51

AppleScript
Web , 51

var, 11
VBScript

, 8
, 6
, 32

, 8
, 8
, 35
, 6

D
DOM
, 10
, 10

, 5
, 19

ESTK
JS , 35
, 7
, 49
ExtendScript
, 7

, 13
, 14

I
if else , 45
if , 44
IllustratorAdobe Illustrator

J
JavaScript
, 15
, 8
, 7
, 7
JavaScript , 7

AS , 32, 34
VBS , 36
, 15
, 10
, 15
, 13
, 10
, 9
, 40
, 9
, 13
, 10

, 7

tell AS, 26

52

53

AS , 32, 34
, 23
, 23
, 28

, 30
, 30
, 17

, 24
, 24
, 42
AS, 25
, 9
, 24
, 25
AS, 25

, 51

, 44

, 5
, 6
, 6

, 7

AppleScript , 32
, 6
, 48
, 28

, 19

, 23, 24
, 9

, 16

AS , 32
VBS , 36
, 16
, 41
, 16
, 9
, 17
, 19
, 19

, 16
, 32

, 21
, 16

, 29

, 11
, 27
, 27
, 11
, 11
, 16
, 22
, 12

54

, 10, 12
, 40

, 5

VBS , 39
, 23
, 42
, 9
, 23

, 16

, 40

, 46

, 21
, 16

You might also like