Tải bản đầy đủ (.pdf) (335 trang)

Photoshop JavaScript Reference ppsx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.36 MB, 335 trang )

bbc
Adobe
®
Photoshop
®
cs2
Photoshop JavaScript Reference
© 2005 Adobe Systems Incorporated. All rights reserved.
Adobe® Creative Suite 2 Photoshop
®
JavaScript Scripting Reference for Windows
®
and 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, GoLive, Illustrator, 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. 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 37
Script Support in Adobe Photoshop CS2 37
JavaScript support 38
Executing scripts 38
Installing scripts 38
Executing other scripts 38
Startup scripts 38
Changes Since Earlier Versions 39
Changes in ScriptUI 39
2 JavaScript Object Reference 41
Working with the Properties Tables 41
displayDialogs 41
Working with the Methods Tables 41
executeAction 42
Working with Method Parameters 42
ActionDescriptor 43
Properties 43
count 43

typename 43
Methods 43
clear 43
erase 43
fromStream 43
getBoolean 43
getClass 43
getData 43
getDouble 43
getEnumerationType 43
getEnumerationValue 43
getInteger 43
getKey 43
getList 43
getObjectType 44
getObjectValue 44
getPath 44
getReference 44
getString 44
getType 44
getUnitDoubleType 44
getUnitDoubleValue 44
hasKey 44
isEqual 44
putBoolean 44
putClass 44
putData 44
Adobe Photoshop CS2
JavaScript Scripting Reference 4
putDouble 44

putEnumerated 44
putInteger 44
putList 45
putObject 45
putPath 45
putReference 45
putString 45
putUnitDouble 45
toStream 45
ActionList 46
count 46
typename 46
clear 46
getBoolean 46
getClass 46
getData 46
getDouble 46
getEnumerationType 46
getEnumerationValue 46
getInteger 46
getList 46
getObjectType 46
getObjectValue 47
getPath 47
getReference 47
getString 47
getType 47
getUnitDoubleType 47
getUnitDoubleValue 47
putBoolean 47

putClass 47
putData 47
putDouble 47
putEnumerated 47
putInteger 47
putList 47
putObject 47
putPath 47
putReference 48
putString 48
putUnitDouble 48
ActionReference 49
Properties 49
typename 49
Methods 49
getContainer 49
getDesiredClass 49
getEnumeratedType 49
getEnumeratedValue 49
getForm
49
Adobe Photoshop CS2
JavaScript Scripting Reference 5
getIdentifier 49
getIndex 49
getName 49
getOffset 49
getProperty 49
putClass 49
putEnumerated 50

putIdentifier 50
putIndex 50
putName 50
putOffset 50
putProperty 50
Application 51
Properties 51
activeDocument 51
backgroundColor 51
colorSettings 51
displayDialogs 51
documents 51
fonts 51
foregroundColor 51
freeMemory 51
locale 51
macintoshFileTypes 51
name 51
notifiers 52
notifiersEnabled 52
path 52
playbackDisplayDialogs 52
playbackParameters 52
preferences 52
preferencesFolder 52
scriptingVersion 52
typename 52
version 52
windowsFileTypes 52
Methods 53

batch 53
beep 53
bringToFront 53
charIDToTypeID 53
doAction 53
executeAction 53
executeActionGet 53
load 53
makeContactSheet 53
makePDFPresentation 53
makePhotoGallery 53
makePhotomerge 54
makePicturePackage 54
open
54
Adobe Photoshop CS2
JavaScript Scripting Reference 6
purge 54
stringIDToTypeID 54
typeIDToCharID 54
typeIDToStringID 54
Second Sample Script 56
ArtLayer 57
Properties 57
allLocked 57
blendMode 57
bounds 57
fillOpacity 57
grouped 57
isBackgroundLayer 57

