Tell another app to close

Hi all,

I have mac app in process that will launch a few helper apps for various purposes. I would like to be able to also tell those apps to close.

Several of the apps were not written by me and I don’t have any API control. In Windows, it was possible to post a WM_CLOSE message to an app and well behaved apps respected that and started to close.

I’m wondering if there is any similar way to achieve this under MacOS with xojo?

I am using FolderItem.launch to launch the apps successfully.

Any ideas welcome!

Maybe you can use (from shell):

ps aux | grep -v grep |grep -i <application name> | awk '{print $2;}'

and then the Kill <pid> command.

Javier, thanks… Was considering that. I am hoping if I go that route kill gives the app some time to clean up.

Probably not (saving pending data, for example)

For a GUI app better use Apple Events to send quit command. Then user has chance to save.

1 Like