Trying to modify SaveDocsAsSVG to open and save all files within a directory automatically
i trying title suggests, can't find way specify folder want script @ , can't open/save/close files without user interaction. way need itterative pc i'm using cannot handle many open files @ once.
on side note, can't find documentation. example, arguments folder.selectdialog() accept? documentation that?
thank peeps!
using cs6 trying convert eps svg
here's copy of saveas should able modify
/********************************************************** adobe systems incorporated copyright 2005 adobe systems incorporated rights reserved notice: adobe permits use, modify, , distribute file in accordance terms of adobe license agreement accompanying it. if have received file source other adobe, use, modification, or distribution of requires prior written permission of adobe. *********************************************************/ /********************************************************** saveasai12.jsx description sample gets files specified user selected folder , batch processes them , saves them pdfs in user desired destination same file name. **********************************************************/ // main code [execution of script begins here] // uncomment suppress illustrator warning dialogs // app.userinteractionlevel = userinteractionlevel.dontdisplayalerts; var destfolder, sourcefolder, files, filetype, sourcedoc, targetfile, illustratorsaveopts; // select source folder. sourcefolder = folder.selectdialog( 'select folder illustrator files want convert ai', '~' ); // if valid folder selected if ( sourcefolder != null ) { files = new array(); filetype = prompt( 'select type of illustrator files want process. eg: *.ai', ' ' ); // files matching pattern files = sourcefolder.getfiles( filetype ); if ( files.length > 0 ) { // destination save files destfolder = folder.selectdialog( 'select folder want save converted ai files.', '~' ); ( = 0; < files.length; i++ ) { var optref = new openoptions(); optref.updatelegacytext = true; sourcedoc = app.open(files[i], documentcolorspace.cmyk, optref); // returns document object // call function getnewname name , file save ai targetfile = getnewname(); // call function getillustratoroptions illustratorsaveoptions files illustratorsaveopts = getillustratoroptions( ); // save ai sourcedoc.saveas( targetfile, illustratorsaveopts ); sourcedoc.close(); } alert( 'files saved ai in ' + destfolder ); } else { alert( 'no matching files found' ); } } /********************************************************* getnewname: function new file name. primary name same source file. **********************************************************/ function getnewname() { var ext, docname, newname, saveinfile, docname; docname = sourcedoc.name; ext = '.ai'; // new extension ai file newname = ""; ( var = 0 ; docname[i] != "." ; i++ ) { newname += docname[i]; } newname += ext; // full ai name of file // create file object save ai file saveinfile = new file( destfolder + '/' + newname ); return saveinfile; } /********************************************************* getillustratoroptions: function set ai saving options of files using illustratorsaveoptions object. **********************************************************/ function getillustratoroptions() { // create pdfsaveoptions object set ai options var illustratorsaveopts = new illustratorsaveoptions(); // setting illustratorsaveoptions properties. illustratorsaveopts.embedlinkedfiles = true; illustratorsaveopts.fontsubsetthreshold = 0.0 illustratorsaveopts.pdfcompatible = true illustratorsaveopts.compatibility = compatibility.illustrator14 illustratorsaveopts.embediccprofile = false return illustratorsaveopts; } it take little replace of lines should started. if uncomment line limit user interaction, need restore @ end of script.
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment