Monday, December 21, 2020


Tags

macOS-Big-Sur-icon

Using AppleScript in your apps with App Wrapper 4

To run AppleScript from a macOS requires certain App Wrapper settings in Big Sur and Catalina

Monday, December 21, 2020 - Sam Rowlands

This is an update of the document AppleScript, Catalina & Xojo made Mac Apps to address App Wrapper 4 and macOS Big Sur.

If you're intending to ship an application on the Mac App Store, I would strongly advise you consider alternative technologies to accomplish the task, as the App Sandbox and App Store Rules make this even harder, and in some cases is simply not allowed by  App Store Review Team.

Lets get started

  1. Open the application in App Wrapper 4.
  2. In the sidebar
    • Select the code signing identity to use for this app.
    • Select "Hardened" to enable the "Hardended Runtime" option.
    • Select "Uses Entitlements", as we'll need those in the next step.
  3. Click on "Capabilties" to view the options available.
  4. Scroll down the list of options until "AppleScript" is visible.
  5. Select "Use AppleScript to control other applications.
  6. Enter in a "Privacy" message indicating why this application needs to use AppleScript1.
  7. Click on the "+" button and choose "Select Application...", then choose the application this app is to control. This must be done for all apps that need to be controlled.
  8. Wrap and Run

Simply debugging

Read the articles on Xojo Scripting & App Wrapper 4 to integrate App Wrapper 4 into your Xojo debugging cycle, making it easier and saving time.

In the screenshot, I used "Allows $(bundleName) to control Apple Music". App Wrapper will replace "$(bundleName)" at wrapping time with the name of the app.