Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using Extendscript/JavaScript to open a new file from an Illustrator .ait file.

Community Beginner ,
Aug 13, 2021 Aug 13, 2021

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!

TOPICS
Scripting
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Aug 13, 2021 Aug 13, 2021

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"));

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 16, 2021 Aug 16, 2021

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 16, 2021 Aug 16, 2021
LATEST

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines