Copy link to clipboard
Copied
hi people
This is the first time I've tried adding paths to more than one group in a shape layer and something is amiss.
I need to add 2 groups and then add multiple paths to each group. Each group is added and assigned to variable but for some reason the first group varibale becomes an "invalid object" after the second one is created?! the workaround is to create the first group add all the paths to that, then create the second and add paths to it, but this is clunky as all get out and shouln't be needed. what is going on ? any help greatly appreciated.
cutdown example code below
this breaks when trying to get the name of vrtGroup
var C = app.project.activeItem;
var L = C.layers.addShape()
var vrtGroup = L.Contents.addProperty("ADBE Vector Group");
vrtGroup.name = "vertical lines";
var hrzGroup = L.Contents.addProperty("ADBE Vector Group");
hrzGroup.name = "horizontal lines";
$.writeln("hrzGroup.name: " + hrzGroup.name)
$.writeln("vrtGroup.name: " + vrtGroup.name)
but this works ???
var C = app.project.activeItem;
var L = C.layers.addShape()
var vrtGroup = L.Contents.addProperty("ADBE Vector Group");
vrtGroup.name = "vertical lines";
$.writeln("vrtGroup.name: " + vrtGroup.name)
var hrzGroup = L.Contents.addProperty("ADBE Vector Group");
hrzGroup.name = "horizontal lines";
$.writeln("hrzGroup.name: " + hrzGroup.name)
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now