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

There is a problem with saving as illustrator using AppleScript

Community Beginner ,
Apr 24, 2025 Apr 24, 2025

The following is my code. It works when I use version 2023, but it fails when I use version 2024. The error message is "Cannot get document 1"

 

save aiDoc in file mynewfilepath as Illustrator ¬

with options {class:Illustrator save options, embed ICC profile:true, flatten output:preserve appearance}

 

Please help me

TOPICS
Bug , Scripting , Sync and storage
212
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

correct answers 1 Correct answer

Engaged , Apr 24, 2025 Apr 24, 2025

This does appear to be a bug. The error occurs when the `save` command’s `with options` parameter is a record containing a `embed icc profile` property.

 

Your command is valid but fails on AI 28.7.6 and AI 29.5 (macOS 15.3.2):

 

 

set mynewfile to "/Users/jsmith/test.ai" as POSIX file -- change this to your actual path

tell application "Adobe Illustrator"
  save document 1 in mynewfile as Illustrator with options ¬
    {class:Illustrator save options, flatten output:preserve appearance, embed icc p
...
Translate
Adobe
Engaged ,
Apr 24, 2025 Apr 24, 2025

This does appear to be a bug. The error occurs when the `save` command’s `with options` parameter is a record containing a `embed icc profile` property.

 

Your command is valid but fails on AI 28.7.6 and AI 29.5 (macOS 15.3.2):

 

 

set mynewfile to "/Users/jsmith/test.ai" as POSIX file -- change this to your actual path

tell application "Adobe Illustrator"
  save document 1 in mynewfile as Illustrator with options ¬
    {class:Illustrator save options, flatten output:preserve appearance, embed icc profile:false} -- this errors!
end tell

 

 

However this works:

 

set mynewfile to "/Users/jsmith/test.ai" as POSIX file -- change this to your actual path

tell application "Adobe Illustrator"
  save document 1 in mynewfile as Illustrator with options ¬
    {class:Illustrator save options, flatten output:preserve appearance} -- this works
end tell

 

In addition, the “Can’t get document 1” error message is incorrect as the problem is the `with options` parameter, so that’s a second bug. (I’ll assume you do have at least one document open. Ironically, if you don’t, AI correctly returns an error but this time the message is “File/Folder expected” instead of “Can’t get document 1”, so that’s three bugs in the `save` command!)

 

You can file your bug report here:

 

https://illustrator.uservoice.com/

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 ,
Apr 25, 2025 Apr 25, 2025

Thank you very much for your help. I don't have a Facebook account, so I can't fill in the BUG. If you can, can you help me submit this BUG?

Do you know that JavaScript will also have the same problem?

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
Engaged ,
Apr 25, 2025 Apr 25, 2025

You can create an account with your email address; you don’t need Facebook (I don’t have it either).

 

JavaScript appears to work correctly:

 

var d = app.documents[0];

var saveOptions = new IllustratorSaveOptions();
saveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
saveOptions.embedICCProfile = true;

d.saveAs(new File('~/testjs.ai'), saveOptions);

 

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 ,
Apr 25, 2025 Apr 25, 2025

Thank you very much for your help

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 ,
May 05, 2025 May 05, 2025
LATEST
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