Adobe 23102480 Scripting Guide - Page 59
Setting Ruler and Type Units in a Script, Sample Workflow Automation JavaScripts
UPC - 883919080222
View all Adobe 23102480 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 59 highlights
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 59 AppleScript translate (delta x, delta y) translate boundary (delta x, delta y) VBScript JavaScript (Continued) Selection.Translate (DeltaX, DeltaY) selection.translate (deltaX, deltaY) Selection.TranslateBoun dary (DeltaX, DeltaY) selection.translateBou ndary (deltaX, deltaY) Setting Ruler and Type Units in a Script The unit type settings of the two Photoshop CS3 rulers control how numbers are interpreted when dealing with properties and parameters that support unit values. Be sure to set the ruler units as needed at the beginning of your scripts and save and restore the original ruler settings when your script has completed. AS In AppleScript ruler units and type units are properties of the settings-object, accessed through the Application object's settings property as shown below. set ruler units of settings to inch units set type units of settings to pixel units set point size of settings to postscript size VBS In VBScript RulerUnits and TypeUnits are properties of the Preferences object, accessed through the Application object's Preferences property as shown below. appRef.Preferences.RulerUnits = 2 'for PsUnits --> 1 (psInches) appRef.Preferences.TypeUnits = 1 'for PsTypeUnits --> 1 (psPixels) appRef.Preferences.PointSize = 2 '2 indicates psPointType --> 2 (PsPostScriptPoints) JS In JavaScript rulerUnits and typeUnits are properties of the Preferences object, accessed through the Application object's preferences property as shown below. app.preferences.rulerUnits = Units.INCHES app.preferences.typeUnits = TypeUnits.PIXELS app.preferences.pointSize = PointType.POSTSCRIPT Note: Remember to reset the unit settings back to the original values at the end of a script. See 'Working with Document Preferences' on page 60 for an example of how to do this. Sample Workflow Automation JavaScripts The following sample workflow automation JavaScripts are provided with Photoshop CS3 and demonstrate various kinds of scripting usage. The scripts are located in the Presets/Scripts folder in your application directory. See Creating and Running a JavaScript for information on the Presets/Scripts folder.