kind 57
linkedLayers 57
name 58
opacity 58
parent 58
pixelsLocked 58
positionLocked 58
textItem 58
transparentPixelsLocked 58
typename 58
visible 58
Methods 58
adjustBrightnessContrast 58
adjustColorBalance 58
adjustCurves 58
adjustLevels 59
applyAddNoise 59
applyAverage 59
applyBlur 59
applyBlurMore 59
applyClouds 59
applyCustomFilter 59
applyDeInterlace 59
applyDespeckle 59
applyDifferenceClouds 59
applyDiffuseGlow 59
applyDisplace 59
applyDustAndScratches 60
applyGaussianBlur 60
applyGlassEffect 60

applyHighPass 60
applyLensBlur 60
applyLensFlare 60
applyMaximum 60
applyMedianNoise 60
applyMinimum 60
applyMotionBlur 60
applyNTSC
60
Adobe Photoshop CS2
JavaScript Scripting Reference 7
applyOceanRipple 60
applyOffset 61
applyPinch 61
applyPolarCoordinates 61
applyRadialBlur 61
applyRipple 61
applySharpen 61
applySharpenEdges 61
applySharpenMore 61
applyShear 61
applySmartBlur 61
applySpherize 61
applyStyle 61
applyTextureFill 62
applyTwirl 62
applyUnSharpMask 62
applyWave 62
applyZigZag 62
autoContrast 62

autoLevels 62
clear 62
copy 62
cut 62
desaturate 62
duplicate 63
equalize 63
invert 63
link 63
merge 63
mixChannels 63
move 64
photoFilter 64
posterize 64
rasterize 64
remove 64
resize 64
rotate 64
selectiveColor 65
shadowHighlight 65
threshold 65
translate 65
unlink 65
ArtLayers 68
Properties 68
length 68
parent 68
typename 68
Methods 68
index 68

add
68
getByName 68
Adobe Photoshop CS2
JavaScript Scripting Reference 8
removeAll 68
BatchOptions 69
Properties 69
destination 69
destinationFolder 69
errorFile 69
fileNaming 69
macintoshCompatible 69
overrideOpen 69
overrideSave 70
startingSerial 70
suppressOpen 70
suppressProfile 70
typename 70
unixCompatible 70
windowsCompatible 70
BitmapConversionOptions 71
Properties 71
angle 71
frequency 71
method 71
patternName 71
resolution 71
shape 71
typename 71

BMPSaveOptions 72
Properties 72
alphaChannels 72
depth 72
flipRowOrder 72
osType 72
rleCompression 72
typename 72
CameraRawOpenOptions 73
Properties 73
bitsPerChannel 73
blueHue 73
blueSaturation 73
brightness 73
chromaticAberrationBY 73
chromaticAberrationRC 73
colorNoiseReduction 73
colorSpace 73
contrast 73
exposure 73
greenHue 73
greenSaturation 73
luminanceSmoothing 73
redHue 73
redSaturation 73
resolution
73
Adobe Photoshop CS2
JavaScript Scripting Reference 9
saturation 73

settings 73
shadows 73
shadowTint 74
sharpness 74
size 74
temperature 74
tint 74
typename 74
vignettingAmount 74
vignettingMidpoint 74
whiteBalance 74
Channel 75
Properties 75
color 75
histogram 75
kind 75
name 75
opacity 75
parent 75
typename 76
visible 76
Methods 76
duplicate 76
merge 76
delete 76
Channels 77
Properties 77
length 77
parent 77
typename 77

Methods 77
index 77
add 77
getByName 77
removeAll 77
CMYKColor 82
Properties 82
black 82
cyan 82
magenta 82
typename 82
yellow 82
ContactSheetOptions 83
Properties 83
acrossFirst 83
bestFit 83
caption 83
columnCount 83
flatten 83
font
83
Adobe Photoshop CS2
JavaScript Scripting Reference 10
fontSize 83
height 83
horizontal 83
mode 83
resolution 83
rowCount 83
typename 83

