Copy link to clipboard
Copied
Not sure if this is the correct place to post this, but the uservoice forums seems kind of silent.
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.
Use case:
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
2. 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.
Cross post: https://indesign.uservoice.com/forums/913162-adobe-indesign-sdk-scripting-bugs-and-features/filters/...
Copy link to clipboard
Copied
Hi,
Once activeted from 16.2, it will support all those permissins for future request after installed the 16.3.2?
Example here (sample screenshot for 2020)
Thanks,
Selva
Copy link to clipboard
Copied
Yes, it should.
Copy link to clipboard
Copied
In that case the user is the one executing the script. So this will work:
tell application id "com.adobe.InDesign"
tell application "Finder" to display dialog "Hello"
end tell
But this won't:
tell application id "com.adobe.InDesign"
do script "tell application \"Finder\" to display dialog \"Hello\""
end tell
Because then it's still InDesign executing the inner part and InDesign needing permission to communicate with Finder.
Copy link to clipboard
Copied
Why doesn’t the OS request permission or stop the script when running the scripts from CC2020’s panel? Seems like it should be fixable by Adobe, no?
Copy link to clipboard
Copied
We have recorded this issue and waiting for the next release.
Copy link to clipboard
Copied
Looks like this is 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.