This script is a JSX (JavaScript Extension) script for Adobe Illustrator to merge a folder of SVG files into a single Illustrator document. The script creates a new artboard named according to the file name (minus the .svg file extension), places the SVG file contents, centers the object, and aligns to the nearest pixel.
TODO: I need to look up the original source. Please bear with me while I locate this information.
There may have been other scripts that inspired or were used in the creation of this script. Any omissions of credits are purely accidental. If you recognize an omission, please let me know and I will happily add credit where it is due.
You are free to use, modify, and distribute this script as you see fit. No credit is required but would be greatly appreciated.
Iconfinder
THIS SCRIPT IS OFFERED AS-IS WITHOUT ANY WARRANTY OR GUARANTEES OF ANY KIND. YOU USE THIS SCRIPT COMPLETELY AT YOUR OWN RISK AND UNDER NO CIRCUMSTANCES WILL THE DEVELOPER AND/OR DISTRIBUTOR OF THIS SCRIPT BE HELD LIABLE FOR DAMAGES OF ANY KIND INCLUDING LOSS OF DATA OR DAMAGE TO HARDWARE OR SOFTWARE. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE THIS SCRIPT.
This script has only been tested on Adobe Illustrator CC 2014. It was written to complete a one-off personal project. If you find it useful, fantastic. But I cannot verify whether or not it will work on every system.
-
Place this script in Applications/Adobe Illustrator CC 2018/Presets/en_US/Scripts/
NOTE
If you are not using the US English translation of Adobe Illustrator, the
en\_US
folder will match that of your translation.Also, the Adobe Illustrator folder may have a different name depending on which version of Illustrator you have installed.
-
Restart Adobe Illustrator to activate the script
-
The script will be available under menu
File > Scripts > Merge SVG Files
. -
Enter values in the dialog for Artboard Width, Artboard Height, Artboard Spacing
-
Choose the folder of SVG files. Nested folders are fine. The script will search through any nested folers for SVG files.
-
When the script runs, you will be asked to select a source folder of SVG files. The script will ignore any non-SVG files.
-
The script will create a new Adobe Illustrator document with an artboard for each SVG file. Please note that Adobe Illustrator allows up to 1,000 artboards so the script will only work on the first 1,000 files it finds.
-
If logging is enabled (in the startup dialog) the script will create a log file named
ai-script-log.txt
on the Desktop of your computer. To turn this off, set the variable namedlogging
tofalse
near the top of the script.