pub unsafe extern "C-unwind" fn AEDeterminePermissionToAutomateTarget(
target: *const AEAddressDesc,
the_ae_event_class: AEEventClass,
the_ae_event_id: AEEventID,
ask_user_if_needed: bool,
) -> i32AEDataModel and AppleEvents only.Expand description
Determines whether the current application is able to send an AppleEvent with the given eventClass and eventID to the application described as targetAddressDesc.
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 false and permission has not been granted, then errAEEventWouldRequireUserConsent will be returned.
The target AEAddressDesc must refer to an already running application.
Thread safe since version 10.14. Do not call this function on your main thread because it may take arbitrarily long to return if the user needs to be prompted for consent.
Parameter target: A pointer to an address descriptor. Before calling AEDeterminePermissionToAutomateTarget, you set the descriptor to identify
the target application for the Apple event. 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.
Parameter theAEEventClass: The event class of the Apple event to determine permission for.
Parameter theAEEventID: The event ID of the Apple event to determine permission for.
Parameter askUserIfNeeded: a Boolean; if true, and if this application does not yet have permission to send events to the target application, then
prompt the user to obtain permission. If false, do not prompt the user.
Returns: If the current application is permitted to send the given AppleEvent to the target, then noErr will be returned. If the current application is not permitted to send the event, errAEEventNotPermitted will be returned. If the target application is not running, then procNotFound will be returned. If askUserIfNeeded is false, and this application is not yet permitted to send AppleEvents to the target, then errAEEventWouldRequireUserConsent will be returned.
ยงSafety
target must be a valid pointer.