Skip to main content
Silly-V
Legend
June 19, 2015
Answered

PageItem.applyEffect(LiveEffectXML)

  • June 19, 2015
  • 4 replies
  • 8064 views

I am wondering if anyone has been able to figure out what kind of "LiveEffectXML" is a parameter to PageItem.applyEffect()

It's been years since this feature has been out, but no documentation anywhere.

This topic has been closed for replies.
Correct answer CarlosCanto

Hi Silly-V, I figured it out, with big big, and I mean BIG help from Adobe's Sanjay K

// apply offset path live effect to selected path

var idoc = app.activeDocument;

var ipath = idoc.selection[0];

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

ipath.applyEffect(xmlstring);

//mlim is the MiterLimit Value “4”, ofst is the Offset Value “20”, jntp is the Join Type “2” for Miter.


more details here

4 replies

Marnida
Known Participant
August 15, 2021

I've been admiring this thread for a while. I appologise if the connection has already been made (particuarly to ten_a) - I've not seen it though; I was googling for more info on the topic, and came this post in Japanese where 投稿者: ten_a shares some of their own live effect code:

https://translate.google.com/translate?sl=auto&tl=en&u=https://ten-artai.com/2015/12/318/

#Drop Shadow
<LiveEffect name="Adobe Drop Shadow"><Dict data="R horz 7 I blnd 1 R opac 0.75 R dark 100 B pair 1 I csrc 0 R vert 7 R blur 5 B usePSLBlur 1 I Adobe Effect Expand Before Version 16 " /></LiveEffect>

 

#Fuzzy Mask
<LiveEffect name="Adobe Fuzzy Mask"><Dict data="R Radius 5 " /></LiveEffect>

 

#Inner Grow
<LiveEffect index="0″ major="1″ minor="0″ name="Adobe Inner Glow"><Dict data="I gtyp 1 I blnd 2 R opac 0.75 R blur 5 “><Entry name="gclr" valueType="F"><Fill color="1 0 0 0 0″/></Entry></Dict></LiveEffect>

 

#Outer Grow
<LiveEffect name="Adobe Outer Glow"><Dict data="I Adobe Effect Expand Before Version 16 I blnd 2 R opac 0.75 R blur 5 B usePSLBlur 1 " /></LiveEffect>

 

#Scribble Fill
<LiveEffect name="Adobe Scribble Fill"><Dict data="R Spacing 5 R EdgeOverlap 0 R Scribbliness 0.05 R StrokeWidth 3 R Angle 30 R EdgeOverlapVariation 5 R SpacingVariation 0.5 R ScribbleVariation 0.01 " /></LiveEffect>

 

#Round Corners
<LiveEffect name="Adobe Round Corners"><Dict data="R radius 10 “/></LiveEffect>

 

#Outline Type
<LiveEffect index="0″ isPre="1″ major="1″ minor="0″ name="Adobe Outline Type"><Dict /></LiveEffect>

 

#Outline Stroke
<LiveEffect index="0″ major="1″ minor="0″ name="Adobe Outline Stroke"><Dict /></LiveEffect>

 

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

 

#Zigzag
<LiveEffect name="Adobe Zigzag"><Dict data="R roundness 0 R absoluteness 1 R relAmount 10 R ridges 4 R amount 10.006 " /></LiveEffect>

 

#Free Disort
<LiveEffect name="Adobe Free Distort"><Dict data="R src3h 278 R src2h 178 R dst2v -263 R src2v -263 R src0h 178 R dst2h 178 R src3v -263 R dst3v -263 R dst0v -163 R src1h 278 R src1v -163 R src0v -163 R dst0h 178 R dst1v -163 R dst1h 278 R dst3h 278 " /></LiveEffect>

 

#Punck & Bloat
<LiveEffect name="Adobe Punk and Bloat"><Dict data="R d_factor 10 " /></LiveEffect>

 

#Twirl
<LiveEffect name="Adobe Twirl"><Dict data="R angle 30 " /></LiveEffect>

 

#Pathfinder
<LiveEffect name="Adobe Pathfinder"><Dict data="R TrapTintTolerance 0.05 B ExtractUnpainted 1 B TrapConvertCustom 0 R TrapAspect 1 B ConvertCustom 1 R TrapMaxTint 1 R Mix 0.5 B RemovePoints 0 I Command 0 R TrapThickness 0.25 R TrapTint 0.4 B TrapReverse 0 R Precision 10 “><Entry name="DisplayString" value="" valueType="S" /></Dict><LiveEffect>

 

