Applescript to close multiple documents without saving

Talk about Pixelmator Pro, share tips & tricks, tutorials, and other resources.
User avatar

2021-10-06 03:42:00

My Workflow: Edit multiple inbox/incoming images and export them to web friendly formats. Once I do the export, I do not need to save the document.

The Problem: When I try to close the document, I get the dialog with the button "Don't save". However the standard MacOS shortcut CMD+D for this button does not work.

Applescript Solution I tried
tell application "Pixelmator Pro"
    quit saving no
end tell
However when I reopen "Pixelmator Pro", the last document that was not saved still opens. How do I fix this ?
User avatar

2021-10-06 05:19:43

Got it.
AppleScript Action Items - with the do verbs on found items
close(documents)
Still am curious to know the difference of doing it this way from `quit saving no`
User avatar

2021-10-06 07:34:20

Hi Don, the standard macOS shortcut for the Don't Save button in that dialog is actually Command-Backspace – it should work the same in native Apple apps like TextEdit, Keynote, Pages, etc. And should, hopefully, work for you in Pixelmator Pro, too. :fingers_crossed:

As for the script not working as expected, I would assume there's a difference between quitting a particular app and closing a document. So
tell application "Pixelmator Pro"
	quit without saving
end tell
I guess means quit the app and don't save anything (but restore everything again when I reopen the app). Whereas:
tell application "Pixelmator Pro"
	close the front document without saving
end tell
Or:
tell application "Pixelmator Pro"
	close every document without saving
end tell
Means close the current (or every) document and discard all changes. I can see where the confusion would arise, but that's my take on things.
User avatar

2021-10-06 14:22:46

Thanks for the reply.

My bad, I thought CMD+D was shortcut for "Don't save" from the Photoshop 6 Era :dizzy_face:

But AppleScript seems the better solution to close all documents in "one fell swoop"
User avatar

2021-10-06 14:31:44

by Don Joseph 2021-10-05 21:00:00 My bad, I thought CMD+D was shortcut for "Don't save" from the Photoshop 6 Era :dizzy_face:

But AppleScript seems the better solution to close all documents in "one fell swoop"
Ah, you most certainly aren't the first person to get tripped up by the Command-D/Command-Backspace situation, so I'm not too surprised to hear it's a PS shortcut. :sweat_smile: And it's actually already used in that dialog for changing the location to the desktop, so it wouldn't be too smart for us to repurpose it.

Glad to hear the AppleScript solution works for you, though!
User avatar

2022-04-03 21:08:11

When I run this:
tell application "Pixelmator Pro"
	close every document without saving
end tell
the documents are closed but if I've made any changes to them, a copy is saved in my Pixelmator iCloud folder. How do I stop the app from doing this?
User avatar

2022-04-03 21:15:43

Removing Pixelmator Pro from iCloud worked but was unintuitive:
https://www.pixelmator.com/community/vi ... 12&t=18381