Solution to Script : Pasting artwork is slow, includes unused data


i have solution 'many swatch' problem (http://helpx.adobe.com/illustrator/kb/copy-paste-artwork-slow-or.html)

 

1. unlock object (ctrl+alt+2)

2. select object (ctrl+a)

3. run script

 

principle ...

(1) open new document

(2) copy selected object new document

(3) save new document (xxx_new.ai)

 

 

i'm not programmer. feel uneasy open source code. but, it's maybe hint problem.

 

if it's not work, send ai file. need variety test data.

 

part3story@gmail.com

 

 

 

 

var title = "swatchmata";   var docpreset = new documentpreset;           docpreset.units = rulerunits.millimeters;           docpreset.width = 297*2.83464566929134;           docpreset.height=210*2.83464566929134;     if(app.documents.length == 0){alert("file open please", title)}  else {           var runconfirm = confirm("copy selected object only. locked object not copy. keep going?", false, title);           if(runconfirm==true){                     var docref = activedocument;                      var newgroup = docref.groupitems.add();                     var sel = docref.selection;                     if(sel.length>0){ swatchmata();}                     }           }   function ungroup(wheretoungroup, group) // ungroup? layer, document, other group?      {           (i=group.pageitems.length-1; i>=0; i--)                group.pageitems[i].move(wheretoungroup, elementplacement.placeatbeginning);      }   function cutex(path){           var fullpath = path;           var filename = path.slice(0, path.lastindexof("."));           return filename }   function exportfiletoai (mydoc, dest) {           if ( app.documents.length > 0 ) {                     var saveoptions = new illustratorsaveoptions();                     var ai13doc = new file(dest);                     saveoptions.compatibility = compatibility.illustrator13;                     saveoptions.flattenoutput = outputflattening.preserveappearance;                     mydoc.saveas( ai13doc, saveoptions );           } }   function swatchmata(){                   var docref2 = documents.adddocument(documentcolorspace.cmyk, docpreset);           for(i=0; i<sel.length; i++){                      sel[i].duplicate(newgroup, elementplacement.placeatend); //copy                     }           newgroup.move(docref2, elementplacement.placeatbeginning)              var myfilepath = docref.path           var myfilename = cutex(docref.name) + "_new.ai";           var fullpath = myfilepath +"/" + myfilename;              exportfiletoai(docref2, fullpath)              docref2.selected = true;           ungroup(docref2, newgroup); }  

i had brief @ link… did read may possible read file script , text removal… didn't see manual solution not done script… regular expression should able find , remove unwanted plug-in parts. said , have not had time check ai file need not compressed… in order readable… unless jongware knows how decompress ai file… wouldn't have clue on how go that…



More discussions in Illustrator Scripting


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account