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

Menu Commands Outline Stroke

Contributor ,
May 05, 2015 May 05, 2015

Copy link to clipboard

Copied

Hello Everyone,

I am trying to find an outline stroke menu command (without a diolog box popping up)

app.executeMenuCommand ('Expand3') Works, but I am trying to see if there is a way to avoid the dialog box.

app.executeMenuCommand ('Outline Stroke')

app.executeMenuCommand ('OutlineStroke')

app.executeMenuCommand ('outlineStroke')

app.executeMenuCommand ('outline Stroke')

app.executeMenuCommand ('outline stroke')

None of those seem to work. Also, if there is an official reference somewhere for all the menu commands that would be helpful as well.

Thanks guys!

TOPICS
Scripting

Views

2.8K

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 , May 10, 2015 May 10, 2015

Hi,

Try below:

app.executeMenuCommand ('OffsetPath v22');

Ten

Votes

Translate

Translate
Adobe
Guide ,
May 05, 2015 May 05, 2015

Copy link to clipboard

Copied

// - - - IMPORTANT - - -

// on First run you will get a popup dialog.

// YOU MUST PRESS "STOP" for the action to be created...

// CS6 and beyond only

// Credit for the meat of this must go to moluapple

// https://gist.github.com/moluapple/2568405

//

// Qwertyfly 6-5-15

//

// - - - IMPORTANT - - -

// on First run you will get a popup dialog.

// YOU MUST PRESS "STOP" for the action to be created...

//

var actionStr = ['/version 3',

    '/name [ 12',

    '536372697074416374696f6e',

    ']',

    '/isOpen 1',

    '/actionCount 1',

    '/action-1 {',

    '/name [ 12',

    '457870616e645374726f6b65',

    ']',

    '/keyIndex 0',

    '/colorIndex 0',

    '/isOpen 1',

    '/eventCount 1',

    '/event-1 {',

    '/useRulersIn1stQuadrant 0',

    '/internalName (ai_plugin_expand)',

    '/localizedName [ 6',

    '457870616e64',

    ']',

    '/isOpen 0',

    '/isOn 1',

    '/hasDialog 1',

    '/showDialog 0',

    '/parameterCount 4',

    '/parameter-1 {',

    '/key 1868720756',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 0',

    '}',

    '/parameter-2 {',

    '/key 1718185068',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 0',

    '}',

    '/parameter-3 {',

    '/key 1937011307',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 1',

    '}',

    '/parameter-4 {',

    '/key 1936553064',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 0',

    '}',

    '}',

    '}'].join('\n');

try {

    app.doScript('ExpandStroke', 'ScriptAction');

} catch(e) {

    createAction(actionStr);

    app.doScript('ExpandStroke', 'ScriptAction');

}

