Apply Live Effect: Inner Glow with color

Adobe Community Professional ,
Feb 02, 2017

Copy link to clipboard

Copied

With help of some great information, Prometheus-like, we have been given the access to the syntax which makes pageItem.applyEffect(); work

Re: PageItem.applyEffect(LiveEffectXML)

This is great to start out with when the components which make up the 'Dict data="' string are in a straight-forward syntax where there is a data type, a name key and a value to form each component. They just need to be strung together like so:

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

I am able to almost accomplish my goal of applying an Inner Glow, but I can't figure out the syntax needed to supply the glow color to go along with it. It always defaults to white.

Here is the code so far which applies a glow only with white default:

#target illustrator

function test(){

  var effectStr = 

   '<LiveEffect name="Adobe Inner Glow">' + 

       '<Dict data="' + 

           'I gtyp 0 ' + 

           'R blur 14.4 ' +

           'I blnd 3 ' +

           'R opac 1 ' +

           '" ' +

       '/>' +

   '</LiveEffect>';

  var doc = app.activeDocument;

  var s = doc.selection[0];

  s.applyEffect(effectStr);

};

test();

Here is the string inside the .AI file I saved without compression and opened it as text:

/BasicFilter :

(Adobe Inner Glow) 1 0 /Filter ,

1 /Visible ,

(Adobe Illustrator.app) /PluginFileName ,

(Inner Glow) /Title ,

/Dictionary : /NotRecorded ,

0 /Int (gtyp) ,

/FillStyle : 0 O

0.03 0 0.29 0 k

0 1 0 0 0 Xy

0 J 0 j 1 w 10 M []0 d

0 XR

0 1 Xd

/Def ;

(gclr) ,

14.4 /Real (blur) ,

1 /Real (opac) ,

3 /Int (blnd) ,

; /Dict ;

The color information is located here:

/FillStyle : 0 O

0.03 0 0.29 0 k

0 1 0 0 0 Xy

0 J 0 j 1 w 10 M []0 d

0 XR

0 1 Xd

/Def ;

(gclr) ,

While the rest of the 4 properties are working in my attempt above, I can't get the right syntax for putting in that color.

By the way, when applying this effect with experimentation strings added, the result could be an error-less application of the effect with default white or a MRAP, depending on whether you crossed some line of what the acceptable syntax is. I have tried adding new attributes and tags, and it still worked in the default way. Then I tried to add a nested tag inside the Dict tag, and got a MRAP. Whoever is able to solve this puzzle shall be rewarded with several emojis.

TOPICS
Scripting

Views

1.1K

Likes

Translate

Translate

Report

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

1 Correct Answer

Adobe Community Professional , Feb 03, 2017
CarlosCanto Adobe Community Professional , Feb 03, 2017
sorry I meant the different blending modes didn't seem to make a noticeable difference in my testings.this works for mexmlstring14 = '<LiveEffect name="Adobe Inner Glow"><Dict data="R opac 0.75 R blur 9 I blnd 10 I gtyp 0 "><Entry name="gclr" valueType="F"><Fill color="5 0 1 0.818 0"/></Entry></Dict></LiveEffect>';

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

you're using Overlay Blending Mode, I couldn't get that to work even manually. Use Normal or Difference for proof of concept, those work fine.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Silly-V AUTHOR
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

The blending mode seems to work (at least to the point of setting the correct item in the dropdown), but it is the color which eludes me.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

sorry I meant the different blending modes didn't seem to make a noticeable difference in my testings.

this works for me

xmlstring14 = '<LiveEffect name="Adobe Inner Glow"><Dict data="R opac 0.75 R blur 9 I blnd 10 I gtyp 0 "><Entry name="gclr" valueType="F"><Fill color="5 0 1 0.818 0"/></Entry></Dict></LiveEffect>';

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Silly-V AUTHOR
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

Oh cool, so the "Def" thing becomes an <Entry name=""> and the FillStyle becomes <Fill color=""> ?

So then, in your color="" string, there's 6 numbers - are you able to elaborate a little more on how this string transfers to this format:

0 O

0.03 0 0.29 0 k

0 1 0 0 0 Xy

0 J 0 j 1 w 10 M []0 d

0 XR

0 1 Xd

I am going to assume this:

color="0 O 0.03 0 0.29 0 k 0 1 0 0 0 Xy 0 J 0 j 1 w 10 M []0 d 0 XR 0 1 Xd"

Is that right? I'll test soon too.

-----------------------------------------------

Yea that long number string of mine did not work. But it looks like all of those letters and numbers are not really necessary. Now I wonder which of those correspond with your 6 numbers and as a bonus, what the other ones do.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

for color info only this is relevant, those are your cmyk values in percentages of 1

0.03 0 0.29 0 k

I have no idea about the other numbers.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Silly-V AUTHOR
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

So for yours, what do the other 2 numbers mean?

<Fill color="5 0 1 0.818 0"/>

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

it's only 5 numbers, not sure what the first number means, the next 4 are your cmyk values.

this should yield the cmyk values exactly as you'll see them in the UI (c:25, m:100, y:50, k:0)

<Fill color="1 0.25 1 0.5 0"/>

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Silly-V AUTHOR
Adobe Community Professional ,
Feb 03, 2017

Copy link to clipboard

Copied

Okay, I don't know the oracles you speak with to get this information, but thank you once again for the great revelation!

By the way, for me Overlay works just fine. It may be that you are just not visually noticing the effect? The shape I used the effect on, I made to have the basic black-to-white gradient and the blending mode's appearance was evident.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 04, 2017

Copy link to clipboard

Copied

hahaha no oracles, just looking at the fxg file.

where are my emojis? several of them

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Silly-V AUTHOR
Adobe Community Professional ,
Feb 04, 2017

Copy link to clipboard

Copied

What? How could I forget!

So, it appears the FXG file has better description of the live effect XML string because the one from a non-compressed .ai file is more cryptic when it comes to the nested elements.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Silly-V AUTHOR
Adobe Community Professional ,
Oct 06, 2018

Copy link to clipboard

Copied

Is there any way to get FXG out in CC2018? It always saves me a .ai file even though I used FXGSaveOptions...

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
m1b LATEST
Engaged ,
Feb 04, 2021

Copy link to clipboard

Copied

Update: these free functions make applying Live Effects easier: AI Live Effect Functions.

- Mark

Likes

Translate

Translate

Report

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