Skip to main content
jamesf42245324
Inspiring
January 30, 2024
Question

duplicate layer in c# with com says not avaliable

  • January 30, 2024
  • 0 replies
  • 129 views

 

I have the latest version of PS on machine and same with com object 

 

 

Below is my code i have tried this and i tried a shorter version below both give the same result   I am tring to copy a layer from one document to another 

 

var idcopy = app.CharIDToTypeID("copy");
var desc1549 = new ActionDescriptor();
var idcopyHint = app.StringIDToTypeID("copyHint");
desc1549.PutString(idcopyHint, "layers");
app.ExecuteAction(idcopy, desc1549, PsDialogModes.psDisplayNoDialogs);


// =======================================================
var idDplc = app.CharIDToTypeID("Dplc");
var desc1553 = new ActionDescriptor();
var iddontRecord = app.StringIDToTypeID("dontRecord");
desc1553.PutBoolean(iddontRecord, true);
var idforceNotify = app.StringIDToTypeID("forceNotify");
desc1553.PutBoolean(idforceNotify, true);
var idnull = app.CharIDToTypeID("null");
var ref31 = new ActionReference();
var idLyr = app.CharIDToTypeID("Lyr ");
ref31.PutName(idLyr, "new layer");
desc1553.PutReference(idnull, ref31);
var idT = app.CharIDToTypeID("T ");
var ref32 = new ActionReference();
var idDcmn = app.CharIDToTypeID("Dcmn");
ref32.PutName(idDcmn, "MainFiledontnotoverwright copy");
desc1553.PutReference(idT, ref32);
var iddestinationDocumentID = app.StringIDToTypeID("destinationDocumentID");
desc1553.PutInteger(iddestinationDocumentID, 187);
var idVrsn = app.CharIDToTypeID("Vrsn");
desc1553.PutInteger(idVrsn, 5);
var idIdnt = app.CharIDToTypeID("Idnt");
var list22 = new ActionList();
list22.PutInteger(50);
desc1553.PutList(idIdnt, list22);
app.ExecuteAction(idDplc, desc1553, PsDialogModes.psDisplayNoDialogs);

 

 

also tried with same result

 

app.ActiveDocument = doc2;
doc2.ArtLayers[0].Name = "Design";
doc2.ArtLayers[0].Duplicate(docWork);

 

 

 

result for both 

 

General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- The command "Duplicate" is not currently available.

 

 

This topic has been closed for replies.