
Photoshop 7.0 Scripting Guide
75
Scripting Photoshop
Channel object
3
VB:
appRef.ActiveDocument.ActiveChannels= _
appRef.ActiveDocument.ComponentChannels
JS:
activeDocument.activeChannels = activeDocument.componentChannels;
3.12.2 Other filters
If the filter type that you want to use on your layer is not part of the scripting interface, you can
also 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.
See section
3.17, “Action Manager scripting” on page 84
for more information.
3.13 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.13.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.
If you have an RGB document you automatically get a red, blue and a green channel. These
kinds of channels are related to the document mode and are called “component channels.”
In the Scripting model a Channel has a
kind
property you can use to get and set the type of the
channel. Possible values are:
component channel, masked area channel,
selected area channel
and
spot color channel
.
You cannot change the kind of a component channel. But you could change a “masked area
channel” to be “selected area channel” by saying:
AS:
set kind of myChannel to selected area channel
VB:
channelRef.kind = psSelectedAreaAlphaChannel
JS:
channelRef.kind = ChannelType.SELECTEDAREA;