• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
7

duplicate layer in c# with com says not avaliable

Explorer ,
Jan 29, 2024 Jan 29, 2024

Copy link to clipboard

Copied

 

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.

 

 

Views

58

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation