• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Illustrator scripting help. How to know if Live Effect applied?

New Here ,
Aug 26, 2024 Aug 26, 2024

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.

TOPICS
Scripting

Views

109

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Aug 26, 2024 Aug 26, 2024

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
...

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 26, 2024 Aug 26, 2024

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2024 Aug 26, 2024

Copy link to clipboard

Copied

Thanks for the reply.
Well, that's sad news(

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 26, 2024 Aug 26, 2024

Copy link to clipboard

Copied

Yep. 100% agree.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 26, 2024 Aug 26, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 28, 2024 Aug 28, 2024

Copy link to clipboard

Copied

LATEST

Thank you very much.

I never heard about this plugin, but I saw similar opportunities in the Astute Graphic Stylism plugin.

Votes

Translate

Translate

Report

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