Allow remote Apple events on Mac
Your Mac can accept Apple events from apps running on other computers. An Apple event is a task being performed on a Mac, such as “open this document” or “print”.
With remote Apple events turned on, an AppleScript program running on another Mac can interact with your Mac. For example, the program could open and print a document that’s located on your Mac.
On your Mac, choose Apple menu > System Preferences, then click Sharing.
Select the Remote Apple Events tickbox.
Specify who can send events:
All users: Any of your computer’s users and anyone on your network can send events.
Only these users: Click the Add button , then choose who can send events. Users & Groups includes all the users of your computer. Network Users and Network Groups include people on your network.