Copy link to clipboard
Copied
Hello.
I can't figure out, is it possible to know somehow if any Live Effect applied to PageItem or some other object in a document? Using Graphic Styles turned out wrong.
Unfortunately @jonas_5930, we can't know if a Live Effect is applied. The scripting API only gives access to the very basic appearance (1 x fill, 1 x stroke).
You can do something hacky like this:
(function () {
var doc = app.activeDocument,
item = doc.selection[0];
var expandedItem = expandAppearance(item.duplicate());
/*
* now compare `item` with `expandedItem` somehow:
* - different `typename`?
* - number of paths or pathItems?
* - different visibleBo
...
Copy link to clipboard
Copied
Unfortunately @jonas_5930, we can't know if a Live Effect is applied. The scripting API only gives access to the very basic appearance (1 x fill, 1 x stroke).
You can do something hacky like this:
(function () {
var doc = app.activeDocument,
item = doc.selection[0];
var expandedItem = expandAppearance(item.duplicate());
/*
* now compare `item` with `expandedItem` somehow:
* - different `typename`?
* - number of paths or pathItems?
* - different visibleBounds?
*
* Example - a square with Live Effect Drop Shadow:
* `item` is a PathItem with 4 pathPoints
* `expandedItem` is a GroupItem containing:
* - a GrouptItem containing two PathItems, and
* - a RasterItem
*
* So from this you can be sure that the square
* does have some kind of special appearance.
* I don't know how reliably you'd be able to tell
* which Live Effect though.
*
* Note: later you will delete `expandedItem`.
*/
function expandAppearance(item) {
app.redraw();
app.executeMenuCommand('expandStyle');
return app.activeDocument.selection[0];
};
})();
Sometimes that can help. But otherwise, it isn't a good answer for you, sorry.
- Mark
Copy link to clipboard
Copied
Thanks for the reply.
Well, that's sad news(
Copy link to clipboard
Copied
Yep. 100% agree.
Copy link to clipboard
Copied
Rick Johnson's SelectMenu plugin has a couple of commands to select objects to which live effects are applied.
Perhaps it can help you.
Copy link to clipboard
Copied
Thank you very much.
I never heard about this plugin, but I saw similar opportunities in the Astute Graphic Stylism plugin.