Adobe 23102480 Scripting Guide - Page 54

Understanding Clipboard Interaction, Using the Copy and Paste commands

Page 54 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 54 JavaScript from your script. See 'Action Manager' on page 72 for information on using the Action Manager. Also, see 'Executing JavaScripts from AS or VBS' on page 9. Understanding Clipboard Interaction The clipboard commands in Photoshop CS3 operate on ArtLayer, Selection, and Document objects. The commands can be used to operate on objects within a single document, or to move information between documents. The clipboard commands of the art layer (ArtLayer/ArtLayer) and selection (Selection/Selection) objects are: ● copy (Copy/copy) ● copy merged (Copy Merge parameter value/copy(merge parameter value)) ● cut(Cut/cut) The clipboard commands of the document/Document/Document object are: ● paste (Paste/paste) ● paste into (Paste IntoSelection parameter value/paste(intoSelection parameter value)) Note: For information on copy, copy merged, paste, paste into, and cut functions, see Photoshop CS3 Help. Using the Copy and Paste commands The following examples copy the contents of the background layer to the clipboard, create a new document, and then paste the clipboard contents to the new document. The scripts assume that there is a document already open in Photoshop CS3 and that the document has a background layer. Note: If your script creates a new document in which you paste the clipboard contents, be sure the document uses the same ruler units as the original document. See 'Setting Application Preferences' on page 30 for information. AS Note: On Mac OS, Photoshop CS3 must be the front-most application when executing these commands. You must use the activate command to activate the application before executing any clipboard commands. tell application "Adobe Photoshop CS3" activate select all of current document copy set current layer of current document to layer "Background" ¬ of current document set newDocRef to make new document paste newDocRef end tell VBS 'make firstDocument the active document Set docRef = appRef.ActiveDocument docRef.ArtLayers("Background").Copy

  • 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
54
JavaScript from your script. See
‘Action Manager’ on page 72
for information on using the Action Manager.
Also, see
‘Executing JavaScripts from AS or VBS’ on page 9
.
Understanding Clipboard Interaction
The clipboard commands in Photoshop CS3 operate on
ArtLayer
,
Selection
, and
Document
objects. The
commands can be used to operate on objects within a single document, or to move information between
documents.
The clipboard commands of the
art layer (ArtLayer/ArtLayer)
and
selection
(Selection/Selection)
objects are:
copy (Copy/copy)
copy merged (Copy
Merge parameter value
/copy(
merge parameter value
))
cut(Cut/cut)
The clipboard commands of the
document/Document/Document
object are:
paste (Paste/paste)
paste into (Paste
IntoSelection parameter value
/paste(
intoSelection parameter
value
))
Note:
For information on copy, copy merged, paste, paste into, and cut functions, see Photoshop CS3
Help.
Using the Copy and Paste commands
The following examples copy the contents of the background layer to the clipboard, create a new
document, and then paste the clipboard contents to the new document. The scripts assume that there is a
document already open in Photoshop CS3 and that the document has a background layer.
Note:
If your script creates a new document in which you paste the clipboard contents, be sure the
document uses the same ruler units as the original document. See
‘Setting Application Preferences’
on page 30
for information.
AS
Note:
On Mac OS, Photoshop CS3 must be the front-most application when executing these commands.
You must use the
activate
command to activate the application before executing any clipboard
commands.
tell application "Adobe Photoshop CS3"
activate
select all of current document
copy
set current layer of current document to layer "Background" ¬
of current document
set newDocRef to make new document
paste newDocRef
end tell
VBS
'make firstDocument the active document
Set docRef = appRef.ActiveDocument
docRef.ArtLayers("Background").Copy