I am unable to copy an artLayer in a document and paste into another document. The error is "The command Paste is not currently available."
What I think is photoshop is unable to copy artLayer after I run any script in a Document.
Unable to copy...!!!
-
Mike Hale
Unable to copy...!!!
I have never experienced that error. More info about your documents and your script would help determine what is causing the error.
I would think that error means there in nothing in the clipboard.
I would think that error means there in nothing in the clipboard.
-
mohitshu
Unable to copy...!!!
Mike Hale wrote:I have never experienced that error. More info about your documents and your script would help determine what is causing the error.
I would think that error means there in nothing in the clipboard.
I want to copy a layer and then open a file from network and paste the copied layer to a new layer which I have already created and perform some operations.
Below is the code for this task.
Code: Select all#target photoshop
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CS5 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
//==============================================================>>>>>>>>>
//app.activeDocument.selection.selectAll();
//app.activeDocument.selection.copy ();
app.activeDocument.activeLayer.cut();
var doc = new File ("/D/Work/Templates/Bags/Hand Template.psd");
open(doc);
app.activeDocument.duplicate();
app.activedocument = app.documents["Hand Template.psd"];
app.activedocument.close(SaveOptions.DONOTSAVECHANGES);
//==============================================================>>>>>>>>>
var doc = app.activeDocument;
doc.artLayers.add();
var layer = activeDocument.activeLayer; //Grab the currently selected layer
doc.paste ();
layer.rotate (90, AnchorPosition.MIDDLECENTER);
var length = layer.bounds[2]-layer.bounds[0]; //Grab the length
var width = layer.bounds[3]-layer.bounds[1]; //Grab the width
var HInput = prompt ("Height in CM : ", 1, "Height of Bag");
if(HInput<26)
{
var w = HInput*(100/length*37.6);
var l = HInput*(100/width*37.62);
layer.resize (l, l, AnchorPosition.MIDDLECENTER);
};
else (alert ("Use menniqune shot if the Size of Bag is more than 23 cm", "Alert...!!!!", true))
//=============================================================>>>>>>>>>>>>
// ======================================================= Injection
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc46 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref36 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref36.putProperty( idChnl, idfsel );
desc46.putReference( idnull, ref36 );
var idT = charIDToTypeID( "T " );
var idOrdn = charIDToTypeID( "Ordn" );
var idAl = charIDToTypeID( "Al " );
desc46.putEnumerated( idT, idOrdn, idAl );
executeAction( idsetd, desc46, DialogModes.NO );
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc47 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref37 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref37.putEnumerated( idLyr, idOrdn, idTrgt );
desc47.putReference( idnull, ref37 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );
var idAdCH = charIDToTypeID( "AdCH" );
desc47.putEnumerated( idUsng, idADSt, idAdCH );
executeAction( idAlgn, desc47, DialogModes.NO );
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc48 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref38 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref38.putEnumerated( idLyr, idOrdn, idTrgt );
desc48.putReference( idnull, ref38 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );
var idAdCV = charIDToTypeID( "AdCV" );
desc48.putEnumerated( idUsng, idADSt, idAdCV );
executeAction( idAlgn, desc48, DialogModes.NO );
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc49 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref39 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref39.putEnumerated( idLyr, idOrdn, idTrgt );
desc49.putReference( idnull, ref39 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );
var idAdLf = charIDToTypeID( "AdLf" );
desc49.putEnumerated( idUsng, idADSt, idAdLf );
executeAction( idAlgn, desc49, DialogModes.NO );
// =======================================================
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
layer.translate (175, 0);
doc.selection.deselect();
layer.move (doc.artLayers.getByName ("Hand"), ElementPlacement.PLACEBEFORE);
But here either copy is not working or there is some problem with the paste command.
Please help me to understand this.
I would think that error means there in nothing in the clipboard.
I want to copy a layer and then open a file from network and paste the copied layer to a new layer which I have already created and perform some operations.
Below is the code for this task.
Code: Select all#target photoshop
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CS5 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
//==============================================================>>>>>>>>>
//app.activeDocument.selection.selectAll();
//app.activeDocument.selection.copy ();
app.activeDocument.activeLayer.cut();
var doc = new File ("/D/Work/Templates/Bags/Hand Template.psd");
open(doc);
app.activeDocument.duplicate();
app.activedocument = app.documents["Hand Template.psd"];
app.activedocument.close(SaveOptions.DONOTSAVECHANGES);
//==============================================================>>>>>>>>>
var doc = app.activeDocument;
doc.artLayers.add();
var layer = activeDocument.activeLayer; //Grab the currently selected layer
doc.paste ();
layer.rotate (90, AnchorPosition.MIDDLECENTER);
var length = layer.bounds[2]-layer.bounds[0]; //Grab the length
var width = layer.bounds[3]-layer.bounds[1]; //Grab the width
var HInput = prompt ("Height in CM : ", 1, "Height of Bag");
if(HInput<26)
{
var w = HInput*(100/length*37.6);
var l = HInput*(100/width*37.62);
layer.resize (l, l, AnchorPosition.MIDDLECENTER);
};
else (alert ("Use menniqune shot if the Size of Bag is more than 23 cm", "Alert...!!!!", true))
//=============================================================>>>>>>>>>>>>
// ======================================================= Injection
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc46 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref36 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref36.putProperty( idChnl, idfsel );
desc46.putReference( idnull, ref36 );
var idT = charIDToTypeID( "T " );
var idOrdn = charIDToTypeID( "Ordn" );
var idAl = charIDToTypeID( "Al " );
desc46.putEnumerated( idT, idOrdn, idAl );
executeAction( idsetd, desc46, DialogModes.NO );
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc47 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref37 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref37.putEnumerated( idLyr, idOrdn, idTrgt );
desc47.putReference( idnull, ref37 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );
var idAdCH = charIDToTypeID( "AdCH" );
desc47.putEnumerated( idUsng, idADSt, idAdCH );
executeAction( idAlgn, desc47, DialogModes.NO );
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc48 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref38 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref38.putEnumerated( idLyr, idOrdn, idTrgt );
desc48.putReference( idnull, ref38 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );
var idAdCV = charIDToTypeID( "AdCV" );
desc48.putEnumerated( idUsng, idADSt, idAdCV );
executeAction( idAlgn, desc48, DialogModes.NO );
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc49 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref39 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref39.putEnumerated( idLyr, idOrdn, idTrgt );
desc49.putReference( idnull, ref39 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );
var idAdLf = charIDToTypeID( "AdLf" );
desc49.putEnumerated( idUsng, idADSt, idAdLf );
executeAction( idAlgn, desc49, DialogModes.NO );
// =======================================================
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
layer.translate (175, 0);
doc.selection.deselect();
layer.move (doc.artLayers.getByName ("Hand"), ElementPlacement.PLACEBEFORE);
But here either copy is not working or there is some problem with the paste command.
Please help me to understand this.
-
mohitshu
Unable to copy...!!!
Also wanna know if there is some other way to copy a layer and open a document and then paste it.
-
Mike Hale
Unable to copy...!!!
I don't see where you copy a layer to the clipboard before you try to paste. It can't paste because there isn't a layer in the clipboard( unless that code is not part of what you posted )
If both documents are open at the same time you can duplicate a layer from one document to the other without using the clipboard. But if you want to copy then open the target document you need to go through the clipboard.
If both documents are open at the same time you can duplicate a layer from one document to the other without using the clipboard. But if you want to copy then open the target document you need to go through the clipboard.
-
mohitshu
Unable to copy...!!!
Mike Hale wrote:I don't see where you copy a layer to the clipboard before you try to paste. It can't paste because there isn't a layer in the clipboard( unless that code is not part of what you posted )
If both documents are open at the same time you can duplicate a layer from one document to the other without using the clipboard. But if you want to copy then open the target document you need to go through the clipboard.
It does cut an object in line number 16, and pastes it in line numer 28.
If both documents are open at the same time you can duplicate a layer from one document to the other without using the clipboard. But if you want to copy then open the target document you need to go through the clipboard.
It does cut an object in line number 16, and pastes it in line numer 28.
-
mohitshu
Unable to copy...!!!
Basically I am unable to copy with the script when I link the script to Pannel.