Adobe 23101335 Scripting Guide - Page 48
Changing ruler and type units, 3.6 Executing JavaScripts from AS or VB
UPC - 718659152833
View all Adobe 23101335 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 48 highlights
Scripting Photoshop 3 Executing JavaScripts from AS or VB TABLE 3.3 Command Parameters AppleScript Visual Basic JavaScript translate boundary (delta x, delta y) Selection.TranslateBoundary selection.translateBoundary (DeltaX, DeltaY) (deltaX, deltaY) 3.5.3 Changing ruler and type units The unit type settings of the two Photoshop 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. 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 In Visual Basic and JavaScript ruler units and type units are properties of the Preferences, accessed through the application object's preferences property as shown below. VB: appRef.Preferences.RulerUnits = PsInches appRef.Preferences.TypeUnits = PsTypePixels appRef.Preferences.PointSize = PsPostScriptPoints JS: preferences.rulerUnits = Units.INCHES; preferences.typeUnits = TypeUnits.PIXELS; preferences.pointSize = PointType.POSTSCRIPT; IMPORTANT: Remember to reset the unit settings back to the original values at the end of a script. 3.6 Executing JavaScripts from AS or VB With Photoshop's scripting support you can run JavaScripts from AppleScript or Visual Basic. For Applescript, use do javascript. Photoshop 7.0 Scripting Guide 48