Adobe 23101764 Scripting Guide - Page 93

Channel object

Page 93 highlights

Scripting Photoshop 3 Channel object VB: Dim theChannels As Variant theChannels = Array(docRef.Channels("Red"), docRef.Channels("Blue")) docRef.ActiveChannels = theChannels JS: theChannels = new Array(docRef.channels["Red"], docRef.channels["Blue"]); docRef.activeChannels = theChannels; Or you can easily select all component channels by using the "component channel" property on the document: AS: set current channels of current document to component channels ¬ of current document VB: appRef.ActiveDocument.ActiveChannels= _ appRef.ActiveDocument.ComponentChannels JS: app.activeDocument.activeChannels = activeDocument.componentChannels; 3.13.2 Other filters If the filter type that you want to use on your layer is not part of the scripting interface, you can use the Action Manager from a JavaScript to run a filter. If you are using AppleScript, Visual Basic or VBScript, you can still run a JavaScript from your script. 3.14 Channel object The Channel object (Channel/channel) gives you access to much of the available functionality on Photoshop channels. You can create, delete and duplicate channels or retrieve a channel's histogram and change its kind or change the current channel selection. 3.14.1 Channel types In addition to the component channels, Photoshop lets you to create additional channels. You can create a "spot color channel", a "masked area channel" and a "selected area channel." It's important to keep the different types of channels in mind when writing scripts that work on them. Photoshop CS Scripting Guide 89

  • 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
89
Scripting Photoshop
Channel object
3
VB:
Dim theChannels As Variant
theChannels = Array(docRef.Channels("Red"), docRef.Channels("Blue"))
docRef.ActiveChannels = theChannels
JS:
theChannels = new Array(docRef.channels["Red"],
docRef.channels["Blue"]);
docRef.activeChannels = theChannels;
Or you can easily select all component channels by using the “component channel” property
on the document:
AS:
set current channels of current document to component channels ¬
of current document
VB:
appRef.ActiveDocument.ActiveChannels= _
appRef.ActiveDocument.ComponentChannels
JS:
app.activeDocument.activeChannels =
activeDocument.componentChannels;
3.13.2 Other
lters
If the
lter type that you want to use on your layer is not part of the scripting interface, you can
use the Action Manager from a JavaScript to run a
lter. If you are using AppleScript, Visual
Basic or VBScript, you can still run a JavaScript from your script.
3.14 Channel object
The Channel
object
(Channel/channel)
gives you access to much of the available
functionality on Photoshop channels. You can create, delete and duplicate channels or retrieve
a channel's histogram and change its kind or change the current channel selection.
3.14.1
Channel types
In addition to the component channels, Photoshop lets you to create additional channels. You
can create a “spot color channel”, a “masked area channel” and a “selected area channel.”
It’s important to keep the different types of channels in mind when writing scripts that work on
them.