From within the scpt, I’m using this to call the application:
tell application (passedLoc & "myapp.app") to activate
Again, all good.
However, as the application is part of our policy enforcement, we want to bring the application to the front of whatever the user is doing. Within applicationWillFinishLaunching_ I’ve tried:
tell current application's NSApp to activateIgnoringOtherApps_(true)
tell theWindow to makekeyandorderfront_
As the script is being run every 20 seconds, the ONLY thing that works is tell theWindow to makekeyandorderfront_
This only works if the application is already open and the launch agent runs again, opening the app.
Any Ideas? I’ve looked across the forum and have to avoid anything with System Events, given how you need the SQLite command to register the app. As the scripts mat be delivered by means other than an installer, we can’t assume evaluated privileges
I have a launchAgent that is scheduled to run every 20 seconds
The script runs through a set of tests and calls an application (Created by me). Once called, the script ends
The application may already be open when it is called again, and it’s only then that it tends to be brought into focus
I can simulate this by creating a completely empty application and opening it from the command line. Terminal will still have focus, not the newly opened app.
However, the results are not predictable. Sometimes the app opens in front, and sometimes it doesn’t
I think you need another handler on application did finish launching. In there, you need tell me to activate or activate me. But, I was also thinking that you might want to do this in ASObjC and don’t know yet how to do that.