embeded applescript ignored under catalina

I have an application which has been working perfectly for years (on both pc & mac) but apples new 64bit only OS has broken it –
I’ve recompiled it (obviously!) under Catalina.
It needs to connect a network share, and it gets a username & password then builds the string mmount = “smb://username:password@computername/sharename” and passes it to the embedded applescript

on run {mmount}
tell application “Finder”
mount volume mmount
end tell
end run

which has always worked just fine, but when compiled under catalina it just sails through this doing nothing, resulting in no network mount.

which is totally useless. what’s changed?? what do i need to do different??? help appreciated!

1 Like

Have you tried running this through script editor on catalina? Maybe it will show some compile errors.
People have mentioned Catalina is more strict with it’s apple script syntax.

Also maybe you need more permissions, eg full disk access

and you probably need an entry in the plist for NSAppleEventsUsageDescription

1 Like

This.

It could probably be done with API or even a terminal command instead, which will remove the dependency on something that this Apple seems to loath so much.

damn, wrote a long reply and it vanished…
ok, yes, opned & complied the script in catalina before adding it back, so no joy there.
don’t know how i’d do the plist thing - this isn’t an app but an embeded script. also it can call external apps without problems (it has an option for the user to run the microsoft remote desktop app, which runs without issue).
but if you’ve thoughts on how i’d add NSAppleEventsUsageDescription into the plist file please let me know!

basically if i run an applescript on its own i’ll get the dialog requesting that it be allowed to access things, but the same script embeded in a xojo application will apparently just be ignored. and of course “it worked before”.

And it really has to be done by asking the apple shell - things like this done at the unix shell level just aren’t acknowledged by the graphical environment or consequently anything running in it.

so, “Argh!”

Have you tried to make a simple example? My app has dozens of AppleScripts - those are in code, though - and they work fine in Catalina.

well that’s hopeful anyway! at the moment it does feel like the difference is that the first time you run an applescript that does something like connecting a network drive it triggers a dialog box asking for permission, but called from within a xojo project that dialog isn’t triggered and the script simply fails. anyway, i’ll experiment.

ok, more information. the application is listed in “Security & Privacy” under “Full Disk Access” BUT is unticked, and I can neither tick it OR remove it, so maybe I’m getting somewhere, but the somewhere is that I’m stuck. what’s going on here??

Have you entered your password? Your app should automatically ask for the permission.

sorry, you lost me there. the program (I’m too old to keep calling things “apps”) remembers the username, asks for a password, gets the server/share from a config file and passes a string to the applescript that tells the finder to mount the share… except now it doesn’t. it doesn’t seem to do anything in fact, since it doesn’t even get a chance to show the “Just a moment…” sheet that displays while the share connects. errors from applescripts are supposed to show in the messages panel if thing is run from within xojo rather than from the compiled program, but nothing shows up.

a) In System Preferences you need to enter your password to make changes.

b) If you execute any AppleScript then you will see some wonderful dialog like this one here:

If you don’t get the dialog then the AppleScripts can’t be executed.

Andrew, what happens when you run the script outside of Xojo, under Catalina ?

Try using this from the Xojo Shell. It might not work under Catalina due to heightened “Security”, but it’s worth a shot IMHO.

https://apple.stackexchange.com/questions/697/how-can-i-mount-an-smb-share-from-the-command-line

well, this (and other applescripts) run perfectly if run outside of xojo, or as applescript apps on their own. doing things from the unix shell presents security issues as well as not informing the graphical environment properly that the share is there…
I’m going to begin at the beginning with a simple app that does nothing else but pass the string to the embedded script and see if i can figure it. I’m suspecting however that it might be as simple as waiting for a point release of xojo, as i said this is (or was) a straightforward thing that has always worked… worst case for now i can have the share mounted as part of the general log in process because everything else works fine. less flexible though and bloody annoying.
still, if anyone has an “AHa!” moment or knows of another way of telling the finder to do something other than calling an applescript…

it still seems to be that the applescript call is simply ignored - if the share failed to mount there would be an error the program would handle, but under catalina even this doesn’t happen, so the program just crashes!

Make us an example for testing. You must be doing something wrong.

One Xojo example is for AppleScript. As I’m here on Catalina I’ve run the example. I don’t know for which version of Xojo I got the examples because “Launch iTunes” isn’t really a good idea. But the scripts themselves work. I didn’t even get the beloved “do you really want to?” dialog.

I suppose you ran the program in the IDE, and looked at the message pane.

You may want to launch the console and have the program run your applescript. With some luck, the system receives an error message.

ok… i’ll take some of that back. I make a simple program with an embedded applescript that itself contains all the necessary info, ie

tell application “Finder”
mount volume “smb://username:password@10.0.0.xxx/sharename”
end tell

then lo & behold, the share mounts. It’s only if that information is passed to the applecript that it fails.

and that feels like a bug.

Did you try:

AppleScriptTest.xojo_binary_project

from the Examples folder ?

well, of course AppleScriptTest.xojo_binary_project works, damnit. in fact everything works every step of the way except the share doesn’t mount.
The variable is passed to the applescript, (and it will happily return it intact), but somehow the applescript ignores it, though if i assign the value to the variable within the applescript, that will work. This is perfectly valid code that has always worked before… Going to need some lateral thinking to come up with a different way of getting the required string in the applescript.
damn odd.

AppleScriptTest.xojo_binary_project

I love the Launch iTunes button. Probably very useless on Catalina !
(Look there too: Using AppleScripts in your app — Xojo documentation)
Sorry Andrew, a bit OT.

The docs entry for AppleScript talks about NSAppleEventsUsageDescription (and this was said earlier). Also from the doc, read Felix entry:

Probably valid for Catalina too…

HTH