Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2   9.3    Statistic  

Applescript.DeterminePermissionToAutomateTarget

Checks whether AppleScript is allowed.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Applescript 9.0 Yes No No No No
MBS( "Applescript.DeterminePermissionToAutomateTarget"; BundleID; AEEventClass; AEEventID { ; askUserIfNeeded } )   More

Parameters

Parameter Description Example value
BundleID The bundle ID of the application to control.

The target address descriptor must refer to a running application. If the target application is on another machine, then Remote AppleEvents must be enabled on that machine for the user.
"com.apple.Safari"
AEEventClass The event class of the Apple event to determine permission for.
**** for wildcard to use all.
"****"
AEEventID The event ID of the Apple event to determine permission for.
**** for wildcard to use all.
"****"
askUserIfNeeded Optional
Wether dialog can show to ask user if needed.
Pass 1 to allow dialog or 0 to disallow.

If 1, and if this application does not yet have permission to send events to the target application, then prompt the user to obtain permission. If 0, do not prompt the user.
Default is 0.
1

Result

Returns OK, ApplicationNotRunning, NotPermitted, WouldRequireUserConsent, or error.

Description

Checks whether AppleScript is allowed.
Determines whether the current application is able to send an AppleEvent with the given eventClass and eventID to the application described as target via bundle ID.

Mac OS 10.14 and later impose additional requirements on applications when they send AppleEvents to other applications in order to insure that users are aware of and consent to allowing such control or information exchange. Generally this involves the user being prompted in a secure fashion the first time an application attempts to send an AppleEvent to another application. If the user consents then this application can send events to the target. If the user does not consent then any future attempts to send AppleEvents will result in a failure with errAEEventNotPermitted being returned.

Certain AppleEvents are allowed to be sent without prompting the user. Pass typeWildCard (****) for the eventClass and eventID to determine if every event is allowed to be sent from this application to the target.

Applications can determine, without sending an AppleEvent to a target application, whether they are allowed to send AppleEvents to the target with this function. If askUserIfNeeded is true, and this application does not yet have permission to send AppleEvents to the target, then the user will be asked if permission can be granted; if askUserIfNeeded is 0 and permission has not been granted, then WouldRequireUserConsent will be returned.

The target bundle ID must refer to an already running application.

If the current application is permitted to send the given AppleEvent to the target, then OK will be returned. If the
current application is not permitted to send the event, NotPermitted will be returned. If the target application
is not running, then ApplicationNotRunning will be returned. If askUserIfNeeded is false, and this application is not yet permitted
to send AppleEvents to the target, then WouldRequireUserConsent will be returned.

Requires MacOS 10.14 or newer.

Examples

Ask for permissions for Safari:

MBS( "Applescript.DeterminePermissionToAutomateTarget"; "com.apple.Safari"; "****"; "****"; 1 )

Ask for permissions for Finder:

MBS( "Applescript.DeterminePermissionToAutomateTarget"; "com.apple.Finder"; "****"; "****"; 1 )

Ask for permissions for Mail:

MBS( "Applescript.DeterminePermissionToAutomateTarget"; "com.apple.Mail"; "****"; "****"; 1 )

Blog Entries

Created 13th December 2018, last changed 13th December 2018


AppleScript.SetPropertyValue   -   Archive.Compress

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins