Adobe 23101335 Scripting Guide - Page 69

Stroking the selection border

Page 69 highlights

Scripting Photoshop 3 Selections VB: Dim appRef As New Photoshop.Application 'remember unit settings; and set to values expected by this script Dim originalRulerUnits As Photoshop.PsUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences.RulerUnits = psPixels 'get selection and replace it Dim docRef As Photoshop.Document Set docRef = appRef.ActiveDocument docRef.Selection.Select Array(Array(50, 60), Array(150, 60), _ Array(150, 120), Array(50, 120)), Type:=psReplaceSelection 'restore unit setting appRef.Preferences.RulerUnits = originalRulerUnits JS: // remember unit settings; and set to values expected by this // script var originalRulerUnits = preferences.rulerUnits; preferences.rulerUnits = Units.PIXELS; //get selection and replace it; activeDocument.selection.select (new Array(new Array(60, 10), new Array(100, 10), new Array(100, 100), new Array(60, 100)), SelectionType.REPLACE); // restore unit setting preferences.rulerUnits = originalRulerUnits; 3.11.2 Stroking the selection border The following examples show how to stroke the boundaries around the current selection and set the stroke color and width. AS: stroke selection of current document using color ¬ {class:CMYK color,cyan:20, magenta:50, yellow:30, black:0}¬ width 5 location inside blend mode vivid light opacity 75 ¬ without preserving transparency Photoshop 7.0 Scripting Guide 69

  • 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

Photoshop 7.0 Scripting Guide
69
Scripting Photoshop
Selections
3
VB:
Dim appRef As New Photoshop.Application
'remember unit settings; and set to values expected by this script
Dim originalRulerUnits As Photoshop.PsUnits
originalRulerUnits = appRef.Preferences.RulerUnits
appRef.Preferences.RulerUnits = psPixels
'get selection and replace it
Dim docRef As Photoshop.Document
Set docRef = appRef.ActiveDocument
docRef.Selection.Select Array(Array(50, 60), Array(150, 60), _
Array(150, 120), Array(50, 120)), Type:=psReplaceSelection
'restore unit setting
appRef.Preferences.RulerUnits = originalRulerUnits
JS:
// remember unit settings; and set to values expected by this
// script
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
//get selection and replace it;
activeDocument.selection.select (new Array(new Array(60, 10), new
Array(100, 10), new Array(100, 100), new Array(60, 100)),
SelectionType.REPLACE);
// restore unit setting
preferences.rulerUnits = originalRulerUnits;
3.11.2 Stroking the selection border
The following examples show how to stroke the boundaries around the current selection and
set the stroke color and width.
AS:
stroke selection of current document using color ¬
{class:CMYK color,cyan:20, magenta:50, yellow:30, black:0}¬
width 5 location inside blend mode vivid light opacity 75 ¬
without preserving transparency