Skip to main content
Known Participant
August 12, 2010
Answered

Close ALL - No Save

  • August 12, 2010
  • 4 replies
  • 9308 views

Alt+Ctrl+W  closes all documents if a modification was made a warning shows up asking to save or no.

My action "Close All-No Save" takes care of this but the action was written for 8 documents then if only 4 documents are open and playing the action

the dialog Continue or Stop shows up and one must click Stop.

Can a script close all open documents without saving regardless how many are open. An action would call the script and the clicking on the Stop in the dialog

would be not required.

I know not a big deal to click on stop but if it can be avoided why not?

This topic has been closed for replies.
Correct answer Muppet_Mark-QAl63s

was.close(AnswerOptions.DONOTANSWER)…

4 replies

Inspiring
August 13, 2010

In the height of laziness (er I mean efficiency) I recently wrote this script that closes all documents EXCEPT the one that you've got selected, useful if you find yourself in a situation where you're looking at lots of images and wondering which one to choice, select it and instantly disregard all the rest. Not that this happens frequently but I was curious write such a thing.

//close everything else execept the current document

//pref pixels
app.preferences.rulerUnits = Units.PIXELS;

// make a copy of the array
var docs = new Array();
for (i=0; i < app.documents.length;  i++) {
docs = app.documents;
}

// call the selected document that you want to keep open
var selectedDoc = app.activeDocument;


//alert (docs.length + " number of docs open")


//run a loop for all the open documents
for (i=0; i < docs.length;  i++) {

// if this isn't the selected document then close it
if (docs != selectedDoc) {

//close that document without saving
docs.close(SaveOptions.DONOTSAVECHANGES);
   }

}

Norman_BeAuthor
Known Participant
August 13, 2010

Works perfect.

Photographing Events I want to show 4 pictures. Customer selects the one they like the others are closed. It's here where the script invoked by an action comes in very handy.

Thanks for posting it.

Participant
August 12, 2010

If you're feeling a bit more lazy, you can create an action by recording as you close an image and don't save it.  Then just use batch and run the action on all open files.

JJMack
Community Expert
Community Expert
August 12, 2010

Photoshop CS5 has amenu item File>Close all when the prompt come up there is a check box you can check to have the your no save answer apply to all. You can use that in an action.  Also Trevor Morris has many free scripts on his web site one is Close ALL Without Saving http://morris-photographics.com/photoshop/scripts/close-without-save.html

JJMack
Muppet_Mark-QAl63s
Muppet_Mark-QAl63sCorrect answer
Inspiring
August 12, 2010

was.close(AnswerOptions.DONOTANSWER)…

Norman_BeAuthor
Known Participant
August 12, 2010

New to this new layout.

Do I need to click on the buttons Helful or Correct Answer befor I reply. Want to do things right.

Have not tried it but as I mentioned before the script looks like that your answer is correct.

Late tonight New York Time I will chck it out

Muppet_Mark-QAl63s
Inspiring
August 12, 2010

Then calling this may do what you wish…

#target photoshop while(app.documents.length > 0)      {      app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);      }

Norman_BeAuthor
Known Participant
August 12, 2010

I can see in the script that it will work.

I am not on my working machine but will try it tonoght.

Thanks.