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

Applying Live effects (offset path) in Illustrator using AS

Community Beginner ,
Nov 30, 2017 Nov 30, 2017

Copy link to clipboard

Copied

Help! Anyone can give me an example how to script (AS) Offset Path in Illustrator?

Thank you.

TOPICS
Scripting

Views

3.4K

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

correct answers 1 Correct answer

Valorous Hero , Nov 30, 2017 Nov 30, 2017

In my AppleScript Debugger I was able to open up a Dictionary and see:

applyeffect

applyeffect (verb)Apply effect to selected artItem (from Adobe Illustrator Suite)

command syntax

applyeffect page item ¬

    liveeffectxml text

parameters

Parameter

Required

Type

Description

direct parameter

required

page item

the page item object or objects to be operated upon

liveeffectxml

required

text

I guess I just can't leave things alone sometimes, I was able to make this snippet work:

tell application "Adobe Illustrator"

  se

...

Votes

Translate

Translate
Adobe
Valorous Hero ,
Nov 30, 2017 Nov 30, 2017

Copy link to clipboard

Copied

Your answer is actually one of the most arcane Illustrator Scripting subjects, and as luck would have it, the answer is in fact the very first example provided by CarlosCanto which let us all in on the secret, and it's here: Re: PageItem.applyEffect(LiveEffectXML)

The challenge is in two parts, first you have to obtain and prepare your live effect xml syntax for the Offset Path effect and then you have to apply it with some code.

Some more AI scripting 'rules' for these live effects:

  • applying a new effect will add it to the art, compounding with previous effects
  • to reduce the effects, is possible by applying a pre-prepared 'default/no-style' graphic style or using an Action or app.executeMenuCommand(...) to reduce to basic appearance or clear appearance.
  • The effect is live, to turn it into real paths will take another action or menu command 'expand appearance'

Also one other thread which also has other effect examples is here:

Apply Live Effect: Inner Glow with color

Please enjoy this amazing Illustrator scripting feature, it's been hidden for years and is only available to us through the good graces of the powers that be.

* As for AS, just use a do javascript command - I'm not sure about the AS vocabulary for the liveEffect syntax myself and usually take the lazy way out by having my AS run my JSXs.

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
Valorous Hero ,
Nov 30, 2017 Nov 30, 2017

Copy link to clipboard

Copied

In my AppleScript Debugger I was able to open up a Dictionary and see:

applyeffect

applyeffect (verb)Apply effect to selected artItem (from Adobe Illustrator Suite)

command syntax

applyeffect page item ¬

    liveeffectxml text

parameters

Parameter

Required

Type

Description

direct parameter

required

page item

the page item object or objects to be operated upon

liveeffectxml

required

text

I guess I just can't leave things alone sometimes, I was able to make this snippet work:

tell application "Adobe Illustrator"

  set doc to the first document

  set testPath to the first path item of doc

  set xmlstring to "<LiveEffect name='Adobe Offset Path'><Dict data='R mlim 4 R ofst 20 I jntp 2 '/></LiveEffect>"

  applyeffect testPath liveeffectxml xmlstring

end tell

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
Community Expert ,
Dec 02, 2017 Dec 02, 2017

Copy link to clipboard

Copied

I guess I just can't leave things alone sometimes

I hear you...

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
Community Beginner ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

Wow...   it works!    This is exactly what I need

Thank you very much Silly

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
Community Beginner ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Hi anyone,  one more question

<LiveEffect name='Adobe Offset Path'><Dict data='R mlim 4 R ofst 20 I jntp 2 '/></LiveEffect>"

Is there a way that we can make the (ofst 20) as a string…?

like offsetvalueinput

Thanks again  

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
Valorous Hero ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

You mean like this?
var offsetvalueinput = 20;
var liveXmlString = "<LiveEffect name='Adobe Offset Path'><Dict data='R mlim 4 R ofst " + offsetvalueinput + "  I jntp 2 '/></LiveEffect>";

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
Community Beginner ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

yes,  but how to do that in AS?

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
Community Beginner ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

I got it!!!

"&offsetvalueinput&"

              

Thank you  SILLY-D

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
Valorous Hero ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

LATEST

Lol I forgot the AS part

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