Copy link to clipboard
Copied
Hello everyone;
I am running into an issue (mind you I am VERY NEW to this whole Scripting jazz). I have this at the end of a script I am working on:
// PASTE
app.executeMenuCommand("paste");
app.executeMenuCommand("Horizontal Align Center");
app.executeMenuCommand("Vertical Align Center");
// ADD 1/8" BLEED
function container()
{
var idoc = app.activeDocument;
app.executeMenuCommand("selectall");
var ipath = idoc.selection[0];
xmlstring = '<LiveEffect name="Adobe Offset Path"><Dict data="R mlim 4 R ofst 9 I jntp 2 "/></LiveEffect>';
ipath.applyEffect(xmlstring);
}
container();
For some reason, the XML string with the LiveEffect is preventing anything from happening AFTER it takes places. Ideally I'd like to have the script expand the object, then change one layer's order at the very end, but nothing inputted after this container will work.
Any help would be greatly appreciated. I'd love to have the last two processes happen without doing them manually or writing an additional script.
Thank you,
Ian.
Copy link to clipboard
Copied
Maybe I got it wrong. After applyEffect() do you want to expand selection[0] and move it down? I update Illustrator via app.redraw(), after applying the effect.
app.executeMenuCommand("copy"); // For test
// PASTE
app.executeMenuCommand("paste");
app.executeMenuCommand("Horizontal Align Center");
app.executeMenuCommand("Vertical Align Center");
container();
// ADD 1/8" BLEED
function container() {
var idoc = app.activeDocument;
// app.executeMenuCommand("selectall");
var ipath = idoc.selection[0];
xmlstring = '<LiveEffect name="Adobe Offset Path"><Dict data="R mlim 4 R ofst 9 I jntp 2 "/></LiveEffect>';
ipath.applyEffect(xmlstring);
app.redraw(); // update after applyEffect()
app.executeMenuCommand("expandStyle");
idoc.selection[0].zOrder(ZOrderMethod.SENDTOBACK);
}