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

Is there a way to create a Static Symbol via scripting?

Enthusiast ,
May 24, 2016 May 24, 2016

Copy link to clipboard

Copied

The addition of Dynamic symbols, has completely messed up my process when prepping files. Final step is normally to prep an asset as a symbol, in case effects or strokes are used on the item, preventing them from being scaled incorrectly due to settings, and preventing inadvertent editing. Now Illustrator has made it so that by default a Dynamic symbol is made, which works the exact opposite of this, and has even unclipped clipping masks for me. I looked in the scripting guide, but it doesn't look like you can specify this. Has anybody found an attribute that would allow this? Symbols may have just proven themselves useless due to this new attribute.

See below, an unexpanded path stays the same width when scaling up, where as with the static symbol, it gets scaled proportionately:

Screen Shot 2016-05-24 at 9.50.29 AM.png

TOPICS
Scripting

Views

1.0K

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
Adobe
Valorous Hero ,
May 24, 2016 May 24, 2016

Copy link to clipboard

Copied

I don't see a way to mess with this through preferences or scripting commands, but at least you can activate the Symbol Options dialog through Actions (a script can load and play actions) and then you could use a send-keys external script to navigate through the dialog and click on your desired radio button and then send an Enter to press the OK button.

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
Enthusiast ,
May 25, 2016 May 25, 2016

Copy link to clipboard

Copied

Hi, here is a workaround:

-Open the Symbols panel, make sure there exist at least one static symbol, if not, create one.

-Select the static symbol in the panel.

-Select the items your want to make symbol.

-Run this code.

(function() {

    var actionStr = '/version 3/name [13 53637269707420416374696f6e]/actionCount 1/action-1 {/name [ 13 5374617469632053796d626f6c]/eventCount 2/event-1 {/internalName (ai_plugin_symbol_palette)/hasDialog 1/showDialog 0/parameterCount 1/parameter-1 {/key 1835363957/type (enumerated)/name [12 e5a48de588b6e7aca6e58fb7]/value 4}}/event-2 {/internalName (ai_plugin_symbol_palette)/hasDialog 0/parameterCount 1/parameter-1 {/key 1835363957/type (enumerated)/name [18 e9878de696b0e5ae9ae4b989e7aca6e58fb7]/value 3}}}',

        set = 'Script Action',

        action = 'Static Symbol',

        sel = app.selection,

        i = 0;

    createAction(actionStr, set);

    for (; i < sel.length; i++) {

        app.selection = null;

        sel.selected = true;

        app.doScript(action, set);

    };

    app.unloadAction(set, '');

    function createAction(str, set) {

        var f = File('~/tmp.aia');

        f.open('w');

        f.write(str);

        f.close();

        app.loadAction(f);

        f.remove();

    }

})();

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
Enthusiast ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

Thanks for this! Though, it's not completely achieving the results I'm looking for. If I have multiple items selected it turns each one into its own symbol. The reason I use symbols for distribution is to preserve layering and structure of graphics, and also ensure that art is edited intentionally and not accidentally.

While the drawback of the strokes is an issue, I also discovered today that dynamic symbols inflate and double it. This is not a huge problem with purely vector files as part of my process is to outline strokes, but with images my file went ~169MB to ~360MB. Inflation with static symbols was minimal and final file size was ~170MB. Any thoughts on other workarounds? I'm wondering if there is a way to edit the symbol type on save in the code? Not sure if basic scripting allows this level of access, I'll also reach out to the SDK forum.

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
Enthusiast ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

moluapple
In referencing the scripting manual I found a loop on page 212. I was able to simplify to the below at least as a test:

docRef = app.activeDocument;

var pathRef = docRef.pathItems.rectangle( 10, 10, 20, 20 );

docRef.symbols.add(pathRef);

In executing this, it actually creates a static symbol! I tested against the creation of a dynamic symbol in the middle to see if it hung onto preferences, but it seems the outdated scripting support is working in my favor. I would appreciate your input if you can test to see if you're seeing the same. I tested in CC 2015, and CC 2017, and both yielded static symbols on scripting. Thanks for your help, and I apologize for not finding this sooner.

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
Enthusiast ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

LATEST

If I have multiple items selected it turns each one into its own symbol.

That's I thought what you want, if not, just delete the for loop.

    createAction(actionStr, set);

    app.doScript(action, set);

    app.unloadAction(set, '');

I tested in CC 2015, and CC 2017, and both yielded static symbols on scripting.

The same here in CC 2015. The problems are:

  • It create a symbol in the panel, but do not change the select objects to a symbol item.
  • It seems only take one page item a time, if you select multiple items, you have to group them first.

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