Xojo - some pieces 4u
ready to use
Xojo Code Example: Using Applescript for Automation (macOS) 0.8.0
There used to be a time where any application just could execute AppleScripts to Automate other applications such as: '
tell application X to do Y'.
That's no longer the case starting with macOS 10.14. It's become a bit trickier to use with Xojo, since not everything is built in.
This example project shows:
- How to use AppleScript for Automation (by providing an
NSAppleEventsUsageDescription - otherwise nothing will work at all)
- How to determine if the application has permission for AppleEvents / Automation (
- Explains how to deal with the permission results
- In case you determine the application has no permission:
How to open System Preferences at Privacy - Automation (so that the user can allow the app)
How to use with your own Xojo-built .app?
1. drag the example
Info.plist into your project. Edit it and change the
NSAppleEventsUsageDescription to fit your app's purpose.
2. copy-paste the Module
modAppleScriptUtils into your project.
3. use the provided Methods it in a similar way to this example project.
back to overview