Adobe 23102480 Scripting Guide - Page 25

Setting the Active Layer, or in the Visual Basic Object Browser.

Page 25 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 25 Setting the Active Layer The following examples demonstrate how to use the current layer (ActiveLayer/activeLayer) property of the Document object to set the active layer. In order to set the active layer for a document, the document itself must be the current document. AS set current layer of current document to layer "Layer 1" of current document Note: By default, Photoshop names the layers "Layer 1", "Layer2", etc. VBS ' This example assumes appRef and docRef have been previously defined and assigned ' to the application object and a document object that contains at least one layer. appRef.ActiveDocument = docRef docRef.ActiveLayer = docRef.Layers(1) Look up the ActiveLayer property on the Document object in the Adobe Photoshop CS3 Visual Basic Scripting Reference, or in the Visual Basic Object Browser. Note: You can also use the name of the layer to indicate which layer to use. By default, Photoshop names the layers "Layer 1", "Layer2". See 'Referencing ArtLayer Objects' on page 36. JS // This example assumes docRef has been previously defined and assigned to a // document object that contains at least one layer. activeDocument = docRef docRef.activeLayer = docRef.layers[0] Look up the activeLayer property on the Document object in the Adobe Photoshop CS3 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer. Note: You can also use the name of the layer to indicate which layer to use. By default, Photoshop names the layers "Layer 1", "Layer2". See 'Referencing ArtLayer Objects' on page 36. Setting the Active Channels More than one channel can be active at a time, so the current channels (ActiveChannels/activeChannels) property of the Document object takes an array of channels as a value. In order to set the active channels of a document, it must be the active document. AS Set the active channels to the first and third channel using a channel array: set current channels of current document to ¬ { channel 1 of current document, channel 3 of current document } Alternatively, select all component channels using the component channels property of the Document object. set current channels of current document to component channels ¬ of current document VBS Set the active channels of the active document to the first and third channel using a channel array:

  • 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

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Scripting Photoshop CS3
25
Setting the Active Layer
The following examples demonstrate how to use the
current layer (ActiveLayer/activeLayer)
property of the
Document
object to set the active layer. In order to set the active layer for a document, the
document itself must be the current document.
AS
set current layer of current document to layer “Layer 1” of current document
Note:
By default, Photoshop names the layers “Layer 1”, “Layer2”, etc.
VBS
‘ This example assumes appRef and docRef have been previously defined and assigned
‘ to the application object and a document object that contains at least one layer.
appRef.ActiveDocument = docRef
docRef.ActiveLayer = docRef.Layers(1)
Look up the
ActiveLayer
property on the
Document
object in the
Adobe Photoshop CS3 Visual Basic
Scripting Reference
, or in the Visual Basic Object Browser.
Note:
You can also use the name of the layer to indicate which layer to use. By default, Photoshop names
the layers “Layer 1”, “Layer2”. See
‘Referencing ArtLayer Objects’ on page 36
.
JS
// This example assumes docRef has been previously defined and assigned to a
// document object that contains at least one layer.
activeDocument = docRef
docRef.activeLayer = docRef.layers[0]
Look up the
activeLayer
property on the
Document
object in the
Adobe Photoshop CS3 JavaScript
Scripting Reference
, or in the ExtendScript Object Model Viewer.
Note:
You can also use the name of the layer to indicate which layer to use. By default, Photoshop names
the layers “Layer 1”, “Layer2”. See
‘Referencing ArtLayer Objects’ on page 36
.
Setting the Active Channels
More than one channel can be active at a time, so the
current channels
(
ActiveChannels
/
activeChannels
) property of the
Document
object takes an array of channels
as a value. In order to set the active channels of a document, it must be the active document.
AS
Set the active channels to the first and third channel using a channel array:
set current channels of current document to ¬
{ channel 1 of current document, channel 3 of current document }
Alternatively, select all component channels using the
component channels
property of the
Document
object.
set current channels of current document to component channels ¬
of current document
VBS
Set the active channels of the active document to the first and third channel using a channel array: