Skip to main content
Known Participant
August 12, 2021
Question

InDesign 16.3.2 not authorised to send Apple events to other apps

  • August 12, 2021
  • 7 replies
  • 6896 views

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:

  1. 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/new

This topic has been closed for replies.

7 replies

floorishAuthor
Known Participant
September 1, 2021

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.

Legend
August 26, 2021

Untested idea: If the starting point is an AppleScript, try to launch it via that script icon menu in the menubar that you enable from AppleScript editor preferences … your script might go thru different security / authorization mechanisms, especially if you don't use nested tell clauses.

selvam214
Inspiring
August 27, 2021

Hi All,

I changed the .plist as suggested with this link, the 'InDesign 2020' application is not opening after that. Maybe the application is corrupted. I think isn't the right method. Please share your thought.

 

OS: 10.14.6

Note: I have done CC logout and login too. 

 

Thanks,

Selva

floorishAuthor
Known Participant
August 27, 2021

When you change the plist the signature of the app will be different, which means macOS won't launch the app because it has been tampered with. Changing the plist is not a solution for end-users, Adobe needs to add the key and distribute it in an update (that is signed by Adobe).

 

If you want to change it manually you will need to resign the app using a custom made signing certificate. You can create a custom certificate in Keychain and use that to sign the app with `codesign`. Pretty technical, so I don't recommend doing that if you're not familiar with these tools. I'm not sure if the signature will be valid again if you remove the key, so your best bet is to just reinstall InDesign.

 

If you need InDesign to work for a specific app follow these instructions:

1. uninstall the 16.3.2 version with changed plist

2. install older 16.2

3. run your script that communicates with an external app (for each app you'll need to communicate with)

4. give permission when macOS asks for it

5. install 16.3.2

 

The permission given in step 4 is persistent, so it keeps working in 16.3.2. 

rob day
Community Expert
Community Expert
August 18, 2021

Hi @floorish,

I’m starting to run into similar problems with existing AppleScripts that need to communicate with the finder even when the do script command is not used.

 

So this simple call to the finder works running from Script Editor and always has from the ID Scripts panel as well, but now the panel version is breaking

 

tell application id "com.adobe.InDesign"
	tell application "Finder"
		activate
		display dialog "Hello"
	end tell
end tell

 

It seems to be limited to the Finder and other Apple apps, because this works from the panel:

 

tell application id "com.adobe.InDesign"
	tell application id "com.adobe.Photoshop"
		activate
		display dialog "Hello"
	end tell
end tell

 

If you are not using do script it looks like a clumsy work around is to save the panel script as an applet—in that case I at least get a permission dialog.

 

Maybe this is an InDesign bug, but it seems like this will put an end to AppleScript’s remaining advantage (communicating with non Adobe apps), and breaks a fair number of my existing applescripts. If anyone can come up with a solution it would be appreciated.

 

rob day
Community Expert
Community Expert
August 18, 2021
rob day
Community Expert
Community Expert
August 13, 2021

I took the time to check this on the latest CC2020 version running Mojave and got the error. If I remove the Finder tell the dialog displays, so this works:

 

tell application id "com.adobe.InDesign"
	do script "display dialog \"Hello\""
end tell

 

It seems like access to the Finder application is the problem, and not the do script command

Inspiring
August 13, 2021

Confirming that this works in Catalina 10.15.7 too.

Inspiring
August 13, 2021

Just FYI, I get this same error on Catalina 10.15.7 with InDesign 2021. I run all kinds of InDesign/Finder scripts all the time with no problem, but I never use Do Script. When I use: 

 

tell application id "com.adobe.InDesign"

tell application "Finder" to display dialog "Hello"

end tell

 

it works as expected.

floorishAuthor
Known Participant
August 14, 2021

These macOS automation permissions are here since Mojave, so I indeed expect the same errors on macOS Mojave 10.14 and Catalina 10.15.

 

Your example works because it’s the user that calls the script, not InDesign. It’s not a replacement of the ‘do script’ example I’ve posted above.

In your case there is no app to app communication, so naturally that is allowed.

rob day
Community Expert
Community Expert
August 12, 2021

I’m not running Big Sur so i can’t test, but do you need the do script command? Does simply telling the finder to show the dialog work?

 

tell application id "com.adobe.InDesign"
	tell application "Finder"
		activate
		display dialog "Hello"
	end tell
end tell
floorishAuthor
Known Participant
August 12, 2021

Thanks Rob,

 

The do script command is an example which conveniently shows the issue. My script is actually called from an event listener which in turn tells Finder directly to show the dialog. But the effect is the same, i.e. InDesign launches an AppleScript which tells another application to do something.

 

Since InDesign is the caller of the script (either with do script or after event trigger), it must have user permission to tell the external app to do something.  This permission is never asked in 16.3.2

 

After adding NSAppleEventsUsageDescription to the plist, both do script and when called from an event handler work correctly and ask for permission.

 

Example

Adding the event listener:

 

tell application id "com.adobe.InDesign"
    set scriptPath to "/path/to/other.scpt"
    make event listener with properties {event type:"afterOpen", handler: scriptPath}
end tell

 

 

which calls /path/to/other.scpt:

 

on run (argv)
    tell application "Finder"
    	activate
    	display dialog "Hello"
    end tell
end run

 

 

selvam214
Inspiring
August 12, 2021

Hi Floorish,

Nice to see this post, we were in the same predicament. Our luck, has got the answer from here.


Thanks,
Selva