Xojo - some pieces 4u
Xojo Code Example: Using Applescript for Automation (macOS) 0.8.0
- Read the Description
-
Download and try it yourself
-
Do you like it? Does it help you? Has it saved you time and money?
You're welcome - it's free... If you want to say thanks I appreciate a message or a small donation.
contact
Description:
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
Info.plist
with NSAppleEventsUsageDescription
- otherwise nothing will work at all) - How to determine if the application has permission for AppleEvents / Automation (
AEDeterminePermissionToAutomateTarget
) - 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
contact: Juerg Otter