useAutoSpacing 83
vertical 84
width 84
DCS1_SaveOptions 85
Properties 85
dCS 85
embedColorProfile 85
encoding 85
halftoneScreen 85
interpolation 85
preview 85
transferFunction 85
typename 85
vectorData 85
DCS2_SaveOptions 86
Properties 86
dCS 86
embedColorProfile 86
encoding 86
halftoneScreen 86
interpolation 86
multiFileDCS 86
preview 86
spotColors 86
transferFunction 86
typename 86
vectorData 86
Document 87
Properties 87
activeChannels 87

activeHistoryBrushSource 87
activeHistoryState 87
activeLayer 87
artLayers 87
backgroundLayer 87
bitsPerChannel 87
channels 87
colorProfileName 87
colorProfileType 87
componentChannels 88
fullName 88
height 88
histogram 88
historyStates
88
Adobe Photoshop CS2
JavaScript Scripting Reference 11
info 88
layerComps 88
layers 88
layerSets 88
managed 88
mode 88
name 88
parent 88
path 88
pathItems 88
pixelAspectRatio 88
quickMaskMode 88
resolution 88

saved 88
selection 88
typename 88
width 89
xmpMetadata 89
Methods 90
changeMode 90
close 90
convertProfile 90
crop 90
duplicate 90
exportDocument 90
flatten 90
flipCanvas 91
importAnnotations 91
mergeVisibleLayersl 91
paste 91
print 91
rasterizeAllLayers 91
resizeCanvas 91
resizeImage 91
revealAll 91
rotateCanvas 92
save 92
saveAs 92
splitChannels 92
trap 92
trim 92
DocumentInfo 95
Properties 95

author 95
authorPosition 95
caption 95
captionWriter 95
category 95
city 95
copyrighted 95
copyrightNotice
95
Adobe Photoshop CS2
JavaScript Scripting Reference 12
country 95
creationDate 95
credit 95
exif 95
headline 95
instructions 95
jobName 95
keywords 95
ownerUrl 95
parent 96
provinceState 96
source 96
supplementalCategories 96
title 96
transmissionReference 96
typename 96
urgency 96
Documents 99
Properties 99

length 99
parent 99
typename 99
Methods 99
index 99
add 99
getByName 99
EPSOpenOptions 100
Properties 100
antiAlias 100
constrainProportions 100
height 100
mode 100
resolution 100
typename 100
width 100
EPSSaveOptions 101
Properties 101
embedColorProfile 101
encoding 101
halftoneScreen 101
interpolation 101
preview 101
psColorManagement 101
transferFunction 101
transparentWhites 101
typename 101
vectorData 101
ExportOptionsIllustrator 102
Properties 102

path 102
pathName
102
Adobe Photoshop CS2
JavaScript Scripting Reference 13
typename 102
ExportOptionsSaveForWeb 103
Properties 103
blur 103
colorReduction 103
colors 103
dither 103
ditherAmount 103
format 103
includeProfile 103
interlaced 103
lossy 103
matteColor 103
optimized 103
PNG8 104
quality 104
transparency 104
transparencyAmount 104
transparencyDither 104
typename 104
webSnap 104
GalleryBannerOptions 105
Properties 105
contactInfo 105
date 105

font 105
fontSize 105
photographer 105
siteName 105
typename 105
GalleryCustomColorOptions 106
Properties 106
activeLinkColor 106
backgroundColor 106
bannerColor 106
linkColor 106
textColor 106
typename 106
visitedLinkColor 106
GalleryImagesOptions 107
Properties 107
border 107
caption 107
dimension 107
font 107
fontSize 107
imageQuality 107
includeCopyright 107
includeCredits 107
includeFilename
108
includeTitle 108
Adobe Photoshop CS2
JavaScript Scripting Reference 14
numericLinks 108

