Adobe 23102480 Scripting Guide - Page 24

Setting the Active Document, The following examples demonstrate how to set the active document.

Page 24 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 24 Setting the Active Document The following examples demonstrate how to set the active document. AS --create 2 documents set docRef to make new document with properties ¬ {width:4 as inches, height:4 as inches} set otherDocRef to make new document with properties ¬ {width:4 as inches, height:6 as inches} --make docRef the active document set current document to docRef --here you would include command statements --that perform actions on the active document. Then, you could --make a different document the active document --use the current document property of the application class to --bring otherDocRef front-most as the new active document set current document to otherDocRef VBS 'Create 2 documents Set docRef = app.Documents.Add ( 4, 4) Set otherDocRef = app.Documents.Add (4,6) 'make docRef the active document Set app.ActiveDocument = docRef 'here you would include command statements 'that perform actions on the active document. Then, you could 'make a different document the active document 'use the ActiveDocument property of the Application object to 'bring otherDocRef front-most as the new active document Set app.ActiveDocument = otherDocRef JS // Create 2 documents var docRef = app.documents.add( 4, 4) var otherDocRef = app.documents.add (4,6) //make docRef the active document app.activeDocument = docRef //here you would include command statements //that perform actions on the active document. Then, you could //make a different document the active document //use the activeDocument property of the Application object to //bring otherDocRef front-most as the new active document app.activeDocument = otherDocRef

  • 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
24
Setting the Active Document
The following examples demonstrate how to set the active document.
AS
--create 2 documents
set docRef to make new document with properties ¬
{width:4 as inches, height:4 as inches}
set otherDocRef to make new document with properties ¬
{width:4 as inches, height:6 as inches}
--make docRef the active document
set current document to docRef
--here you would include command statements
--that perform actions on the active document. Then, you could
--make a different document the active document
--use the current document property of the application class to
--bring otherDocRef front-most as the new active document
set current document to otherDocRef
VBS
'Create 2 documents
Set docRef = app.Documents.Add ( 4, 4)
Set otherDocRef = app.Documents.Add (4,6)
'make docRef the active document
Set app
.
ActiveDocument = docRef
'here you would include command statements
'that perform actions on the active document. Then, you could
'make a different document the active document
'use the ActiveDocument property of the Application object to
'bring otherDocRef front-most as the new active document
Set app
.
ActiveDocument = otherDocRef
JS
// Create 2 documents
var docRef = app.documents.add( 4, 4)
var otherDocRef = app.documents.add (4,6)
//make docRef the active document
app
.
activeDocument = docRef
//here you would include command statements
//that perform actions on the active document. Then, you could
//make a different document the active document
//use the activeDocument property of the Application object to
//bring otherDocRef front-most as the new active document
app
.
activeDocument = otherDocRef