Applescript: more broken with each OS release

But why do the AppleScripts work with the permission asking work in my app but not in my example?

I don’t know. I’m trying to understand what’s going on here, at the moment I am thinking that this test for permission is capable of producing false negatives (so might NSAppleScript).

It appears that there is 5 things you may want to check.

  1. Blackbird is selected on the general pane of App Wrapper, in the last week or so, I’ve had a couple of developers who’re having trouble with Notarization when using the older Apple engine, which goes away when using the Blackbird code signing engine.
  2. Harden Runtime setting on the general pane.
  3. On the Capabilites pane, enable “Send Apple Events to other applications”.
  4. If you’re not using App Sandbox, select “Entitlements Only” at the top of the Capabilities pane.
  5. In the “Privacy” pane, enter some message next to “Apple Script”.

it will soon be harder to make apple accept the app than making the entire app itself !

I’d hit the “Like” button too, but it is really hard to like the above statement no matter how accurate it is. :frowning:

Yes. Just tried this. All entries under Automation disappeared as expected, I even restarted, same error. I even explicitly added my app to Accessibility, same error. The only thing that works is the osascript mechanism, and then, painfully slowly, barely usable.

Ergh…

Seems like the last thing you can try (before setting fire to the Mac) is to disable SIP, then delete the file ~/Library/Application\ Support/com.apple.TCC

While I haven’t tried deleting this database, I was able to open with SQLiteManager and the data seems pretty straight forward.

To check whether the problem is related to an ill-stored “denied” permission, simply change your app’s bundle ID temporarily and run it again. If you can then get it working again as it worked in HS, then you at least know wheat you have to look for - it’s not a problem with your app but with Mojave. And if tccutil doesn’t help, try deleting all apps with the “bad” bundle ID (find with my tool: http://files.tempel.org/Various/LaunchServices.zip). Maybe that’ll reset the prefs. Also see https://apple.stackexchange.com/a/360610/17533, though you’be done that already, I think.

Great idea Thomas. Tried this and still get the same error.

I even did it in a brand new app with just:

dim sf as FolderItem = FolderItem.ShowOpenFileDialog("") dim error as Dictionary dim n as new NSAppleScriptMBS(sf, error) dim p as NSAppleEventDescriptorMBS = n.execute(Error)

where sf is a txt file just containing:

tell application "Numbers" activate close every document without saving end tell

and that fails too. This is beyond ridiculous.

Here’s another thing to try: Ask in the https://macscripter.net forum - there are some knowledgeable people there, including the Script Debugger masters Mark Aldritt and Shane Shanley. Also, buy SD if you haven’t already. It’s the most magical programming IDE! :slight_smile:

Thx all for your helpful suggestions. I decided to wipe my Mojave partition and return to High Sierra. I’ve wasted enough time with this, see frequent system hangs (for seconds or >10sec where only the mouse cursor moves, nothing else, and this AM the whole system froze requiring a power cycle), together with the absurd security lockdowns, that Mojave is just not a useful OS for my needs (which are not exotic). This never happened with HS.
Can’t imagine Catalina from what people say.
I think we all know how we feel about Apple’s OS QC so I won’t flog that horse.

They have made installing things on OSX look a lot like windows Vista… “Something wants to do something, we don’t know what, would you like to allow it? please click yes 900 times…” But once you get the hang of it it’s not that bad to get it working.

The automation stuff is a freaking nightmare and they break AppleScript a little further with each OS update. I have had to make several HUGE changes to my scriptable apps over the years as they broke things, or changed things in really sweeping ways without any note to it in the release notes at all. I am slowly in the background abstracting all my scripting hooks to use both Einhurgers python plugin and the MBS new javascript plugins. Apple-script will slowly disappear from what I develop because Apple doesn’t seem to use it themselves or even bother to test it inside of their new eco system. But enough of the complaining :wink:

The main problem I’ve had is that with Mojave and even earlier ones too if you updated the app, or just compiled a new one and moved it over to the other machine, even though the permissions said that you had already allowed this app to control that other app it would not work until you had unchecked and re-checked the permissions. This is now standard procedure for all my users running those OS versions. When you update the app, if any of your scripts want to target an app other than this one you have to go in to security and preferences and uncheck the app’s permission. Then check it again. The act of updating the app breaks the security priv, but does not generate an error or update the UI or cause it to alert you again. You just have to go and turn it off and back on again and then it works. At least most of the time…

Believe me James, I’ve tried everything, including Sam’s tip on how to nuke all privacy permissions, etc. Mojave is just fundamentally unusable, at least on my installation. And then the system-wide seconds-long pauses, hangs, app launches taking 10-20 seconds at random times, when AS works it’s dog slow (Sam: I love dogs BTW), the list goes on.
I can work around this with my own apps, but what happens when you just want to send a data table to Numbers? You’re stuck with what Apple prescribed, and at this point, it’s very bad medicine.

You’re describing many different problems unfortunately. My main app is basically an applescript scripting platform that has been running on MacOS since the late 90’s :wink: They hired me to port it to OSX in 2001 or so and I”ve been working with them in Xojo on it ever since then. I have suffered through so many horrible things they have done to applescript I hesitate to begin to list as all our heads will just explode again :wink:

My main machine is still running Mojave as Catalina molests farm animals without their consent, but I’ll be moving more than just my test machines before long now. It won’t fix the problems you’re having though.

Super long app launch times are almost certainly because of “translocation” You need to not run the app from the folder it was unzipped into. Or just move it somewhere and then back in the Finder. That turns that off.

That, hands down James, is perhaps the funniest description of an arrogantly-designed, ill-conceived OS, hellbent on blatantly ignoring its users needs and wishes that I’ve ever seen. I’ve seen lots of searing criticism of Catalina on these (and other) forums but never, and I do mean never, have I ever seen it put so succinctly and accurately where the mental imagery created not just makes the point, but will last a lifetime. There must be an award somewhere for something like that! I know it made me laugh out loud … which is pretty tough since I’m sitting here all alone in my office.

FWIW Apple has sold more iPads and iPhones that are locked down like this than all the Macs ever sold
Folks who are not devs dont mostly care about all this - just that it works. Whether its an iPad, iPhone or Mac doesnt matter.
The hassles we have to go through to make that happen isnt their concern
But it should concern Apple

FWIW, there is a note on the docs page for NSAppleEventsUsageDescription which says:

[quote]Important
This key is required if your app uses APIs that send Apple events.[/quote]

Thx Greg, yes I did see this, and included these and still no luck. The only thing that finally worked was erasing my Mojave partition and rolling back to High Sierra.