I'm trying to move one LayerSet into the other LayerSet in PhotoShop scripting. Here's my code:
// Source
var srcGroup = app.activeDocument.layerSets.add();
srcGroup.name = 'source';
// Target
var targetGroup = app.activeDocument.layerSets.add();
targetGroup.name = 'target';
srcGroup.move(targetGroup, ElementPlacement.INSIDE);
This gives an error "Error 1220: Illegal Argument". If I change the second argument to ElementPlacement.PLACEAFTER
, it the error is gone but it is not quite doing what I want.
As you found out not all values of ElementPlacement
are valid for all object types. I decided to make a workarround by adding a dummieGroup and place the source before the dummy. At the end the dummy will be removed.
var srcGroup = app.activeDocument.layerSets.add();
srcGroup.name = "source";
var targetGroup = app.activeDocument.layerSets.add();
targetGroup.name = "target";
//adding the dummy INSIDE the target LayerSet
var dummieGroup = targetGroup.layerSets.add();
dummieGroup.name = "dummy";
srcGroup.move(dummieGroup, ElementPlacement.PLACEBEFORE);
dummieGroup.remove();
To remove a layerSet
it have to be empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With