Objects are being selected when they shouldn't compared to doing it manually
Manually: I have one object(Main Piece). I duplicate it onto another layer (UG_OG). I use the "off_neg_1_16in" action I have. It selects the offset piece(Offset Piece) and nothing else. I change the spot color tent to 100%. End result is perfect.
Script: Does everything but after the action it still has everything selected and changes the color for all of them. End result is inncorrect. I should note it only does the offset on the UG_OG piece which is what I want. So im even more confused as to how the other 2 pieces are still selected
So even though after it does the action it should technically only have 1 object selected but has all 3 pieces selected. Are you suppose to deselect objects in the script every single time? I thought it would do this automatically if true?
I put safe guards in place to only change what I want but I was wondering if im doing something wrong? Why and How is a script completely different than doing it manually?
Script doesn't show safe guards btw.
var ogPieces = [];
for (var i = 0; i < paKOpieces.length; i++) {
var og = paKOpieces[i].duplicate(REDLayer, ElementPlacement.PLACEATBEGINNING);
og.name = "_UG_OG_" + i;
setFill(og, "RED", 50);
ogPieces.push(og);
info("Created OG piece " + i);
}
app.selection = null;
for (var j = 0; j < ogPieces.length; j++) {
ogPieces[j].selected = true;
}
info("Running offset");
runAction(ACT.off_neg_1_16in);
if (app.selection && app.selection.length > 0) {
for (var o = 0; o < app.selection.length; o++) {
var item = app.selection[o];
setFill(item, "RED", 100);
}
}