resizeConstraint 108
resizeImages 108
typename 108
GalleryOptions 109
Properties 109
addSizeAttributes 109
bannerOptions 109
customColorOptions 109
emailAddress 109
imagesOptions 109
includeSubFolders 109
layoutStyle 109
preserveAllMetadata 109
securityOptions 109
thumbnailOptions 109
typename 109
useShortExtension 109
useUTF8Encoding 109
GallerySecurityOptions 110
Properties 110
content 110
font 110
fontSize 110
opacity 110
text 110
textColor 110
textPosition 110
textRotate 110
typename 110
GalleryThumbnailOptions 111

Properties 111
border 111
caption 111
columnCount 111
dimension 111
font 111
fontSize 111
includeCopyright 111
includeCredits 111
includeFilename 111
includeTitle 111
rowCount 111
size 111
typename 111
GIFSaveOptions 112
Properties 112
colors 112
dither 112
ditherAmount 112
forced
112
Adobe Photoshop CS2
JavaScript Scripting Reference 15
interlaced 112
matte 112
palette 112
preserveExactColors 112
transparency 113
typename 113
GrayColor 114

Properties 114
gray 114
typename 114
HistoryState 115
Properties 115
name 115
parent 115
snapshot 115
typename 115
HistoryStates 116
Properties 116
length 116
parent 116
typename 116
Methods 116
index 116
getByName 116
HSBColor 117
Properties 117
brightness 117
hue 117
saturation 117
typename 117
IndexedConversionOptions 118
Properties 118
colors 118
dither 118
ditherAmount 118
forced 118
matte 118

palette 118
preserveExactColors 118
transparency 118
typename 118
JPEGSaveOptions 119
Properties 119
embedColorProfile 119
formatOptions 119
matte 119
quality 119
scans 119
typename 119
LabColor 120
Properties
120
Adobe Photoshop CS2
JavaScript Scripting Reference 16
a 120
b 120
l 120
typename 120
LayerComp 121
Properties 121
appearance 121
comment 121
name 121
parent 121
position 121
selected 121
typename 121

visibility 121
Methods 121
apply 121
recapture 121
remove 122
resetfromComp 122
LayerComps 123
Properties 123
length 123
parent 123
typename 123
Methods 123
index 123
add 123
getByName 123
removeAll 123
Layers 124
Properties 124
length 124
parent 124
typename 124
Methods 124
index 124
getByName 124
removeAll 124
LayerSet 125
Properties 125
allLocked 125
artLayers 125
blendMode 125

bounds 125
enabledChannels 125
layers 125
layerSets 125
linkedLayers 125
name 125
opacity 125
parent
125
Adobe Photoshop CS2
JavaScript Scripting Reference 17
typename 125
visible 125
Methods 126
duplicate 126
link 126
merge 126
move 126
remove 126
resize 126
rotate 126
translate 126
unlink 126
LayerSets 127
Properties 127
length 127
parent 127
typename 127
Methods 127
index 127

add 127
getByName 127
removeAll 127
LensBlurOptions 129
Properties 129
amount 129
bladeCurvature 129
brightness 129
distribution 129
focalDistance 129
invertDepthMap 129
monochromatic 129
radius 129
rotation 129
shape 129
source 129
threshold 129
typename 129
NoColor 130
Properties 130
typename 130
Notifier 131
Properties 131
event 131
eventClass 131
eventFile 131
parent 131
typename 131
Methods 131
remove 131

Notifiers 132
Properties
132
Adobe Photoshop CS2
JavaScript Scripting Reference 18
length 132
parent 132
typename 132
Methods 132
index 132
add 133
removeAll 133
PathItem 134
Properties 134
kind 134
name 134
parent 134
SubPathItems 134
typename 134
Methods 134
deselect 134
duplicate 134
fillPath 134
makeClippingPath 135
makeSelection 135
remove 135
select 135
strokePath 135
PathItems 138
Properties 138