#3D Effect
<LiveEffect name="Adobe 3D Effect"><Dict data="B showHiddenSurfaces 0 R cameraPerspective 0 I rotationPresetKey 9 B paramsDictionaryInitialized 1 I 3Dversion 2 B extrudeCap 1 R mat_12 -0.278 R mat_13 0 R mat_20 -0.456 R mat_21 0.248 R mat_22 0.855 R mat_23 0 R mat_30 0 R mat_31 0 R mat_32 0 R mat_33 1 R rotX -18 R rotY -26 R rotZ 8 R revolveAngle 360 B revolveCap 1 R revolveOffset 0 I revolveAxisMode 0 I surfaceStyle 3 R surfaceAmbient 50 R surfaceMatte 40 R surfaceGloss 10 R blendSteps 25 B invisibleGeo 0 I shadeMode 3 B preserveSpots 0 I numLights 1 B shadeMaps 0 I numArtMaps 0 R mat_11 0.961 R mat_10 0.002 R mat_03 0 R mat_02 0.438 R mat_01 0.125 R mat_00 0.89 I effectStyle 0 R bevelHeight 4 B bevelExtentIn 1 R extrudeDepth 50 “><Entry name="shadeColor" valueType="F"><Fill color="1 0 1 1 0″/></Entry><Entry name="light0″ valueType="D"><Dict data="R lightDirX 0.39 R lightDirY 0.33 R lightDirZ -0.85 R lightPosX 0 R lightPosY 0 R lightPosZ -1 R lightIntensity 1 " /></Entry><Entry name="DisplayString" value="3D " valueType="S"/></Dict></LiveEffect>

I've tested most of them, and they were grand!

femkeblanco
Legend
August 15, 2021

It's worth mentioning that @m1b has done some really nice work on live effects:

https://community.adobe.com/t5/illustrator/scripting-live-effects/m-p/11744702

 

Marnida
Known Participant
August 16, 2021
quote

It's worth mentioning that @m1b that has done some really nice work on live effects:

https://community.adobe.com/t5/illustrator/scripting-live-effects/m-p/11744702

 


By @femkeblanco

Yes, I've been admiring that one too 🙂

Inventsable
Legend
August 23, 2018

This is a great thread, I was following moluapple's method through an uncompressed AI file when I noticed that these Live Effects look like siblings to what I optimistically hope might be other accessible things. In my file, the Stroke Offset effect shows up mixed in with Stroke and Fill effects:

/Part ,

/BasicFilter :

(Stroke Style Filter) 0 0 /Filter ,

1 /Visible ,

2 /FillOrStroke ,

/Dictionary : /NotRecorded ,

/StrokeStyle : 0 R

0.011535820551217 0.457404434680939 0.82201874256134 0 0.96078431372549 0.607843137254902 0.270588235294118 XA

0 1 0 0 0 Xy

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

0 XR

1 0 Xd

/Def ;

(StrokeStyle) ,

; /Dict ;

/Part ,

/CompoundFilter :

(Chain Style Filter) 0 0 /Filter ,

1 /Visible ,

/BasicFilter :

(Adobe Stroke Offset) 1 0 /Filter ,

1 /Visible ,

(Illustrator.exe) /PluginFileName ,

(Stroke Offset Live Effect) /Title ,

2 /FillOrStroke ,

/Dictionary : /NotRecorded ,

(Inside) /String (DisplayString) ,

/StrokeStyle : 0 R

0 0 0 0 1 1 1 XA

0 1 0 0 0 Xy

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

0 XR

1 0 Xd

/Def ;

(StrokeStyle) ,

'B StrokeOffsetInside 1' +

; /Dict ;

/Part ,

/BasicFilter :

(Blend Style Filter) 0 0 /Filter ,

1 /Visible ,

/Dictionary : /NotRecorded ,

/BlendStyle : 0 0.6 0 0 0 Xy

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

0 XR

/Def ;

(BlendStyle) ,

; /Dict ;

/Part ,

The format looks very similar too -- moluapple's RegExp picks up "Adobe Stroke Offset" which looks to be "Stroke Style Filter" in the effect above. I'm curious if strokes and fills could be accessed as LiveEffects and if what we're looking at is how the Appearance panel is handled. Would it be possible to access a stroke through this method then use PageItem.tag to keep track of multiple strokes? I don't know anything about C++, but I wondered if the way this worked was through the AILiveEffectSuite:

If so, would that mean that a script could potentially have access via app.sendScriptMessage? Or am I completely out in left field on this?

Silly-V
Silly-VAuthor
Legend
August 23, 2018

Yes, when you make own c++ .aip plugin, you can expose some functionality to scripts and the .jsx scripts can then be used to make your separate .aip plugin features available to one overall .jsx script that may need to be used to utilize any amount of features from the various .aip plugins.

Inventsable
Legend
August 23, 2018

Is there a way to find out the mechanism behind PageItem.applyEffect(), as in which plugin or Suite it's exposed to, if applicable? As in, trying to apply the XML effect via app.sendScriptMessage() through the above plugin's function (AILiveEffectSuite) as a gauge for whether or not that's the mechanism behind the applyEffect() method?

Your pragmatism is no match for my idealism sir, I want multiple strokes so very much

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
December 14, 2015

Hi Silly-V, I figured it out, with big big, and I mean BIG help from Adobe's Sanjay K

// apply offset path live effect to selected path

var idoc = app.activeDocument;

var ipath = idoc.selection[0];

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

ipath.applyEffect(xmlstring);

//mlim is the MiterLimit Value “4”, ofst is the Offset Value “20”, jntp is the Join Type “2” for Miter.


more details here

Silly-V
Silly-VAuthor
Legend
December 14, 2015

Way to go! This shall prove infinitely useful, no doubts about it. Thanks for the research.

luca.dall
Participant
June 22, 2015

They may be SVG filter?