Skip to main content
RuyRamos
Participating Frequently
March 17, 2014
Answered

Outline stroke with Illustrator scripting

  • March 17, 2014
  • 2 replies
  • 5067 views

Hello everybody!

I'm making a script. I need to do the outline stroke action. I can't find it in the extendscript anywhere.

I can do it from a applescript and call it from my extendscript in CS6 BUT I need my script to run CS5.5 and run on a windows machine:

tell application "System Events"

    click menu item "All" of menu "Select" of menu bar item "Select" of menu bar 1 of process "Adobe Illustrator"

      

    click menu item "Outline Stroke" of menu "Path" of menu item "Path" of menu "Object" of menu bar item "Object" of menu bar 1 of process "Adobe Illustrator"

I have also found a way to do this in CS6 (app.executeMenuCommand ('Live Outline Stroke'))  but i havent got it working yet. And its for CS6+ so I can't really use it if I cant force my users to upgrade

Anyone out there with an answer? It would help me alot. As I understand it you can call functions withing extensionscript if you have the right "action code" for it. Using the ActionDescriptor.

 var desc3 = new ActionDescriptor();

I have looked around and I cant find any documentation with a complete reference with the action codes. Do any one of you out there the action code for "Outline stroke"?

Thanks so much for your answer and effort.

Regards,

Ruy Ramos

This topic has been closed for replies.
Correct answer Nils M. Barner

just in case someone else is looking for a solution...

should work in Ai 2015 and up:

 

 

#target illustrator
app.executeMenuCommand("selectall");
var doc = activeDocument; 
var sel = doc.selection;
if (sel.length > 0) {
   for (var i=0; i<sel.length; i++) {
      app.executeMenuCommand("OffsetPath v22");  
   }
}

 

  

2 replies

Inspiring
March 24, 2014

have fun

// select objects, which you want to tranform/expand. 

#target illustrator

app.executeMenuCommand("selectall");

var doc = activeDocument;

var sel = doc.selection;

if (sel.length > 0) {

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

        app.executeMenuCommand("Expand3");

       }

   }

RuyRamos
RuyRamosAuthor
Participating Frequently
March 24, 2014

Hello,

Thank you for this!! My question now is, is it possible to do this comand without the UI coming up?

I tried to set:

UserInteractionLevel.DONTDISPLAYALERTS

but nothing changes.

Do you know where there is a list of all the menucomands?

Thanks again

Regards,

Ruy Ramos

Nils M. BarnerCommunity ExpertCorrect answer
Community Expert
September 29, 2023

just in case someone else is looking for a solution...

should work in Ai 2015 and up:

 

 

#target illustrator
app.executeMenuCommand("selectall");
var doc = activeDocument; 
var sel = doc.selection;
if (sel.length > 0) {
   for (var i=0; i<sel.length; i++) {
      app.executeMenuCommand("OffsetPath v22");  
   }
}

 

  

CarlosCanto
Community Expert
Community Expert
March 17, 2014

playing Actions and executing Menu Commands debuted in CS6.

For CS5 you're out of luck, you're stuck with Applescript for playing actions

ActionDescriptor() is not illustrator, it might be Photoshop.

Inspiring
March 21, 2014

Yup it's PS… That app has 'action manager' code. You can even use a plug-in to record it and utilise. Alas not with AI.