Skip to main content
Mike_Gondek10189183
Community Expert
Community Expert
January 10, 2017
Answered

Save All Command

  • January 10, 2017
  • 2 replies
  • 6551 views

Is there a secret command or is this possible with scripting to make a save all open documents?

Many of us in the graphics arts/printing world have edits to make and this would be very useful. For example I have 6 baking mixes which need updating, and I update the job slug on each one of the six file with date, my initials, versions number. After that would like to save all with 1 command.

Even more than the time saving benefit , is the reduction of errors and remembering did I do this revision.

I  suggested this and many other suggestions over the years, but seems Adobe is letting anyone in the betas  and  are buried by suggestions of changing menus and icons rather than providing anything significantly useful to the creative or production anymore. So I turn to the Illustrator scripting forum, the last hope for seeing anything interesting.

This topic has been closed for replies.
Correct answer Silly-V

Try this one!

 

#target illustrator

function test(){

 

  for(var i=0; i<app.documents.length; i++){

    app.documents[i].activate();

    app.activeDocument.save();

  };

 

};

test();

 

oddly enough,     app.documents.save(); does not work - it's got to be the 'activeDocument'

 

Yes, this forum is a festering laboratory of creative and outrageous minds yet. Always something mythical and interesting abrew.

2 replies

pixxxelschubser
Community Expert
Community Expert
January 10, 2017

Hi Mike Gondek2​,

if I understand you right, try this:

var allDocs = app.documents;

for (i = allDocs.length-1; i >=0; i--) {

    if (allDocs[i].path != "") {

    if (!allDocs[i].saved) {allDocs[i].close(SaveOptions.SAVECHANGES);}

    else { allDocs[i].close();}

    }

}

 

Have fun

Disposition_Dev
Legend
January 10, 2017

I considered providing this approach, but my guess was he wanted to keep the files open. This is the approach i typically use because, personally, when i save a file, i'm done with it. But i know of many people who have workflows that require leaving files open while certain changes are made.

pixxxelschubser
Community Expert
Community Expert
January 10, 2017

This case could be possible. But I do not understand the workflow. Perhaps the TO Mike Gondek2​ explain in detail.

Save a file always overwrite the existing file. Making changes and save again with the same name (and path) will overwrite the original file again.

IMHO it could be

better to saveAs or

working with template files or

make the changes with a script (eg with dialog) and save or or or …

Silly-V
Silly-VCorrect answer
Legend
January 10, 2017

Try this one!

 

#target illustrator

function test(){

 

  for(var i=0; i<app.documents.length; i++){

    app.documents[i].activate();

    app.activeDocument.save();

  };

 

};

test();

 

oddly enough,     app.documents.save(); does not work - it's got to be the 'activeDocument'

 

Yes, this forum is a festering laboratory of creative and outrageous minds yet. Always something mythical and interesting abrew.

Disposition_Dev
Legend
January 10, 2017

man. i've been pulling my hair out trying to provide an answer to this question and have not been able to get app.documents[index].save() to work.

ugh. so frustrating. It just repeatedly says "you must provide a file path". and i'm screaming (internally) at my monitor "I GAVE YOU AN EFFING FILE PATH! JUST SAVE THE EFFING FILE! EFFING EFF!"