I am trying to write a script that can close all open document in illustrator and prompt me if I want to save this or not. This has to be done with script because my full script is about getting a job done and closing all open docs after it. But no matter what I try it always gives me some error. Can anyone give me a possible solution for it?
This is my code:
for(var i = 0; i < app.documents.length; i++ ){
app.documents[i].activate();
generateText(); //this is the function that needs to be execute first
app.activeDocument.close(SaveOptions.PROMPTTOSAVECHANGES); //not work properly
//app.executeMenuCommand("close"); //does not work either
}