Using Extendscript/JavaScript to open a new file from an Illustrator .ait file.
Copy link to clipboard
Copied
Hello, everyone. I am writing a script to use with Illustrator. I have a template file I would like to create new documents from, saved as an .ait file. How can I use either ExtendScript or JavaScript to open a new document from the template file?
Thanks!
Explore related tutorials & articles
Copy link to clipboard
Copied
The same way you open any file.
1. Get the path to the file (below is an example of a path to a template on my PC to show the notation).
2. Create a new file (using the new File() constructor).
3. Open the file (using the app function open()).
app.open(new File("/C/Program Files (x86)/Adobe/Adobe Illustrator CS6/Cool Extras/en_GB/Templates/Blank Templates/Banner Ads.ait"));
Copy link to clipboard
Copied
Thanks, femkeblanco! I am getting an error that it cannot find the illustrator file. I tried using both the absolute and relative paths. The issue may be due to the network I am on. Even so, I am much closer to a solution now.
Thanks again!
Copy link to clipboard
Copied
Update!
To get the file path, I was shift-clicking on the file and selecting 'copy file path' (Windows 10), but this uses back slashes rather than forward slashes. I changed the path according to your example and it works.
Thanks again!

