Applescript in Xojo 2018 r4

  1. 5 weeks ago
    Edited 5 weeks ago

    As an amateur programmer, I use Xojo for personal projects. Not being conversant in the inner workings of Mac OS, I recently noted that Applescript routines would not run under MacOS 10.14.2 and changes needed to be made to my programs. Norman Palardy answered my "Feedback Issue" but not being a programming expert, I had a very difficult time solving the problem and understanding what was required. I didn't know what an "info.plist" was, let alone be able to find it or modify it.

    Xojo documentation has been updated to note the required changes, however lacking a real understanding of Mac OS, it looked hopeless for me to ever solve the issue.

    After extensive trial and error, I was able to restore the Applescript routines so they would run during program execution. Of course, you now get an Apple OS dialog box asking for permission, but that's OK with me.

    I made a little text file and stored it on the computer, named "ascript.plist". Text below:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
    <plist version="0.9">
    <dict>
    <key>NSAppleEventsUsageDescription</key>
    <string>Click OK to run Applescript</string>

    </dict>
    </plist>

    I dragged the file into my Xojo source code. After compilation the two Bold lines (key and string) appeared in the info.plist file, just as intended. These are the key commands, apparently, to permit a Xojo program to allow Applescript to modify other files/folders on the computer.

    To see the info.plist (which I was finally able to find), do the following:

    control-click on the Compiled Program
    Select "Show Package Contents"
    Double Click on "Contents"
    Double Click on "info.plist"

    There, you will see the added code, and the program should call the Applescript routines as intended, with a dialog box asking for permission.

    One caveat: the Apple program TextEdit will save the file with an extension of [.rtf] which will not work with Xojo. Make sure you change the extension to [.plist].

    Sorry to bore those who have extensive technical expertise - I only want to help others who were similarly baffled like me.

or Sign Up to reply!