function createAction (str) {

    var f = new File('~/ScriptAction.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
Valorous Hero ,
May 08, 2015 May 08, 2015

Copy link to clipboard

Copied

Another way to do it is to use a "Create Outline" effect and then use an "expandStyle" command right afterwards.

    app.executeMenuCommand('Live Outline Stroke');

    app.executeMenuCommand('expandStyle');

Qwertyfly...‌ : when an action is not present, but it is commanded to play, and UserInteractionLevel is DONTDISPLAYALERTS, it seems to not even run the catch block. So, I wonder if the way a script can even tell that there was en error is because the Action error dialog pops up. When they are suppressed, the script seems oblivious.

I think pressing Stop once is a reasonable solution, given our luck of the draw with Actions.

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
Guide ,
May 08, 2015 May 08, 2015

Copy link to clipboard

Copied

‌i spent a little time trying to work around it but had not luck.

I'll think on it some more at some point. There may be some work around not yet explored.

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 ,
May 10, 2015 May 10, 2015

Copy link to clipboard

Copied

Hi,

Try below:

app.executeMenuCommand ('OffsetPath v22');

Ten

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
Guide ,
May 10, 2015 May 10, 2015

Copy link to clipboard

Copied

That makes no sense at all, why would OffsetPath do an OutlineStroke!

But it works, I would never have thought to try that.

so:

app.executeMenuCommand ('OffsetPath v22'); = Outline Stroke

app.executeMenuCommand ('OffsetPath v23'); = Offset Path


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
Valorous Hero ,
May 10, 2015 May 10, 2015

Copy link to clipboard

Copied

It's right up there with Planet X, I wonder how everyone ends up figuring these things out over time!

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
Guide ,
May 10, 2015 May 10, 2015

Copy link to clipboard

Copied

The frustration of doing the same thing over and over again got me started in to programming/scripting.

The frustration of limited scripting access has me doing much trial and error.

So now I'm back where I started, Doing the same thing over and over again...

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
Contributor ,
May 11, 2015 May 11, 2015

Copy link to clipboard

Copied

Thanks for everyone that responded, you all found solutions so I wish I could give everyone correct answer points. And Quertyfly, the way you were able to create and load an action with your script was really cool, If I can figure out what and how the heck you did it would really open up a lot more possibilities for me.

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
Guide ,
May 11, 2015 May 11, 2015

Copy link to clipboard

Copied

The real praise goes to moluapple‌.

[Illustrator]Create, load and execute action all by JS only

the trick is to create the action manually. then save it.

the saved file contains all the info you need.

combine that with the above script and your away.

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
Valorous Hero ,
May 11, 2015 May 11, 2015

Copy link to clipboard

Copied

And, maybe one day they will let scripting access more of the action panel, such as really letting us detect if the right actions are there!

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
Guide ,
May 12, 2015 May 12, 2015

Copy link to clipboard

Copied

bit of a hack workaround, but now there is no dialog on first run.

added an extra action that adds an element to the page that I can test for.

try to run that action, then test for element. if exists, remove it and run real action, else add both actions.

also moved the "actionStr" deeper in the script so large variable only get loaded if it is needed.

// CS6 and beyond only 

// Credit for the meat of this must go to moluapple 

// https://gist.github.com/moluapple/2568405 

// 

// Qwertyfly 12-5-15 

//

var sel = app.activeDocument.selection;

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

app.doScript('TestExistance', 'ScriptAction');

app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

var flag = false;

var stuff = app.activeDocument.pageItems;

for(var i = 0; i < stuff.length; i++){

    if(stuff.note == "~test~exist~"){

        stuff.remove();

        flag = true;

        break;

    }

}

for(var i = 0; i < sel.length; i++){

    sel.selected = true;

}

if(flag == true){

    app.doScript('ExpandStroke', 'ScriptAction');

}else{

    var actionStr = ['/version 3', 

    '/name [ 12', 

    '536372697074416374696f6e', 

    ']', 

    '/isOpen 0', 

    '/actionCount 2', 

    '/action-1 {', 

    '/name [ 12', 

    '457870616e645374726f6b65', 

    ']', 

    '/keyIndex 0', 

    '/colorIndex 0', 

    '/isOpen 0', 

    '/eventCount 1', 

    '/event-1 {', 

    '/useRulersIn1stQuadrant 0', 

    '/internalName (ai_plugin_expand)', 

    '/localizedName [ 6', 

    '457870616e64', 

    ']', 

    '/isOpen 0', 

    '/isOn 1', 

    '/hasDialog 1', 

    '/showDialog 0', 

    '/parameterCount 4', 

    '/parameter-1 {', 

    '/key 1868720756', 

    '/showInPalette -1', 

    '/type (boolean)', 

    '/value 0', 

    '}', 

    '/parameter-2 {', 

    '/key 1718185068', 

    '/showInPalette -1', 

    '/type (boolean)', 

    '/value 0', 

    '}', 

    '/parameter-3 {', 

    '/key 1937011307', 

    '/showInPalette -1', 

    '/type (boolean)', 

    '/value 1', 

    '}', 

    '/parameter-4 {', 

    '/key 1936553064', 

    '/showInPalette -1', 

    '/type (boolean)', 

    '/value 0', 

    '}', 

    '}', 

    '}',

// this next action is the test...

    '/action-2 {',

    '/name [ 13',

    '546573744578697374616e6365',

    ']',

    '/keyIndex 0',

    '/colorIndex 0',

    '/isOpen 0',

    '/eventCount 2',

    '/event-1 {',

    '/useRulersIn1stQuadrant 0',

    '/internalName (adobe_createPath)',

    '/localizedName [ 13',

    '53657420576f726b2050617468',

    ']',

    '/isOpen 0',

    '/isOn 1',

    '/parameterCount 31',

    '/parameter-1 {',

    '/key 1931685936',

    '/showInPalette -1',

    '/type (integer)',

    '/value 4',

    '}',

    '/parameter-2 {',

    '/key 1882206256',

    '/showInPalette -1',

    '/type (real)',

    '/value -219.3307086614',

    '}',

    '/parameter-3 {',

    '/key 1345335344',

    '/showInPalette -1',

    '/type (real)',

    '/value -21.0026246719',

    '}',

    '/parameter-4 {',

    '/key 1764765744',

    '/showInPalette -1',

    '/type (real)',

    '/value -219.3307086614',

    '}',

    '/parameter-5 {',

    '/key 1227894832',

    '/showInPalette -1',

    '/type (real)',

    '/value -21.0026246719',

    '}',

    '/parameter-6 {',

    '/key 1865429040',

    '/showInPalette -1',

    '/type (real)',

    '/value -219.3307086614',

    '}',

    '/parameter-7 {',

    '/key 1328558128',

    '/showInPalette -1',

    '/type (real)',

    '/value -21.0026246719',

    '}',

    '/parameter-8 {',

    '/key 1664102448',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 1',

    '}',

    '/parameter-9 {',

    '/key 1882206257',

    '/showInPalette -1',

    '/type (real)',

    '/value -225.0',

    '}',

    '/parameter-10 {',

    '/key 1345335345',

    '/showInPalette -1',

    '/type (real)',

    '/value -21.0026246719',

    '}',

    '/parameter-11 {',

    '/key 1764765745',

    '/showInPalette -1',

    '/type (real)',

    '/value -225.0',

    '}',

    '/parameter-12 {',

    '/key 1227894833',

    '/showInPalette -1',

    '/type (real)',

    '/value -21.0026246719',

    '}',

    '/parameter-13 {',

    '/key 1865429041',

    '/showInPalette -1',

    '/type (real)',

    '/value -225.0',

    '}',

    '/parameter-14 {',

    '/key 1328558129',

    '/showInPalette -1',

    '/type (real)',

    '/value -21.0026246719',

    '}',

    '/parameter-15 {',

    '/key 1664102449',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 1',

    '}',

    '/parameter-16 {',

    '/key 1882206258',

    '/showInPalette -1',

    '/type (real)',

    '/value -225.0',

    '}',

    '/parameter-17 {',

    '/key 1345335346',

    '/showInPalette -1',

    '/type (real)',

    '/value -15.3333333333',

    '}',

    '/parameter-18 {',

    '/key 1764765746',

    '/showInPalette -1',

    '/type (real)',

    '/value -225.0',

    '}',

    '/parameter-19 {',

    '/key 1227894834',

    '/showInPalette -1',

    '/type (real)',

    '/value -15.3333333333',

    '}',

    '/parameter-20 {',

    '/key 1865429042',

    '/showInPalette -1',

    '/type (real)',

    '/value -225.0',

    '}',

    '/parameter-21 {',

    '/key 1328558130',

    '/showInPalette -1',

    '/type (real)',

    '/value -15.3333333333',

    '}',

    '/parameter-22 {',

    '/key 1664102450',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 1',

    '}',

    '/parameter-23 {',

    '/key 1882206259',

    '/showInPalette -1',

    '/type (real)',

    '/value -219.3307086614',

    '}',

    '/parameter-24 {',

    '/key 1345335347',

    '/showInPalette -1',

    '/type (real)',

    '/value -15.3333333333',

    '}',

    '/parameter-25 {',

    '/key 1764765747',

    '/showInPalette -1',

    '/type (real)',

    '/value -219.3307086614',

    '}',

    '/parameter-26 {',

    '/key 1227894835',

    '/showInPalette -1',

    '/type (real)',

    '/value -15.3333333333',

    '}',

    '/parameter-27 {',

    '/key 1865429043',

    '/showInPalette -1',

    '/type (real)',

    '/value -219.3307086614',

    '}',

    '/parameter-28 {',

    '/key 1328558131',

    '/showInPalette -1',

    '/type (real)',

    '/value -15.3333333333',

    '}',

    '/parameter-29 {',

    '/key 1664102451',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 1',

    '}',

    '/parameter-30 {',

    '/key 1668034608',

    '/showInPalette -1',

    '/type (boolean)',

    '/value 1',

    '}',

    '/parameter-31 {',

    '/key 1886677027',

    '/showInPalette -1',

    '/type (integer)',

    '/value 1',

    '}',

    '}',

    '/event-2 {',

    '/useRulersIn1stQuadrant 0',

    '/internalName (adobe_attributePalette)',

    '/localizedName [ 17',

    '4174747269627574652053657474696e67',

    ']',

    '/isOpen 0',

    '/isOn 1',

    '/hasDialog 0',

    '/parameterCount 1',

    '/parameter-1 {',

    '/key 1852798053',

    '/showInPalette -1',

    '/type (ustring)',

    '/value [ 12',

    '7e746573747e65786973747e',

    ']',

    '}',

    '}',

    '}'].join('\n');

    createAction(actionStr); 

    app.doScript('ExpandStroke', 'ScriptAction');

    var actionStr = null;

}

function createAction (str) { 

    var f = new File('~/ScriptAction.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
Contributor ,
May 13, 2015 May 13, 2015

Copy link to clipboard

Copied

That is some awesome stuff. Now, if there was a way to clear actions through script, that could save people the time of having to clear and reload actions every time they start up illustrator. I will start a new thread in case you know how to do that and you can get your points haha

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
Guide ,
May 13, 2015 May 13, 2015

Copy link to clipboard

Copied

LATEST

I have an idea on this.

needs a bit more testing.

will get back to 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