0

I'm using AppleScript (inside of a macOS app) to get the currently active tab name in a browser. The code is following:

"tell application \"Google Chrome\" to return title of active tab of front window"

Until recently, everything was working fine. However, when I switched to the new version of Catalina, I started getting the following errors:

skipped scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" because it is not SIP-protected.

{
    NSAppleScriptErrorAppName = "Google Chrome";
    NSAppleScriptErrorBriefMessage = "Not authorized to send Apple events to Google Chrome.";
    NSAppleScriptErrorMessage = "Not authorized to send Apple events to Google Chrome.";
    NSAppleScriptErrorNumber = "-1743";
    NSAppleScriptErrorRange = "NSRange: {43, 3}";
}


I've tried adding NSAppleEventsUsageDescription and setting its value, but that produced no changes.

Any suggestions?

Dragos Strugar
  • 1,314
  • 3
  • 12
  • 30
  • Are you calling this AppleScript from within an application, or are you running this as a stand-alone script (from the Script Editor, or an AppleScript app)? – Ted Wrigley Feb 12 '20 at 14:33
  • In the application @TedWrigley – Dragos Strugar Feb 12 '20 at 14:52
  • You're running into a Sandbox issue. In order for a sandboxed application to use applescripts you have to give it proper entitlements, setting the `NSAppleEventsUsageDescription` entitlement and either the `com.apple.security.temporary-exception.apple-events` entitlement or the `com.apple.security.scripting-targets` entitlement. This blog post gives a decent explanation: https://www.jessesquires.com/blog/executing-applescript-in-mac-app-on-macos-mojave/ – Ted Wrigley Feb 12 '20 at 16:30
  • @TedWrigley I did both. Nothing helped. – Dragos Strugar Feb 13 '20 at 07:12
  • This was the answer https://stackoverflow.com/questions/19674514/how-to-create-entitlement-plist-file-in-xcode-5 – Dragos Strugar Feb 13 '20 at 11:35
  • @DragosStrugar Do you solved your problem? I am running into the same situation with Chrome in my sandboxed app. – francisfeng May 30 '21 at 16:12

0 Answers0