length 138
parent 138
typename 138
Methods 138
index 138
add 138
getByName 138
removeAll 138
PathPoint 139
Properties 139
anchor 139
kind 139
leftDirection 139
parent 139
rightDirection 139
typename 139
PathPointInfo 140
Properties 140
anchor 140
kind 140
leftDirection 140
rightDirection 140
typename 140
PathPoints 141
Properties 141
length
141
Adobe Photoshop CS2
JavaScript Scripting Reference 19
parent 141

typename 141
index 141
PDFOpenOptions 142
Properties 142
antiAlias 142
bitsPerChannel 142
constrainProportions 142
cropPage 142
height 142
mode 142
name 142
page 142
resolution 142
suppressWarnings 142
typename 142
usePageNumber 142
width 142
PDFSaveOptions 143
Properties 143
alphaChannels 143
annotations 143
colorConversion 143
convertToEightBit 143
descripton 143
destinationProfile 143
downgradeColorProfile 143
downSample 143
downSampleSize 143
downSampleSizeLimit 143
embedColorProfile 143

embedFonts 143
embedThumbnail 143
encoding 143
interpolation 143
jpegQuality 144
layers 144
optimizeForWeb 144
outputCondition 144
outputConditionID 144
PDFCompatibility 144
PDFStandard 144
preserveEditing 144
presetFile 144
profileInclusionPolicy 144
registryName 144
spotColors 144
tileSize 144
transparency 144
typename 144
useOutlines
145
Adobe Photoshop CS2
JavaScript Scripting Reference 20
vectorData 145
view 145
PhotoCDOpenOptions 146
Properties 146
colorProfileName 146
colorSpace 146
orientation 146

pixelSize 146
resolution 146
typename 146
PhotoshopSaveOptions 147
Properties 147
alphaChannels 147
annotations 147
embedColorProfile 147
layers 147
spotColors 147
typename 147
PICTFileSaveOptions 148
Properties 148
alphaChannels 148
compression 148
embedColorProfile 148
resolution 148
typename 148
PICTResourceSaveOptions 149
Properties 149
alphaChannels 149
compression 149
embedColorProfile 149
name 149
resolution 149
resourceID 149
typename 149
PicturePackageOptions 150
Properties 150
content 150

flatten 150
font 150
fontSize 150
layout 150
mode 150
opacity 150
resolution 150
text 150
textColor 150
textPosition 150
textRotate 150
typename 150
PixarSaveOptions 151
Properties
151
Adobe Photoshop CS2
JavaScript Scripting Reference 21
alphaChannels 151
typename 151
PNGSaveOptions 152
Properties 152
interlaced 152
typename 152
Preferences 153
Properties 153
additionalPluginFolder 153
appendExtension 153
askBeforeSavingLayeredTIFF 153
autoUpdateOpenDocuments 153
beepWhenDone 153

colorChannelsInColor 153
colorPicker 153
columnGutter 153
columnWidth 153
createFirstSnapshot 154
dynamicColorSliders 154
editLogItems 154
exportClipboard 154
fontPreviewSize 154
fullSizePreview 154
gamutWarningOpacity 154
gridSize 154
gridStyle 154
gridSubDivisions 154
guideStyle 154
iconPreview 154
imageCacheForHistograms 154
imageCacheLevels 154
imagePreviews 154
interpolation 154
keyboardZoomResizesWindows 155
macOSThumbnail 155
maximizeCompatibility 155
maxRAMuse 155
nonLinearHistory 155
numberofHistoryStates 155
otherCursors 155
paintingCursors 155
parent 155
pixelDoubling 155

pointSize 155
recentFileListLength 155
rulerUnits 155
saveLogItems 155
saveLogItemsFile 155
savePaletteLocations 155
showAsianTextOptions 156
showEnglishFontNames
156
Adobe Photoshop CS2
JavaScript Scripting Reference 22
showSliceNumber 156
showToolTips 156
smartQuotes 156
typename 156
typeUnits 156
useAdditionalPluginFolder 156
useDiffusionDither 156
useHistoryLog 156
useLowerCaseExtension 156
useShiftKeyForToolSwitch 156
useVideoAlpha 156
windowsThumbnail 156
PresentationOptions 157
Properties 157
autoAdvance 157
includeFilename 157
interpolation 157
loop 157
magnification 157

