Here you\'ll find tutorials that don\'t belong to either of the above categories. This is the place for the most extraordinary materials.  Home Photoshop Miscellaneous Using the Clipboard

Using the Clipboard


Using the ClipboardCut, Copy and Paste

If you are new to scripting for Photoshop, please view our Photoshop Scripting Basics tutorial for an introduction to Photoshop scripting and a few exercises about basic JavaScript.

1. Check to for an opened document. If there isn't an opened document, nothing will happen.

if (documents.length > 0) {

}


2. Type in the method you want (cut, copy, or paste) to use followed by parenthesis ( ).

if (documents.length > 0) {
copy();
}


3. If you are cutting or copying an image, you need to specify which layer to cut or copy. If you are pasting an image, you can skip this step. To copy the active layer, type in activeLayer followed by a period to seperate it with the command.

if (documents.length > 0) {
activeLayer.copy();
}


4. Now we need to tell the script which document to cut, copy or paste. To cut, copy or paste the active document, type in activeDocument followed by a period.

if (documents.length > 0) {
activeDocument.activeLayer.copy();
}


5. Save the script and run it inside Photoshop (File> Scripts> Browse). The script should do nothing if you don't have any documents opened. If you have documents opened, it will cut, copy or paste the layer that is active.

Copy Merged

You may also use Photoshop's Copy Merged and Paste Into commands. Let's start off with the Photoshop Copy Merged command. Photoshop's Copy Merged command copies all the layers as one layer.

1. Check to for an opened document. If there isn't an opened document, nothing will happen.

if (documents.length > 0) {

}


2. Type in the copy method to use followed by parenthesis ( ). Inside the parenthesis, type in true.

if (documents.length > 0) {
copy(true);
}


3. Now we need to tell Photoshop to copy within the selection. Type in selection followed by a period.

if (documents.length > 0) {
selection.copy(true);
}


4. Finally, we need to tell the script to copy from the active document by typing in activeDocument followed by a period.

if (documents.length > 0) {
activeDocument.selection.copy(true);
}


5. Save the script and run it inside Photoshop (File> Scripts> Browse). Keep in mind that when using the Copy Merged function, there must be a selection. If you don't have a selection, the script will generate an error.

Paste Into

Photoshop's Paste Into command will paste the clipboard contents into the current selection as a new layer with the selection as a layer mask.

1. Check to for an opened document. If there isn't an opened document, nothing will happen.

if (documents.length > 0) {

}


2. Type in the paste method to use followed by parenthesis ( ). Inside the parenthesis, type in true.

if (documents.length > 0) {
paste(true);
}


3. Now we need to tell Photoshop which document to paste in. Type in activeDocument followed by a period.

if (documents.length > 0) {
activeDocument.paste(true);
}


4. Save the script and run it inside Photoshop (File> Scripts> Browse). Keep in mind that when using the Paste Into function, there must be a selection. If there isn't a selection, the script will generate an error.


Author's URL: FotoFects
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Advance your current skills or acquire new skills in Photoshop by creating projects using our step-by-step tutorials. More Tutorials: Most Popular Materials | Fresh Materials | TutorialKit New Photoshop Tutorials

Add comments to "Using the Clipboard"

Only registered users can write comment

Reader's comments