I wish to create a macOS daemon as a Console app. This will monitor for certain device cases and I’d like to pop up a system dialog on certain exceptions. NOTE - Not a simple notification.
Can this be done via a call from a Xojo Console app? Or, am I stuck writing a hidden Desktop app to be able to propagate a popup dialog?
This would be macOS only and built in which ever Xojo API can get it done.
I don’t know the answer on if you can do it directly. But you can at very least then launch UI application from the console application that puts up dialog. (its strange but would do the job)
Instead of a console app, perhaps you could use use a windowless desktop app. You could launch it with no dock icon, so it remains hidden in the background, and then you have access to the full fledged UI.
Not only does that allow me to display the dialog I need, but I took it further and opened System Preferences to the Security pane for the user so they aren’t guessing what is meant by the dialog.
Cool! Glad it worked. I’m not sure how notarization and code-signing interact with this - does a console app need special permissions to access osascript? If an app can issue shell commands, it seems like it already has pretty wide permissions, but osascript = applescript which may be special?
Since Osascript is indeed AppleScript, it would not be accepted for a MAS app if it touched Finder or system events. But console is usually not uploaded there, unless for a helper.
That’s a good point to make people awere of, I think in this particular case, it is fine as the Apple Script doesn’t appear to be scripting a specific application.
However, it may require all the AppleScript hoops to be checked before release (even outside of the App Store).