Preflighting app authorization

Continuing the discussion from AppleScript Release Notes:

How does one do this? This fails.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set appPath to path to application "Finder" as text
AEDeterminePermissionToAutomateTarget(appPath)

@Shane_Stanley will correct me if I’m wrong, but functions like this which are not Objective-C methods cannot be called from AppleScript.

You could wrap a tell block in an try-on error block and watch for error -1743 to know when you don’t have permission to interact with an application.

1 Like

Yeah, you can’t use this from ASObjC. You can actually call the function – you just can’t provide the correct arguments.