14 Replies Latest reply on Apr 23, 2013 2:23 AM by BarryRichards

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

    BarryRichards

      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