'Saving the script as a project with Document.saveAs in Adobe Illustrator
I'm trying to save the script as a project to work with it later on
var doc = app.documents.add(null, 1080 , 1080, 1);
var file = New File("/c/Users/user/Documents/05illustratorScript.ai");
app.activeDocument.saveAs(file);
It marks line2 (expected ;)
If I do instead
var doc = app.documents.add(null, 1080 , 1080, 1);
app.activeDocument.saveAs("/c/Users/user/Documents/05illustratorScript.ai");
It says Illegal argument - argument 1 (on the line2)
Has anyone successfully used this method?
Solution 1:[1]
Seems that I was missing to include the second argument of the method Document.saveAs which is the "Save Options" , they are in turn another object that needs to be created.
The way to create a new document and save it as a certain .ai is
var doc = app.documents.add(null, 1080 , 1080, 1);
var newFile = new File("/c/your/Path/file.ai");
var saveOptions = new IllustratorSaveOptions();
app.activeDocument.saveAs(newFile , saveOptions);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | freddie_ventura |
