Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XML/LiveEffect Messing Up Script

New Here ,
Aug 19, 2022 Aug 19, 2022

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.

TOPICS
Scripting
264
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Enthusiast ,
Aug 19, 2022 Aug 19, 2022

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.

outline-apply-effect.gifexpand image

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);
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 05, 2023 Oct 05, 2023

Hey Sergey,
Came across this and it solved the problem I was having!
Do you know how I could apply the "Round" selection to the offset and apply a negative offset?|
Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 05, 2023 Oct 05, 2023
LATEST

Could you please show in screenshots what you use the offset rounding and negative offset for?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines