Send Message action sometimes (but not always) brings the app to the front

The KM Send iMessage action works great when the Messages app is already running, but when it isn't running it launches the app and places it in front of all other windows, which can mess up my workflow. Is there a way to get the Send Message action to launch the app but keep it in the background?

  • I looked at the KM action "Activate Application" and there isn't a flag to keep the app hidden when launching it.
  • I looked at the macOS "open" command and it says "open -g" should work, but I tested it and it doesn't work.

...should do it.

Thanks, I will mark that as a solution, although I still wish the KM action "Send Message" would stop placing the Messages app in front of my screen.

Complain to Apple, ask them to provide a way to open an app backgrounded. If it was an option I'm sure it would have been implemented in KM by now.

This will teach me to avoid using KM actions directly. Instead, I will create macros that call the actions indirectly. In this case, if I had done that, I would be able to put your Applescript action directly in front of the KM action which would fix the problem for all my macros at once.