Adobe 23101764 Scripting Guide - Page 65

Changing ruler and type units

Page 65 highlights

Scripting Photoshop 3 Working with units * Unit values based on type ruler setting TABLE 3.3 Command Parameters AppleScript Visual Basic JavaScript crop (bounds, height, width) Document.Crop (Bounds, Height, Width) document.crop (bounds, height, width) resize canvas (height, width) Document.ResizeCanvas (Height, Width) document.resizeCanvas (height, width) resize image (height, width) Document.ResizeImage (Height, Width) document.resizeImage (height, width) contract (by) Selection.Contract (By) selection.contract (by) expand (by) Selection.Expand (By) selection.expand (by) feather (by) Selection.Feather (By) selection.feather (by) select border (width) Selection.SelectBorder (Width) selection.selectBorder (width) translate (delta x, delta y) Selection.Translate (DeltaX, DeltaY) selection.translate (deltaX, deltaY) translate boundary (delta x, delta y) Selection.TranslateBoundary selection.translateBoundary (DeltaX, DeltaY) (deltaX, deltaY) 3.6.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 Photoshop CS Scripting Guide 61

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

Photoshop CS Scripting Guide
61
Scripting Photoshop
Working with units
3
* Unit values based on type ruler setting
3.6.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
T
ABLE
3.3
Command Parameters
AppleScript
Visual Basic
JavaScript
crop
(bounds, height, width)
Document.Crop
(Bounds, Height, Width)
document.crop
(bounds, height, width)
resize canvas
(height, width)
Document.ResizeCanvas
(Height, Width)
document.resizeCanvas
(height, width)
resize image
(height, width)
Document.ResizeImage
(Height, Width)
document.resizeImage
(height, width)
contract
(by)
Selection.Contract
(By)
selection.contract
(by)
expand
(by)
Selection.Expand
(By)
selection.expand
(by)
feather
(by)
Selection.Feather
(By)
selection.feather
(by)
select border
(width)
Selection.SelectBorder
(Width)
selection.selectBorder
(width)
translate
(delta x, delta y)
Selection.Translate
(DeltaX, DeltaY)
selection.translate
(deltaX, deltaY)
translate boundary
(delta x, delta y)
Selection.TranslateBoundary
(DeltaX, DeltaY)
selection.translateBoundary
(deltaX, deltaY)