2 Replies Latest reply on Mar 29, 2014 10:46 AM by joseM

    javascript: copy an object to a new layer and tracing it


      Hello everybody:


      I'm using Illustrator CS5 on Mac. I need to copy an objecto to a new layer and tracing it. I'm trying to execute the script above. There is no problem with the copy to a new layer, but Illustrator returns the error "newItem.trace is not a function". Sorry because this is my first script and i'm lost.


      Thank you in advance.



          var myDoc = app.activeDocument;

          var sel = myDoc.selection[0];


        if ( myDoc.selection.length > 0 ) {


          var newLayer = myDoc.layers.add();

          var newItem = sel.duplicate( newLayer, ElementPlacement.PLACEATEND );

          var myTrace = newitem.trace();

          var myOpts = myTrace.tracing.tracingOptions;


          myOpts.tracingModeType = 'TRACINGMODEBLACKANDWHITE';