Apply Live Effect: Inner Glow with color
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:
- 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.
