Skip to main content
Participant
July 24, 2019
Question

Illustrator JS document.saveAs function opens Save As dialog in macOS 10.14

  • July 24, 2019
  • 2 replies
  • 1200 views

Problem Description:

Illustrator JS document.saveAs function opens Save As dialog in macOS 10.14 and AI 23.0.

Steps to Reproduce:

1. Install latest macOS 10.14;

2. Install Adobe Illustrator 23.0;

Our code for saving the file at the path:

createDocument : function(path) {

    var doc = null;

    try {

        doc = app.documents.add(DocumentColorSpace.RGB);

        var saveOptions = new IllustratorSaveOptions();

        saveOptions.compatibility = Compatibility.ILLUSTRATOR15;

        saveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;

        doc.saveAs(new File(path), saveOptions);

        doc.saved = true;

    } catch (error) {

        if (doc != null) {

            try {

                doc.close();

            } catch (error) {}

        }

        return "";

    }

    return path;

}

The path parameter can be something like: "/Users/macuser/Library/Application Support/Extension/temp/images/42fd858e-8b10-4296-a282-9a4fb0991e0f.ai".

Actual Result:

The Save As dialog window appears.

Screenshot

Expected Result:

File saves with name and in directory that we specified without opening any dialog windows (that's how it used to work earlier).

Maybe you could know, what can lead to this exception, so I could debug and find issue in my code.

This topic has been closed for replies.

2 replies

Participant
September 24, 2022

I’ve had the same problem. In my case it was a file path to a folder that did not existed. 

daitranthanhoa
Inspiring
July 30, 2019

You must change parameter name "path" to other name ex: strPath.

Because "path" name, it is variable of Illustrator , it will return path of Illustrator App.