Script to open SVGs in a folder and save them to one multipage PDF

Hi.
I'm using Illustrator for work and I love it, I never needed scripts yet.
Now I have couple houndred svgs coming in per day,
I would like to have a script that opens every svg one by one in the selected directory and add them to a pdf
as pages of the same size and than save it.
Is this possible? How many files I could put in 1 pdf this way?
I'm using Illustrator CS5 on Win7 x64.
Thanks in advance.
Istvan

I think there is a 100 file limit on artboards ( not tested ) but the size would also affect that… You can't straight place *.svg but you can make group from them would that do you?
#target Illustrator
function filesToArtboards() {
          // My function variables…
          var doc, fileList, i, inFolder, mm, svgFile;
          // Get the user to select a folder
          inFolder = Folder.selectDialog( 'Please choose your Folder of files to place…' );
          // Check they ain't cancelled
          if ( inFolder != null ) {
                    // Gets just the SVG files…
                    fileList = inFolder.getFiles( /\.svg$/i );
                    // Make sure it has AI files in it…
                    if ( fileList.length > 0 ) {
                              mm = 2.83464567 // Metric MM converter…
                              // Set the script to work with artboard rulers
                              app.coordinateSystem =
                              CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
                              // Add new multi-page document
                              doc = app.documents.add(
                                         DocumentColorSpace.RGB,
                                         width = 148.5*mm,
                                         height = 210*mm,
                                         numArtboards = fileList.length, // The number of SVG files
                                         DocumentArtboardLayout.GridByCol,
                                         artboardSpacing = 20*mm,
                                         artboardRowsOrCols = Math.round( Math.sqrt( fileList.length ) )
                              // Loop thru the counter
                              for ( i = 0; i < fileList.length; i++ ) {
                                        // Set the active artboard rulers based on this 
                                        doc.artboards.setActiveArtboardIndex( i );
                                        // Create group from SVG
                                        svgFile = doc.groupItems.createFromFile( fileList[i] );
                                        // Move relative to this artboards rulers
                                        // Top Left
                                        sgvFile.position = [ 0, 0 ];
filesToArtboards();

Similar Messages

  • Developers I need an applescript that opens documents in excel from a specified folder and saves them as .xlsx from their current .xlsb

    mule13470 
    Apr 3, 2014 11:12 AM 
    I tried simply renaming them however it just corrupts the files when I do it like that so I need the applescript to open the files in excel and the save them as .xlsx to test I only need it one folder but if it works I'd like to be able to do it for all documents with .xlsb extentions that are in a huge folder with subfolders that contain a mix of .pdf, .docx, .xlsx and .xlsb. Please Help.
    Applescript Editor, Mac OS X (10.6.8) 
    I have this question too (0) 
    Reply
    Categories: Using OS X MavericksTags: mac, help, finder, excel, applescript_editor
    Level 1 (0 points)
    mule13470
    Re: I need an applescript that opens documents in excel from a specified folder and saves them as .xlsx from their current .xlsbApr 3, 2014 11:19 AM (in response to mule13470) 
    In that huge folder I only need the .xlsb files opened and saved to .xlsx not the others, in case that wasn't clear above.

    In that huge folder I only need the .xlsb files opened and saved to .xlsx not the others, in case that wasn't clear above.

  • How can I open all my itunes libraries and merge them into one?

    Some of my music can't be opened by itunes because it says it is in another library.  As there are several of these and they won't open,I can't see where the songs I want are.  Therefore I would like to open ALL the libraries and merge them into one.  Thanks for any help.

    Hmm, read that post of Dave Sawyer's and thought well, that's Ok I have it on my iPod, but no, it's not there either.  Then resorted to Time Machine (not used for a few months (took it away with us when we evacuated to avoid Cyclone Yasi) only to find that is playing up also, and it doesn't appear to be anywhere there either!
    One thing leads on to another - Time Machine has only backed up to 3 months back; then there is nothing beyond!  yet there is tons of stuff on it.  Maybe it backs up the whole system each time, and not just the changes made inbetween times.   The prefs. won't appear and so I can't change the setup.
    All this just because of one sone!

  • I need an applescript that opens documents in excel from a specified folder and saves them as .xlsx from their current .xlsb

    I tried simply renaming them however it just corrupts the files when I do it like that so I need the applescript to open the files in excel and the save them as .xlsx to test I only need it one folder but if it works I'd like to be able to do it for all documents with .xlsb extentions that are in a huge folder with subfolders that contain a mix of .pdf, .docx, .xlsx and .xlsb. Please Help.

    In that huge folder I only need the .xlsb files opened and saved to .xlsx not the others, in case that wasn't clear above.

  • Extracting the first page from all pdf's in a folder and save them to a new file

    Hi,
    As Bridge apparantly is unable to create a decent-looking PDF from a bunch of other PDF's, we're looking for alternative solutions. The problem is, that I haven't done much scripting in Acrobat.
    Pseudocode:
    Select Folder where PDF files are stored
    Create list of PDF files
    Get first page from each and add it to temporary new PDF
    Save temporary new PDF in high quality
    Would that be possible in Acrobat? And where would I start? I can't even find a Scripting Guide for Acrobat (like the ones for Illustrator and InDesign).. and there seems to be no sample scripts included either :-(
    Thanks,
    Thomas

    This can be done using a combination of an Action and a script. The script in the Action will collect the paths of the files you want to process and the folder-level script will extract the first page from each file and generate a new PDF from it. You don't need a plugin for this task, so you don't really need the SDK.
    The Acrobat JavaScript Reference can be found here: http://www.adobe.com/devnet/acrobat/javascript.html

  • How to systematically open file in a folder and process them with a program

    Hello,
    For my second question of the night.
    I am wondering if there is a way to open every file in a folder, run them through a vi, and then append the output to an array or spreadsheet? This would save me lots of time and my wrists.
    Thanks
    Solved!
    Go to Solution.

    Hi,
    Yes you can open a file in the folder by using 'List folder' function (Programming>File I/O>Advvanced File Function>List Folder) which lists all the files and folders in the given path. From that you can build the path and give to 'Open File' function.
    Hope this helps you. Let us know this solves your issue

  • Open SVG File, manage it and save it

    Hi!
    i'm new using java and batik
    i've a svgFile.svg and i want to manage it, and later to save the changes in a newsvgFile.svg
    i open the svgFile.svg and i put it in a 'org.w3c.dom.Document docSVG'
    now i want to manage it, but i suppose it wont be a problem with batik toolkit...
    but the problem is this:
    now i want to save my 'org.w3c.dom.Document docSVG' into a newsvgFile.svg... then i do this:
    import java.io.IOException;
    import org.apache.batik.svggen.SVGGraphics2D;
    import org.apache.batik.dom.GenericDOMImplementation;
    import org.w3c.dom.DOMImplementation;
    public class Manager {
    public static void main(String [] args) throws IOException {
    //SVGDatei is a function to put the svgFile.svg in org.w3c.dom.Document docSVG
    SVGDatei svgDatei = new SVGDatei();
    DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
    SVGGraphics2D svgGenerator = new SVGGraphics2D(svgDatei.docSVG);
    svgGenerator.stream("svgFile.svg", true);
    But this code only generate a empty svg file in 'svgFile.svg '
    Why don't load my document??
    Somebody can help me?
    Thank you!
    Xavi.

    Hi martin!
    Sorry, I don't understand the question: Do you hace a CVS (Current Version System) client setup?
    client setup? for??
    [ maybe you can send me some of this 'chunks of code' to take a look.. my e-mail: xavier(dot)murillo(at)student(dot)uni-ulm(dot)de ]
    thank's a lot.
    xavi

  • Is it possible to open gerber files in Illustrator and save them as .eps?

    Well?
    //ekmanch

    If by Gerber, you mean Gerber Scientific Products Omega software, no. You cannot directly open or import their proprietary fromat into Illustrator.
    On the other hand, Omega will export to both AI and EPS formats, so why would you need to?
    --OB

  • I'm working with DW cs4: can I open DW cs3 files? And save them as DW cs3?

    I have to do some corrections for a client: adding SEO in his DW CS3 documents (I'm working with windows CS4).
    How will that go? and can I save it to CS3 so that he can open it too in CS3?

    Thanks Osgood, I will start the adventure and see how it works,
    succes,
    Lautrec7

  • HELP. ............Hi folks hope some one can help me please.Having a problem in Bridge I open my images in ACR,  as I open files in a folder and lets say they are labeled in yellow  they are all going back to  the camera raw default , in other words no ma

    HELP. ............Hi folks hope some one can help me please.Having a problem in Bridge I open my images in ACR,  as I open files in a folder and lets say they are labeled in yellow  they are all going back to  the camera raw default , in other words no matter what work I have done, inc cropping they  all go back to ,as they came out of camera. What on earth is happening? I am on PS CS6. I might point out everything was working normally up to  yesterday, when this first started.
    I recently changed computer to 64bit from 32bit, not sure if this causing  the problem or not. Any help would be appreciated.

    Robert,
    Would you be so kind to rephrase your question with concise, precise information and without any "let's say that" hypotheticals?  Sorry, I can't quite follow you.
    Also please give exact versions of Photoshop CS6 (13.what.what), of Bridge and of your OS.
    Thanks.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, what error message(s) you receive, if having issues opening raw files also the exact camera make and model that generated them, etc., someone may be able to help you.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • I cannot open my i-Tunes folder and error message R6034 says I must re-install i-Tunes. If I do this will I lose all my music?

    I cannot open my i-Tunes folder and error message R6034 says I must re-install i-Tunes. If I do this will I lose all my music?

    See Troubleshooting issues with iTunes for Windows updates.
    Your library should be fine.
    You ought to back it up routinely anyway.
    tt2

  • Open all pages in a PDF and save them as sequential files

    I'm trying to make a script that will open all pages in a multi-page PDF and save them as sequential files, but I have had no luck with the simple script in the "Adobe Ilustrator CS5 Reference: JavaScript".
    there example to open a PDF to a designated page does not work for me in Illustrator CS 5.
    // Opens a PDF file with specified options
    var pdfOptions = app.preferences.PDFFileOptions;
    pdfOptions.pDFCropToBox = PDFBoxType.PDFBOUNDINGBOX;
    pdfOptions.pageToOpen = 2;
    // Open a file using these preferences
    var fileRef = filePath;
    if (fileRef != null) {
    var docRef = open(fileRef, DocumentColorSpace.RGB);
    if anyone can get me on the right path it would be appreciated.

    Hi DuanesSFK,
    you can open a PDF page on this way (tested with CS3 and 5):
    //OpenPDFpage2.jsx
    var uILevel = userInteractionLevel; 
    app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    // Opens a PDF file with specified options
    var pdfOptions = app.preferences.PDFFileOptions;
    pdfOptions.pDFCropToBox = PDFBoxType.PDFBOUNDINGBOX;
    pdfOptions.pageToOpen = 2;
    // Open a file using these preferences
    //var fileRef = filePath;
    var fileRef = File("~/Desktop/YourOwn.pdf");
    if (fileRef != null) {
    var docRef = open(fileRef, DocumentColorSpace.RGB);
    app.userInteractionLevel = uILevel;
    To open all pages you have to loop through all pages etc.
    Easier for you:
    Search here in forum for the "open pdf" script  (I don't know the exactly name, it was written by CarlosCanto, ) This should always work for you.
    Have fun

  • How do I stop my new mac book pro from opening all my old emails and flasing them in the top right corner?

    How do I stop my new Mac book Pro from opening all my old emails and flashing them in the upper right.

    Copy the entire iTunes folder within the music folder on your old Mac to the music folder on your new Mac.
    You can use an external hard disc for the transfer, or you can connect the computers together using Firewire Target Disc Mode as explained here:  http://support.apple.com/kb/ht1661

  • Favor to ask : can you open this labview 2009 Vi and save it for me in a Labview 8.6 readable vi ?

    Hi guys, 
    I have a favor to ask : May somebody would be nice enough to open this Labview 2009 VI and save it in a Labview 8.6 readable VI  ? You'll probably have some missing blocks cause I use specials ones but I don't want to have to re-make all the VI.
    Thanks you very much
    G.
    Solved!
    Go to Solution.
    Attachments:
    Control3.vi ‏29 KB

    notimperial wrote:
    Probably not the right place to do this, but could someone onpen this in labview 2010 and save it in a format compatible with labview 2009?
    Thank you in advance
    You are right we have a thread for this here.
    http://forums.ni.com/t5/LabVIEW/Downconvert-VI-Req​uests/m-p/1067229
    Here is your vi please use the downconvert thread next time.
    Tim
    Johnson Controls
    Holland Michigan
    Attachments:
    WFMreaderIII.vi ‏53 KB

  • I would like to import two different cf cards from two different cameras into the same project/folder and have them be in order of the times they were taken, is there a trick?

    I would like to import two different cf cards from two different cameras into the same project/folder and have them be in the order of the times they were taken, any ideas on how to do this?

    Just import them normally and sort the project by date. They will fall into place. If you tried this and it isn;t happening then make sure the data and times on the two cameras are identical and make sure you are sorting by date and time and nothing else.

Maybe you are looking for