Platforms to show: All Mac Windows Linux Cross-Platform

NSAppleEventManagerMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Apple Script MBS MacCocoa Plugin 12.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The class for the Apple Event Manager.
Example
// handle "Get URL" Apple events, e.g. for your own URL scheme myapp://
// The URL scheme must be registered in the CFBundleURLTypes of the Info.plist.
// MyURLHandler is a subclass of NSAppleEventHandlerMBS with the handleAppleEvent event implemented.
// URLHandler is a property of the app: URLHandler As MyURLHandler
URLHandler = New MyURLHandler
Var manager As New NSAppleEventManagerMBS
manager.setEventHandler(URLHandler, "GURL", "GURL")

// in MyURLHandler:
Sub handleAppleEvent(theEvent As NSAppleEventDescriptorMBS, replyEvent As NSAppleEventDescriptorMBS) Handles handleAppleEvent
Var url As String = theEvent.paramDescriptorForKeyword("----").stringValue // direct object
System.DebugLog "Opened with URL " + url
End Sub

Provides a mechanism for registering handler routines for specific types of Apple events and dispatching events to those handlers.

Cocoa provides built-in scriptability support that uses scriptability information supplied by an application to automatically convert Apple events into script command objects that perform the desired operation. However, some applications may want to perform more basic Apple event handling, in which an application registers handlers for the Apple events it can process, then calls on the Apple Event Manager to dispatch received Apple events to the appropriate handler. NSAppleEventManager supports these mechanisms by providing methods to register and remove handlers and to dispatch Apple events to the appropriate handler, if one exists. For related information, see How Cocoa Applications Handle Apple Events (on Apple Developer Website).

For information about the Apple Event Manager, see Apple Event Manager Reference and Apple Events Programming Guide (on Apple Developer Website).

This class has no subclasses.

Blog Entries

Some examples using this class:

Some related classes:


The items on this page are in the following plugins: MBS MacCocoa Plugin.


NSAppleEventHandlerMBS   -   NSAppleEventManagerSuspensionIDMBS


The biggest plugin in space...