pDFFileOptions 157
presentation 157
transition 157
typename 157
RawFormatOpenOptions 158
Properties 158
bitsPerChannel 158
byteOrder 158
channelNumber 158
headerSize 158
height 158
interleaveChannels 158
retainHeader 158
typename 158
width 158
RawSaveOptions 159
Properties 159
alphaChannels 159
spotColors 159
typename 159
RGBColor 160
Properties 160
blue 160
green 160
hexValue 160
red 160
typename 160
Selection 161
Properties 161
bounds 161

parent 161
typename
161
Adobe Photoshop CS2
JavaScript Scripting Reference 23
Methods 161
clear 161
contract 161
copy 161
cut 161
deselect 161
expand 161
feather 161
fill 162
grow 162
invert 162
load 162
makeWorkPath 162
resize 162
resizeBoundary 162
rotate 162
rotateBoundary 162
select 162
selectAll 162
selectBorder 163
similar 163
smooth 163
store 163
stroke 163
translate 163

translateBoundary 163
SGIRGBSaveOptions 166
Properties 166
alphaChannels 166
spotColors 166
typename 166
SolidColor 167
Properties 167
cmyk 167
gray 167
hsb 167
lab 167
model 167
nearestWebColor 167
rgb 167
typename 167
Methods 167
isEqual 167
SubPathInfo 168
Properties 168
closed 168
entireSubPath 168
operation 168
typename 168
SubPathItem 169
Properties
169
Adobe Photoshop CS2
JavaScript Scripting Reference 24
closed 169

operation 169
parent 169
pathPoints 169
typename 169
SubPathItems 170
Properties 170
length 170
parent 170
typename 170
Methods 170
index 170
TargaSaveOptions 171
Properties 171
alphaChannels 171
resolution 171
rleCompression 171
typename 171
TextFont 172
Properties 172
family 172
name 172
parent 172
postScriptName 172
style 172
typename 172
TextFonts 173
Properties 173
length 173
parent 173
typename 173

Methods 173
index 173
getByName 173
TextItem 174
Properties 174
alternateLigatures 174
antiAliasMethod 174
autoKerning 174
autoLeadingAmount 174
baselineShift 174
capitalization 174
color 174
contents 174
desiredGlyphScaling 174
desiredLetterScaling 175
desiredWordScaling 175
175
direction 175
fauxBold
175
fauxItalic 175
Adobe Photoshop CS2
JavaScript Scripting Reference 25
firstLineIndent 175
font 175
hangingPunctuation 176
height 176
horizontalScale 176
hyphenateAfterFirst 176
hyphenateBeforeLast 176

hyphenateCapitalWords 176
hyphenateWordsLongerThan 176
hyphenation 176
hyphenationZone 176
hyphenLimit 176
justification 176
kind 176
language 176
leading 176
leftIndent 176
ligatures 176
maximumGlyphScaling 177
maximumLetterScaling 177
maximumWordScaling 177
minimumGlyphScaling 178
minimumLatterScaling 178
minimumWordScaling 178
noBreak 179
oldStyle 179
parent 179
position 179
rightIndent 179
size 179
spaceAfter 179
spaceBefore 179
strikeThru 179
textComposer 179
tracking 179
typename 179
underline 179

useAutoLeading 180
verticalScale 180
warpBend 180
warpDirection 180
warpHorizontalDistortion 180
warpStyle 180
warpVerticalDistortion 180
width 180
Methods 180
convertToShape 180
createPath 180
TiffSaveOptions 181
Properties
181
alphaChannels 181

×