I was content with High Sierra, and against my better judgment, upgraded to Mojave.
Applescript worked fine before (I'm just transferring data to Apple's Numbers, nothing fancy): I could simulate a paste from clipboard, etc.
With Mojave, scripts invoked from Xojo apps just fail, even tho the same script runs fine from the Script Editor. I'll skip over all the other headaches I've tried to work around.
MBS seems to have a solution, as usual:
dim target as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithBundleIdentifier("com.apple.iWork.Numbers") dim e as integer = NSAppleScriptMBS.DeterminePermissionToAutomateTarget(target, "****", "****", true)
In a simple test app, all's good. The first time you get that annoying "MyApp wants control etc" dlog which did not happen under High Sierra. Fine. Security. I get it. You dismiss it once, then re-executing the above returns OK with no more pestering dlogs. The OS is convinced you're allowing control over Numbers.
When I paste the exact same code into my production app, all I get is an errAEEventNotPermitted error, no opportunity with a dlog to tell the OS that YES, I WANT THIS. It's as if the OS has cursed my one single app and refuses to even display the pestering dlog (yes, I pass true in NSAppleScriptMBS.DeterminePermissionToAutomateTarget).
I'm at wits end with Apple's latest (not even, I bet Catalina is even worse) OS releases. Any ideas on what the heck might be wrong?