embeded applescript ignored under catalina

  1. ‹ Older
  2. 2 weeks ago

    Norman P

    Nov 29 Pre-Release Testers, Xojo Pro under a bus

    and you probably need an entry in the plist for NSAppleEventsUsageDescription

  3. Sam R

    Nov 29 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    @Norman P and you probably need an entry in the plist for NSAppleEventsUsageDescription

    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.

  4. last week

    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!"

  5. Beatrix W

    Dec 2 Pre-Release Testers, Third Party Store Europe (Germany)

    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.

  6. 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.

  7. 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??

  8. Beatrix W

    Dec 2 Pre-Release Testers, Third Party Store Europe (Germany)

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

  9. 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.

  10. Beatrix W

    Dec 2 Pre-Release Testers, Third Party Store Europe (Germany)

    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:

    -image-

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

  11. Michel B

    Dec 2 Pre-Release Testers, Xojo Pro

    @Graham B Have you tried running this through script editor on catalina? Maybe it will show some compile errors.

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

  12. Sam R

    Dec 2 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    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

  13. 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!

  14. Beatrix W

    Dec 3 Pre-Release Testers, Third Party Store Europe (Germany)

    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.

  15. Michel B

    Dec 3 Pre-Release Testers, Xojo Pro

    @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.

  16. 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.

  17. Emile S

    Dec 3 Europe (France, Strasbourg)

    Did you try:

    AppleScriptTest.xojo_binary_project

    from the Examples folder ?

  18. 5 days ago

    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.

  19. Emile S

    Dec 5 Europe (France, Strasbourg)

    >AppleScriptTest.xojo_binary_project

    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:

    https://www.felix-schwarz.org/blog/2018/08/new-apple-event-apis-in-macos-mojave

    Probably valid for Catalina too…

    HTH

  20. Michel B

    Dec 5 Pre-Release Testers, Xojo Pro

    @Andrew B well, of course AppleScriptTest.xojo_binary_project works, damnit. in fact everything works every step of the way except the share doesn't mount.

    There must be an error generated. Look a Console. Chances are it is there.

  21. 2 days ago

    Richard B

    Dec 8 Pre-Release Testers

    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.

    RB

or Sign Up to reply!