Adobe 23101764 Scripting Guide - Page 101

Cut, 17.4 Paste

Page 101 highlights

Scripting Photoshop 3 Clipboard interaction 3.17.3 Cut The Cut command operates on both art layers and selections, so you can cut an entire art layer or only the selection of a visible layer. The Cut method follows the same rules as the copy command. AS: activate cut selection of current layer of current document VB: docRef.Selection.Cut JS: docRef.selection.cut(); 3.17.4 Paste The paste command can be used on any open document, and operates on the current document. You must make the paste command's target document the current document before using the command. A new layer is created by the paste command, and a reference to it is returned. If there is no selection in the target document, the contents of the clipboard are pasted into the geometric center of the document. Here's how to paste into a document named "Doc2": AS: activate set current document to document "Doc2" set newLayerRef to paste In Visual Basic and JavaScript the paste command is defined on the Document object. VB: appRef.ActiveDocument = appRef.Documents("Doc2") Set newLayerRef = docRef.Paste JS: activeDocument = documents["Doc2"]; var newLayerRef = docRef.paste(); Photoshop CS Scripting Guide 97

  • 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
97
Scripting Photoshop
Clipboard interaction
3
3.17.3 Cut
The Cut command operates on both art layers and selections, so you can cut an entire art layer
or only the selection of a visible layer. The Cut method follows the same rules as the copy
command.
AS:
activate
cut selection of current layer of current document
VB:
docRef.Selection.Cut
JS:
docRef.selection.cut();
3.17.4 Paste
The paste command can be used on any open document, and operates on the current
document. You must make the paste command's target document the current document before
using the command. A new layer is created by the paste command, and a reference to it is
returned. If there is no selection in the target document, the contents of the clipboard are
pasted into the geometric center of the document.
Here’s how to paste into a document named “Doc2”:
AS:
activate
set current document to document "Doc2"
set newLayerRef to paste
In Visual Basic and JavaScript the paste command is de
ned on the Document object.
VB:
appRef.ActiveDocument = appRef.Documents("Doc2")
Set newLayerRef = docRef.Paste
JS:
activeDocument = documents["Doc2"];
var newLayerRef = docRef.paste();