bbc
ADOBE PHOTOSHOP CS6
JAVASCRIPT SCRIPTING REFERENCE
© 2012 Adobe Systems Incorporated. All rights reserved.
Adobe® Creative Suite® 6 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
®
,InDesign
®
, 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
TM
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 ............................................................................................................................... 32
JavaScript support in Adobe Photoshop CS6 ....................................................................................................................32
Executing scripts ....................................................................................................................................................................33
Installing scripts ...............................................................................................................................................................33
Executing other scripts..................................................................................................................................................33
Startup scripts .........................................................................................................................................................................33
Object model usage and naming...........................................................................................................................................34
Changes since earlier versions—CS6 changes ..................................................................................................................34
2 JavaScript Object Reference ..................................................................................................... 35
Object descriptions......................................................................................................................................................................35
Properties notation ...............................................................................................................................................................35
displayDialogs.................................................................................................................................................................35
Methods notation ..................................................................................................................................................................35
crop.....................................................................................................................................................................................36
ActionDescriptor ..........................................................................................................................................................................37
Properties..................................................................................................................................................................................37
count ..................................................................................................................................................................................37
typename .........................................................................................................................................................................37
Methods ....................................................................................................................................................................................37
clear ....................................................................................................................................................................................37
erase ...................................................................................................................................................................................37
fromStream......................................................................................................................................................................37
getBoolean.......................................................................................................................................................................37
getClass .............................................................................................................................................................................37
getData..............................................................................................................................................................................37
getDouble ........................................................................................................................................................................37
getEnumerationType ...................................................................................................................................................37
getEnumerationValue..................................................................................................................................................37
getInteger.........................................................................................................................................................................37
getKey................................................................................................................................................................................37
getLargeInteger .............................................................................................................................................................38
getList ................................................................................................................................................................................38
getObjectType................................................................................................................................................................38
getObjectValue...............................................................................................................................................................38
getPath..............................................................................................................................................................................38
getReference ...................................................................................................................................................................38
getString ...........................................................................................................................................................................38
getType .............................................................................................................................................................................38
getUnitDoubleType......................................................................................................................................................38
getUnitDoubleValue.....................................................................................................................................................38
hasKey................................................................................................................................................................................38
isEqual................................................................................................................................................................................38
putBoolean ......................................................................................................................................................................38
putClass.............................................................................................................................................................................38
putData .............................................................................................................................................................................38
Adobe Photoshop CS6
JavaScript Scripting Reference 4
putDouble ........................................................................................................................................................................38
putEnumerated ..............................................................................................................................................................38
putInteger ........................................................................................................................................................................39
putLargeInteger.............................................................................................................................................................39
putList................................................................................................................................................................................39
putObject..........................................................................................................................................................................39
putPath..............................................................................................................................................................................39
putReference...................................................................................................................................................................39
putString...........................................................................................................................................................................39
putUnitDouble................................................................................................................................................................39
toStream ...........................................................................................................................................................................39
ActionList.........................................................................................................................................................................................40
Properties..................................................................................................................................................................................40
count ..................................................................................................................................................................................40
typename .........................................................................................................................................................................40
Methods ....................................................................................................................................................................................40
clear ....................................................................................................................................................................................40
getBoolean.......................................................................................................................................................................40
getClass .............................................................................................................................................................................40
getData..............................................................................................................................................................................40
getDouble ........................................................................................................................................................................40
getEnumerationType ...................................................................................................................................................40
getEnumerationValue..................................................................................................................................................40
getInteger.........................................................................................................................................................................40
getLargeInteger .............................................................................................................................................................41
getList ................................................................................................................................................................................41
getObjectType................................................................................................................................................................41
getObjectValue...............................................................................................................................................................41
getPath..............................................................................................................................................................................41
getReference ...................................................................................................................................................................41
getString ...........................................................................................................................................................................41
getType .............................................................................................................................................................................41
getUnitDoubleType......................................................................................................................................................41
getUnitDoubleValue.....................................................................................................................................................41
putBoolean ......................................................................................................................................................................41
putClass.............................................................................................................................................................................41
putData .............................................................................................................................................................................41
putDouble ........................................................................................................................................................................41
putEnumerated ..............................................................................................................................................................41
putInteger ........................................................................................................................................................................41
putLargeInteger.............................................................................................................................................................41
putList................................................................................................................................................................................41
putObject..........................................................................................................................................................................42
putPath..............................................................................................................................................................................42
putReference...................................................................................................................................................................42
putString...........................................................................................................................................................................42
putUnitDouble................................................................................................................................................................42
ActionReference ...........................................................................................................................................................................43
Properties..................................................................................................................................................................................43
typename .........................................................................................................................................................................43
Methods ........................................................................................................................
............................................................43
Adobe Photoshop CS6
JavaScript Scripting Reference 5
getContainer ...................................................................................................................................................................43
getDesiredClass..............................................................................................................................................................43
getEnumeratedType.....................................................................................................................................................43
getEnumeratedValue ...................................................................................................................................................43
getForm.............................................................................................................................................................................43
getIdentifier.....................................................................................................................................................................43
getIndex............................................................................................................................................................................43
getName ...........................................................................................................................................................................43
getOffset ...........................................................................................................................................................................43
getProperty......................................................................................................................................................................43
putClass.............................................................................................................................................................................44
putEnumerated ..............................................................................................................................................................44
putIdentifier.....................................................................................................................................................................44
putIndex............................................................................................................................................................................44
putName...........................................................................................................................................................................44
putOffset...........................................................................................................................................................................44
putProperty......................................................................................................................................................................44
Application .....................................................................................................................................................................................45
Properties..................................................................................................................................................................................45
activeDocument.............................................................................................................................................................45
backgroundColor...........................................................................................................................................................45
build....................................................................................................................................................................................45
colorSettings ...................................................................................................................................................................45
displayDialogs.................................................................................................................................................................45
documents .......................................................................................................................................................................45
fonts....................................................................................................................................................................................45
foregroundColor............................................................................................................................................................45
freeMemory .....................................................................................................................................................................45
locale ..................................................................................................................................................................................46
macintoshFileTypes......................................................................................................................................................46
measurementLog ..........................................................................................................................................................46
name...................................................................................................................................................................................46
notifiers .............................................................................................................................................................................46
notifiersEnabled.............................................................................................................................................................46
path.....................................................................................................................................................................................46
playbackDisplayDialogs ..............................................................................................................................................46
playbackParameters .....................................................................................................................................................46
preferences ......................................................................................................................................................................46
preferencesFolder .........................................................................................................................................................46
recentFiles ........................................................................................................................................................................46
scriptingBuildDate ........................................................................................................................................................46
scriptingVersion .............................................................................................................................................................46
systemInformation........................................................................................................................................................46
typename .........................................................................................................................................................................46
version ...............................................................................................................................................................................47
windowsFileTypes.........................................................................................................................................................47
Methods ....................................................................................................................................................................................47
batch ..................................................................................................................................................................................47
beep....................................................................................................................................................................................47
bringToFront ...................................................................................................................................................................47
charIDToTypeID.................................................................................................................
.............................................47