"Saving As" from within an external application

Hi all,

Working on a “delayed Shutdown/sleep” project for Mac, I’m encountering this problem:

When sending “Term” signal via a Shell command, some apps automatically save modified documents, some do not. I’d like to “Save as” all opened documents in launched applications, without using Apple Events nor Applescript script, because of the NSAppleEventsUsageDescription needed in recent OS versions.


  • Is there a way, using Xojo code, MBS plugins or Framework calls, to do this?
  • Is it possible to know what app will “autosaves” its document(s), what app will not ?

At the moment, I’m able to get active apps list, their process name and PID.

TIA for any suggestion or help.


Hi Jean-Luc,

I’m afraid AppleEvents is the only way. Even ProcesMBS.Quit sends one behind the hood. I hope to be wrong, but I’m not aware I am, here.

The apps which save automatically are those who implement the restore feature included in Mac OS 11 (IIRC). Most Apple apps do and others are encouraged by Apple to do so. They are the ones which also won’t ask you whether to save changes when you quit the app (because they automatically save).

Why is using the NSAppleEventsUsageDescription a problem in your case?


1 Like

Because he would have to show the §$%& dialog for every app he wants to quit.

1 Like

Yes, I agree that this is an unwanted behaviour. However, I don’t expect you can do everything the same way you used to do in earlier versions of the OS with always avoiding those annoying dialogs/“security measures”, sadly.

1 Like

As Beatrix wrote, I would have to validate the dialog, whereas my goal is to put the Mac down or in sleeping mode in the middle of the night, after a long calculation, while I am sleeping!
Thanks for your reply.

You’re absolutely right!
Thanks for your reply.

The first time, yes. But once the OS knows your app has the rights, it normally won’t ask again.
So you can instruct the OS to trust your app (e.g. by calling a dummy script) and then use the real script in the night.

1 Like