Adobe 23101764 Scripting Guide - Page 86

De, ning selections

Page 86 highlights

Scripting Photoshop 3 Selections For example, you may apply effects to a selection or copy the current selection to the clipboard. But remember that you may have to set the active layer before acting on the selection. Here's how: AS: set current layer of current document to layer "Layer 1" of ¬ current document VB: docRef.ActiveLayer = docRef.Layers("Layer 1") JS: docRef.activeLayer = docRef.layers["Layer 1"]; See section 3.10.1, "Setting the Active layer" on page 75 for more information. 3.12.1 Defining selections To create a new selection, use the select method with a type of replaced (psReplaceSelection/SelectionType.REPLACED). The other selection types are diminished, extended and intersected. The diminished type shrinks the current selection, the extended selection type expands the current selection, and the intersected type finds the intersection of the current selection and the new selection and replace the current selection with the intersection of the two. If there is no intersection between the selections, the new selection will be empty. If there is no current selection, the new selection will be the newly specified selection. Here are examples of how to replace the current selection: AS: select current document region {{ 5, 5}, {5, 100}, ¬ { 80, 100}, { 80, 5}} combination type replaced Photoshop CS Scripting Guide 82

  • 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
82
Scripting Photoshop
Selections
3
For example, you may apply effects to a selection or copy the current selection to the
clipboard. But remember that you may have to set the active layer before acting on the
selection. Here’s how:
AS:
set current layer of current document to layer "Layer 1" of ¬
current document
VB:
docRef.ActiveLayer = docRef.Layers("Layer 1")
JS:
docRef.activeLayer = docRef.layers["Layer 1"];
See section
3.10.1, “Setting the Active layer” on page 75
for more information.
3.12.1 De
ning selections
To create a new selection, use the
select
method with a type of
replaced
(psReplaceSelection/SelectionType.REPLACED)
. The other selection types are
diminished, extended
and
intersected
.
The
diminished
type shrinks the current selection, the
extended
selection type expands the
current selection, and the
intersected
type finds the intersection of the current selection
and the new selection and replace the current selection with the intersection of the two.
If there is no intersection between the selections, the new selection will be empty. If there is no
current selection, the new selection will be the newly speci
ed selection.
Here are examples of how to replace the current selection:
AS:
select current document region {{ 5, 5}, {5, 100}, ¬
{ 80, 100}, { 80, 5}} combination type replaced