How can I run an Illustrator javascript on all files in a directory? -


i'm trying use javascript update illustrator file. have script modify open file in desired way (really text find/replace, text encoded in illustrator data). problem have hundreds of these files want modified in same way in directory. there way me without having open every single 1 of these files?

i figure either: 1. there's way modify existing javascript read directory , load files in background, process them, save, , close. 2. can write node.js script can wrap existing illustrator javascript, i'm not sure how recognize "application" object , read file same way when it's opened in illustrator.

thanks help!

edit: here's functioning script (that .

function findandreplacescript_allopendocuments(){               for(var i=app.documents.length -1; > -1;  i--){               app.documents[i].activate();           var adoc = app.documents[i];            var searchstring = /oldtext/gi;              var replacestring = 'newtext';                 var thetf = adoc.textframes;               if (thetf.length > 0) {                   (var j = 0 ; j <thetf.length; j++) {                       var atf = thetf[j];                       var newstring = atf.contents.replace(searchstring, replacestring);                       if (newstring != atf.contents) {                           thetf[j].contents = newstring;                       }                   }               }       }   };       findandreplacescript_allopendocuments();    } 

yes,there way read directory:

var dir = folder.selectdialog("where?"); var files = dir.getfiles("*.eps");  for(var f = 0; f < files.length; f++){     var doc = app.open(files[f]);     //your processing     doc.close(saveoptions.savechanges); } 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -