Copy link to clipboard
Copied
Hello I am trying to close an open document without saving and without a prompt asking if I want to save
here is my VBS code:
Set appRef = CreateObject("Photoshop.Application")
appRef.ActiveDocument.Close(psDoNotSaveChanges)
Well it does not work, a prompte still pops up and asks me if I want to save or not...
HELP?
Thanks
David
Try:
appRef.ActiveDocument.Close(SaveOptions.DONOTSAVECHANGES)
Copy link to clipboard
Copied
Try:
appRef.ActiveDocument.Close(SaveOptions.DONOTSAVECHANGES)
Copy link to clipboard
Copied
Not sure why, but this answer didn't work for me.
Instead, I used below:
app.activeDocument.close(SaveOptions.no);
(This was for indesign 2019)
Copy link to clipboard
Copied
You shouldn't expect different Adobe apps to share the exact same code.
Copy link to clipboard
Copied
The scripting reference has these constant values for PsSaveOptions as
1 (psSaveChanges)
2 (psDoNotSaveChanges)
3 (PsPromptToSaveChanges)
I code in Python and this worked for me:
docRef.close(2)
Copy link to clipboard
Copied
Hi together,
after some years I came back to PhotoShop DOM scripting. And obviously something ( a lot maybe ? ) has changed perhaps.
I used the old DOM Documentation from a PhotoShop version about 10 years back, that gave me the wrong Enumerator regarding the close() method:
https://www.indesignjs.de/extendscriptAPI/photoshop2015.5/#Document.html#d1e47935__d1e48452
https://www.indesignjs.de/extendscriptAPI/photoshop2015.5/#SaveOptionsType.html#d1e26997
Old DOM Documentation said: SaveOptionsType.DONOTSAVECHANGES.
I finally found the right one in a more recent PhotoShop script on the web with: SaveOptions.DONOTSAVECHANGES
To my surprise PhotoShop 2025 did do no error message when I used the wrong enumerator. It just did nothing.
PhotoShop 2023 at least gave me a clue with the error message ( translated from German ) : "Error 2 SaveOptionsType is undefined".
What worked in PhotoShop 2023 and 2025 was:
app.activeDocument.close( SaveOptions.DONOTSAVECHANGES ) ;
Two questions remain:
[1] Is there a current DOM documentation for ExtendScript out there for PhotoShop 2025?
[2] Why did PhotoShop 2025 issue no error message on the same script?
app.displayDialogs was set to DialogModes.ERROR I finally learned.
Why? I have no idea. Is this the new default perhaps?
Now that I changed app.displayDialogs to DialogModes.ALL, the error message is coming up with PhotoShop 2025 just like PhotoShop 2023 did.
Thanks,
Uwe Laubender
( Adobe Community Expert )
Find more inspiration, events, and resources on the new Adobe Community
Explore Now