InDesign 16.3.2 not authorised to send Apple events to other apps
I’m using the InDesign do script
AppleScript command to instruct another application to do something.
Since 16.3 this doesn’t work anymore, because macOS prevents the script from running. Previous versions of InDesign worked fine, after the user allowed InDesign to control the target app.
Usecase:
I’m the developer of a font manager and want InDesign to report which fonts are used in a document
macOS version: 11.3.1
InDesign version: 16.3.2
Steps to reproduce:
Reset the macOS Apple Event permissions for InDesign in Terminal:
tccutil reset AppleEvents com.adobe.InDesign
Run the following AppleScript:
tell application id "com.adobe.InDesign"
do script "tell application \"Finder\" to display dialog \"Hello\""
end tell
Expected:
1. macOS asks to allow InDesign to control Finder
2. After confirming, Finder shows an alert
Actual:
AppleScript error: Not authorized to send Apple events to Finder. (-1743)
Background info:
InDesign versions before 16.3 worked fine. I’ve been using do script
to communicate with my app without issues. When running the script the first time macOS will ask the user to allow InDesign to control my app. After confirming or dismissing this dialog a new entry in System Preferences > Security & Privacy > Automation will show up for Adobe InDesign 2021.app
If the Automation entry is checked communication is authorised and the script works fine. If the user did not allow control, the entry is unchecked and can be enabled at any moment by the user in System Preferences > Security & Privacy > Automation.
Since InDesign 16.3 the macOS permission dialog doesn’t show up anymore. The user is not asked to give permissions and the entry will never show up in Automation. This results in all scripts failing due to no authorisation to communicate with external apps.
If the user had previously allowed control (e.g. using InDesign 16.2), the Automation permission is persistent and works for 16.3 as well. But if it’s a first-time user, or if the Automation permission is reset, InDesign 16.3 will never trigger the dialog anymore.
To reset macOS Apple Event permissions run the following command in Terminal:
tccutil reset AppleEvents com.adobe.InDesign
Solution:
Looks like adding NSAppleEventsUsageDescription
to the InDesign Info.plist solves the issue. Once this key is added the macOS permission dialog will show up correctly again.
I’ve successfully confirmed this by adding this key to the plist:
plutil -insert NSAppleEventsUsageDescription -string "This script needs to control other applications to run." /Applications/Adobe\ InDesign\ 2021.app/Info.plist
And resigning the .app using a custom signing certificate (changing the Info.plist will break the original signing).
According to https://indiestack.com/2018/08/apple-events-usage-description/ this key is required when linking against the macOS 10.14 SDK. Perhaps that’s what has changed in 16.3?
If you need any further information to reproduce this issue, or information about the solution please let me know.
-
Floor commented
Looks like this has been fixed in InDesign 16.4
It includes an empty NSAppleEventsUsageDescription key in its info.plist, therefore the permission dialog to communicate with other apps does show up again.
-
Floor commented
See also the discussion here: