Skip to main content
wckdtall
Inspiring
May 1, 2017
Answered

Is it possible to loop through live paint objects and expand in Javascript?

  • May 1, 2017
  • 1 reply
  • 1705 views

I have a lot of live paint objects in a document and would like to loop through and expand them, but there is no option for "Select > Object" in the menu. I looked through documentation and only found 2 mentions of livepaint, but neither for detection, and are only related to to Tracing Options. Anyone know if this is possible with scripting?

This topic has been closed for replies.
Correct answer wckdtall

Looping has been problematic recently causing my scripts to run too long. I had one that was looping through 30,000+ page items that took over 15 minutes to check visibility, and delete invisible objects.

I found recently, that I don't even need to loop through, it's as simple as:

          app.executeMenuCommand ('selectall');
          app.executeMenuCommand('Expand Planet X');


I've been using select all with a bunch of other commands like outline stroke and text, and it saves a lot of time.

1 reply

CarlosCanto
Community Expert
Community Expert
May 1, 2017

sure, Live paint objects are "pluginItems" also known as Planet x objects

var idoc = app.activeDocument;

var livepaintObject = idoc.pluginItems[0];

livepaintObject.selected = true;

app.executeMenuCommand('Expand Planet X');

Silly-V
Legend
May 1, 2017

Maybe when Live Paint was first invented, it was thought to be such an advanced feature that it was "far out", as "in outer space". Who knows, but I'm curious

CarlosCanto
Community Expert
Community Expert
May 1, 2017

me too, aren't we programmers encouraged to give our objects more descriptive names? it'll be great to know how did planet x came about.