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

XML/LiveEffect Messing Up Script

New Here ,
Aug 19, 2022 Aug 19, 2022

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.

TOPICS
Scripting

Views

53

Translate

Translate

Report

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
Engaged ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

LATEST

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.gif

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

 

// My Telegram channel https://t.me/aiscripts

Votes

Translate

Translate

Report

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