LayerSet.Merge() throwing COM exception


hi all,

    i'm using com interop photoshop in c# assembly automate actions in photoshop. problem layerset.merge() throws com exception in situations. don't know if have cases, in general, assumed layerset.merge() collapse layerset, regardless of how many nested layersets , artlayers in artlayer assign activelayer. appears not case. this:

 

// store state

historystate state = d.activehistorystate;

 

d.activelayer = set.merge();

d.selection.selectall();

 

// process layer in way...

 

// restore state           

d.activehistorystate = state;

 

where d activedocument , set layerset i'd merge. checked in debugger , activedocument (d) not null , right document opened in photoshop. layerset i'm calling merge() on (set) not null , correct layerset, reason, exception:

 

system.runtime.interopservices.comexception unhandled user code

message: general photoshop error occurred. functionality may not available in version of photoshop.

- object "layer 38 of document 37" not available.

 

my photoshop file looks this:

 

myfile.psd

|-myset1

     |-myset1_1

          |-artlayer1

     |-myset1_2

          |-artlayer2

|-artlayer3

 

so code loops through , merges each layerset starting @ deepest point. in other words, myset1_2 merged first , assigned activelayer (then processed etc) , works. myset1_2 merged , assigned activelayer, myset1 merged , that's when hit com exception.

 

i assumed layerset.merge() same using layer->mergelayers in photoshop ui, that's apparently not case since can merge of layersets using ui, com object seems balk.

 

does have idea issue is?

 

thanks!

-c

sorry can't answer question use c#.

as work around might try...

 

 

   app.dojavascript( "app.activedocument.activelayer.merge();", null, null);  


More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support