0 Replies Latest reply on Feb 24, 2016 1:37 AM by karthickm50893796

    How to combine symbols scripts A & B

    karthickm50893796 Level 1

      Script A


      var doc = app.activeDocument; 

      var syms = Array(); 

      var count = doc.symbols.length; 

      for ( var i = 0; i < count; i++ )  { 

                syms.push( doc.symbols[i].name ); 

      }; 

      var win = new Window( 'dialog', 'A drop down list of symbols' ); 

      win.add( 'dropdownlist', undefined, syms ); 

      win.center(); 

      win.show();

       

      Script B

       

      var docRef=app.activeDocument;

      var symbolNum=prompt("Enter the number of the Symbol you want to replace each selected object",1);

      for(i=0;i<docRef.selection.length;i++){

          var currObj=docRef.selection[i];

          var currLeft=currObj.left;

          var currTop=currObj.top;

          var currWidth=currObj.width;

          var currHeight=currObj.height;

          var currInstance=docRef.symbolItems.add(docRef.symbols[symbolNum-1]);

          currInstance.width*=currHeight/currInstance.height;

          currInstance.height=currHeight;

          currInstance.left=currLeft;

          currInstance.top=currTop;

          currInstance.selected=true;

          currObj.remove();

          redraw();

      }