and you probably need an entry in the plist for NSAppleEventsUsageDescription
@Norman P and you probably need an entry in the plist for NSAppleEventsUsageDescription
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.
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.
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.
Try using this from the Xojo Shell. It might not work under Catalina due to heightened "Security", but it's worth a shot IMHO.
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 !@#$% 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.
@Andrew B 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!
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:email@example.com/sharename"
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.
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.
I love the Launch iTunes button. Probably very useless on Catalina !
(Look there too: http://docs.xojo.com/UserGuide:AppleScripts )
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…
After hours of messing around trying to get a simple apple script to work from my App (it always worked from script editor)
I eventually did the following and succeeded...
1 Wrote script in Script Editor
2 Tested script
3 compiled and saved script
4 QUIT SCRIPT EDITOR (or at least close the script..... this is the bit that had me going around in circles for hours!)
5 Drag script into xojo
6 Edit plist as suggested and drag into xojo
7 reset apple events from terminal using (not needed really)
8 run in debug and test
I still had the script open in script editor and was getting all sorts of 'violations' and fails in Console.