Skip to main content
Participating Frequently
April 19, 2013
Question

Is it possible in Extendscript/Javascript to 'Outline Stroke' a path

  • April 19, 2013
  • 2 replies
  • 4807 views

I'm trying to achieve the same command as enacted by Object > Path > Outline Stroke.

I can't find any reference to a method for this in the Javascript reference PDF, and you can't trigger menu commands in Javascript.

Applescript allows you to access the menu commands, so I wrote this:

tell application "Adobe Illustrator"

    set thisDoc to current document

    set locked of layer ("walls") of thisDoc to false

   

end tell

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"

   

end tell

But it has a very annoying problem: if you run the script form within Illustrator the 'Outline Stroke' command fails. But, if you run the script in the Applescript editor with the illustrator document open it works. Which is just plain weird. If anybody understands why this is the case I'd love to hear the reason (and fix).

If anybody has any ideas for successfully outlining strokes in either Javascript or Applescript please respond.

Thanks,

Barry

This topic has been closed for replies.

2 replies

CarlosCanto
Braniac
April 19, 2013

also heard, you can run Menu Commands with CS6

Participating Frequently
April 22, 2013

Thanks Carlos, from reading the Illustrator scripting guide for Javascript there's no way to trigger menu commands. You can do that in Applescript, but you have to allow access to assistive devices first in order for it to work.

Inspiring
April 22, 2013

This works in both Script Editor and from AI script menu…

tell application "Adobe Illustrator"

  activate

          tell the current document

                    set selected of every page item to true

          end tell

end tell

tell application "System Events"

          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"

end tell

Larry G. Schneider
Inspiring
April 19, 2013

Since you're using AppleScript why not just make an action to do what you want and call it using the doScript construct. You can also do this in ExtendScript now in CS6.

Participating Frequently
April 22, 2013

Thanks for replying. Unfortunately, doScript is an InDesign command, it's not available in Illustrator, so I can't trigger a bit of Applescript from my Extendscript (or vice versa).