// Set s_bSkipExitConfirmation to true if cancelled because of logging out or shutting down OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon ) { DescType senderType; Size actualSize; ProcessSerialNumber SenderPSN; ProcessInfoRec pInfo; FSSpec fileSpec; OSStatus anErr; // Refuse to quit if a modal dialog is open. // Unfortunately, I know of no way to disable the Quit item in our Dock menu if (wxGetApp().IsModalDialogDisplayed()) { SysBeep(4); return userCanceledErr; } anErr = AEGetAttributePtr(appleEvt, keyAddressAttr, typeProcessSerialNumber, &senderType, &SenderPSN, sizeof(SenderPSN), &actualSize); if (anErr == noErr) { pInfo.processInfoLength = sizeof( ProcessInfoRec ); pInfo.processName = NULL; pInfo.processAppSpec = &fileSpec; anErr = GetProcessInformation(&SenderPSN, &pInfo); // Consider a Quit command from our Dock menu as coming from this application if ( (pInfo.processSignature != 'dock') && (pInfo.processSignature != 'BNC!') ) { s_bSkipExitConfirmation = true; // Not from our app, our dock icon or our taskbar icon wxGetApp().ExitMainLoop(); // Prevents wxMac from issuing events to closed frames } } return wxGetApp().MacHandleAEQuit((AppleEvent*)appleEvt, reply); }
static pascal OSErr appleEventHandler( const AppleEvent* e, AppleEvent*, long ) { OSType id = typeWildCard; AEGetAttributePtr( e, keyEventIDAttr, typeType, 0, &id, sizeof(id), 0 ); switch (id) { case kAEQuitApplication: gcon->quit(); return noErr; case kAEReopenApplication: { gcon->show(); gcon->raise(); return noErr; } case 'GURL': { DescType type; Size size; char buf[1024]; AEGetParamPtr( e, keyDirectObject, typeChar, &type, &buf, 1023, &size ); buf[size] = '\0'; static_cast<App&>(*qApp).open( QString::fromUtf8( buf ) ); return noErr; } default: return unimpErr; } }
static pascal OSErr appleEventHandler( const AppleEvent* e, AppleEvent*, long ) { OSType id = typeWildCard; AEGetAttributePtr( e, keyEventIDAttr, typeType, 0, &id, sizeof( id ), 0 ); switch ( id ) { case 'GURL': { DescType type; Size size; char buf[1024]; AEGetParamPtr( e, keyDirectObject, typeChar, &type, &buf, 1023, &size ); buf[size] = '\0'; QString url = QString::fromUtf8( buf ); static_cast<TomahawkApp*>(qApp)->loadUrl( url ); return noErr; } default: return unimpErr; } }
// -------------------------------------------------------------------------------------- static pascal OSErr viewsFontChangedAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, long refcon) { #pragma unused (reply, refcon) OSErr error; DescType returnedType; Size actualSize; error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); if (error == noErr) error = errAEParamMissed; else if (error == errAEDescNotFound) { WindowRef window; for (window = GetFrontWindowOfClass(kDocumentWindowClass, false); window != NULL; window = GetNextWindowOfClass(window, kDocumentWindowClass, false)) { if (GetWindowKind(window) == kDialogWindowKind) RedrawPrefsDialogDataBrowser(GetDialogFromWindow(window)); else // kApplicationWindowKind RedrawPrefsWindowDataBrowser(window); } error = noErr; } return error; }
OSErr PASCAL _AfxOleAutoHandler(AppleEvent* pae, AppleEvent*, long lRefcon) { CWinApp* pApp; OSErr err; DescType dtT; Size lT; err = AEGetAttributePtr(pae, keyMissedKeywordAttr, typeWildCard, &dtT, NULL, 0, &lT); if (err == errAEDescNotFound) { pApp = (CWinApp*) lRefcon; ASSERT_VALID(pApp); ASSERT_KINDOF(CWinApp, pApp); if(COleObjectFactory::RegisterAll()) { return noErr; } else { return errAEEventNotHandled; } } else if (err == noErr) return errAEEventNotHandled; else return err; }
static OSStatus appleEventProcessor(const AppleEvent* ae, AppleEvent* event, long handlerRefCon) { OSType aeClass = typeWildCard; OSType aeID = typeWildCard; AEGetAttributePtr(ae, keyEventClassAttr, typeType, 0, &aeClass, sizeof(aeClass), 0); AEGetAttributePtr(ae, keyEventIDAttr, typeType, 0, &aeID, sizeof(aeID), 0); if ((aeClass == kCoreEventClass) && (aeID == kAEReopenApplication) && (qxApp)) { if (qxApp->mainWindow()) { qxApp->mainWindow()->reopen(); return noErr; } } return eventNotHandledErr; }
pascal OSErr handle_core_ae( const AppleEvent* event, AppleEvent* reply, long refcon) { DescType eventid, gottype; Size got; reply = (AppleEvent*)0; /* suppress unused warning */ refcon = 0; /* suppress unused warning */ if( noErr == AEGetAttributePtr(event, keyEventIDAttr, typeType, &gottype, (Ptr)&eventid, sizeof(eventid), &got) && errAEDescNotFound == AEGetAttributePtr(event, keyMissedKeywordAttr, typeWildCard, &gottype, nil, 0, &got) ){ switch(eventid){ case kAEQuitApplication: MLDone = MLAbort = 1; case kAEOpenApplication: return noErr; } } return errAEEventNotHandled; }
static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, long handlerRefCon) { Q_UNUSED(event); OSType aeID = typeWildCard; OSType aeClass = typeWildCard; AEGetAttributePtr(ae, keyEventClassAttr, typeType, 0, &aeClass, sizeof(aeClass), 0); AEGetAttributePtr(ae, keyEventIDAttr, typeType, 0, &aeID, sizeof(aeID), 0); if (aeClass == kCoreEventClass && aeID == kAEReopenApplication) { // User clicked on Uniboard in the Dock ((UBApplicationController*)handlerRefCon)->hideDesktop(); return noErr; } return eventNotHandledErr; }
OSStatus appleEventProcessor(const AppleEvent *ae, AppleEvent *, long /*handlerRefCon*/) { OSType aeID = typeWildCard; OSType aeClass = typeWildCard; AEGetAttributePtr(ae, keyEventClassAttr, typeType, 0, &aeClass, sizeof(aeClass), 0); AEGetAttributePtr(ae, keyEventIDAttr, typeType, 0, &aeID, sizeof(aeID), 0); if(aeClass == kCoreEventClass) { if(aeID == kAEReopenApplication) { #if 0 if( PlaylistWindow::self() ) PlaylistWindow::self()->show(); #endif } return noErr; } return eventNotHandledErr; }
static PyObject *AE_AECreateAppleEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; AEEventClass theAEEventClass; AEEventID theAEEventID; AEAddressDesc target; AEReturnID returnID; AETransactionID transactionID; AppleEvent result; if (!PyArg_ParseTuple(_args, "O&O&O&hi", AE_GetOSType, &theAEEventClass, AE_GetOSType, &theAEEventID, AE_AEDesc_Convert, &target, &returnID, &transactionID)) return NULL; _err = AECreateAppleEvent(theAEEventClass, theAEEventID, &target, returnID, transactionID, &result); if (_err != noErr) return AE_MacOSError(_err); // workaround for return ID bug in 10.6 DescType typeCode; Size actualSize; SInt32 actualReturnID; if (returnID == kAutoGenerateReturnID) { _err = AEGetAttributePtr(&result, keyReturnIDAttr, typeSInt32, &typeCode, &actualReturnID, sizeof(actualReturnID), &actualSize); if (_err != noErr) return AE_MacOSError(_err); if (actualReturnID == -1) { AEDisposeDesc(&result); _err = AECreateAppleEvent(theAEEventClass, theAEEventID, &target, returnID, transactionID, &result); if (_err != noErr) return AE_MacOSError(_err); } } _res = Py_BuildValue("O&", AE_AEDesc_New, &result); return _res; }
pascal OSErr mac_aevt_pdoc(const AppleEvent *req, AppleEvent *reply, long refcon) { DescType type; Size size; if (AEGetAttributePtr(req, keyMissedKeywordAttr, typeWildCard, &type, NULL, 0, &size) == noErr) return errAEParamMissed; /* We can't meaningfully do anything here. */ return errAEEventNotHandled; }
pascal OSErr mac_aevt_quit(const AppleEvent *req, AppleEvent *reply, long refcon) { DescType type; Size size; if (AEGetAttributePtr(req, keyMissedKeywordAttr, typeWildCard, &type, NULL, 0, &size) == noErr) return errAEParamMissed; borednow = 1; return noErr; }
pascal OSErr mac_aevt_oapp(const AppleEvent *req, AppleEvent *reply, long refcon) { DescType type; Size size; if (AEGetAttributePtr(req, keyMissedKeywordAttr, typeWildCard, &type, NULL, 0, &size) == noErr) return errAEParamMissed; /* XXX we should do something here. */ return noErr; }
static int MissedAnyParameters( const AppleEvent *theEvent) { DescType returnedType; Size actualSize; OSStatus err; err = AEGetAttributePtr(theEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); return (err != errAEDescNotFound); }
// -------------------------------------------------------------------------------------- static pascal OSErr openApplicationAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, long refcon) { #pragma unused (reply, refcon) OSErr error; DescType returnedType; Size actualSize; error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); if (error == noErr) error = errAEParamMissed; else if (error == errAEDescNotFound) { EventTypeSpec applicationEvents[] = { {kEventClassCommand, kEventCommandProcess} }; /* For our program running in Carbon, a Quit Application Apple Event handler is unnecessary because RunApplicationEventLoop installs one for us that calls QuitApplicationEventLoop. However we will leave ours here in case we ever need it to do something different so that we know where it belongs. */ gQuitAppAEHandler = NewAEEventHandlerUPP(quitApplicationAEHandler); error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, gQuitAppAEHandler, 0, false); if (error != noErr) // if we can't allow the user a mechanism to quit { // we'd better just quit right now DisposeAEEventHandlerUPP(gOpenAppAEHandler); DisposeAEEventHandlerUPP(gQuitAppAEHandler); ExitToShell(); } gViewsFontChangedAEHandler = NewAEEventHandlerUPP(viewsFontChangedAEHandler); error = AEInstallEventHandler(kAppearanceEventClass, kAEViewsFontChanged, gViewsFontChangedAEHandler, 0, false); gAppEventHandler = NewEventHandlerUPP(appEventHandler); InstallApplicationEventHandler(gAppEventHandler, GetEventTypeCount(applicationEvents), applicationEvents, NULL, NULL); Gestalt(gestaltSystemVersion, &gMacOSVersion); // get the version of Mac OS we're // running on InitIconDataBrowser(); error = noErr; } return error; }
OSErr GetSendersAddress(AppleEvent *event,AEAddressDesc *targ) { Size len=sizeof(long); DescType actualType; long sessionID; OSErr err; err=AEGetAttributePtr(event, keyAddressAttr, typeSessionID, &actualType, &sessionID, len, &len); if (err) return err; // Create the address desriptor return AECreateDesc(typeSessionID,(Ptr)&sessionID,sizeof(long), targ); }
ODBoolean MissingParams(const AppleEvent* message) { #if !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK) AEKeyword missedKeyword; DescType ignoreType; Size ignoreSize; OSErr myErr; myErr = AEGetAttributePtr(message, keyMissedKeywordAttr, typeWildCard, &ignoreType, (Ptr)&missedKeyword, sizeof(missedKeyword), &ignoreSize); return myErr == noErr; #else // defined(_PLATFORM_WIN32_) && defined(PORTING_HACK) return kODFalse; #endif // !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK) }
/* ---------------------------------------------------------------------------- handleAECore Handles core application Apple Events. Returns an apple event error code. ---------------------------------------------------------------------------- */ pascal OSErr handleAECore (AppleEvent theEvent, AppleEvent theReply, long refCon) { #pragma unused(theReply) #pragma unused(refCon) OSErr osErr = noErr; Size rSize; DescType rType; unsigned long eventID; /** get event ID of apple event **/ if ((osErr = AEGetAttributePtr(&theEvent, keyEventIDAttr, typeType, &rType, (Ptr)&eventID, sizeof(eventID), &rSize)) != noErr) return(osErr); /** process apple event **/ switch (eventID) { case kAEOpenApplication: osErr = noErr; break; case kAEOpenDocuments: TpsAssert(false, "We have no Documents!"); osErr = errAEEventNotHandled; break; case kAEPrintDocuments: TpsAssert(false, "We print no Documents!"); osErr = errAEEventNotHandled; break; case kAEQuitApplication: gQuit = true; // exit event loop break; case kAEApplicationDied: TpsAssert(false, "A close relative to this application just Died!"); osErr = errAEEventNotHandled; break; case kAEAnswer: TpsAssert(false, "We have no Answers!"); osErr = errAEEventNotHandled; break; default: TpsAssert(false, "We are very confused over this turn of Events!"); osErr = errAEEventNotHandled; break; } return(osErr); }
static OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent) { DescType returnedType; Size actualSize; OSErr err; switch (err = AEGetAttributePtr(&theAppleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, nil, 0, &actualSize)) { case errAEDescNotFound: // If we couldnt find the error attribute return noErr; // everything is ok, return noErr case noErr: // We found an error attribute, so return errAEEventNotHandled; // tell the client we ignored the event default: return err; // Something else happened, return it } }
static OSStatus MissingParameterCheck(const AppleEvent *inputEvent) { OSStatus anErr; AEKeyword missingKeyword; DescType ignoredActualType; Size ignoredActualSize; anErr = AEGetAttributePtr(inputEvent, keyMissedKeywordAttr, typeWildCard, &ignoredActualType, (Ptr) &missingKeyword, sizeof(AEKeyword), &ignoredActualSize); if (anErr == noErr) { anErr = errAEParamMissed; } else { if (anErr == errAEDescNotFound) anErr = noErr; } return anErr; }
OSErr quitAppEventHandler(AppleEvent *appEvent,AppleEvent *reply,SInt32 handlerRefcon) { OSErr osError; DescType returnedType; Size actualSize; osError = AEGetAttributePtr(appEvent,keyMissedKeywordAttr,typeWildCard,&returnedType,NULL,0, &actualSize); if(osError == errAEDescNotFound) { gDone = true; osError = noErr; } else if(osError == noErr) osError = errAEParamMissed; return osError; }
/*---------------------------------------------------------------------------- HandleMozillaSuiteEvent ----------------------------------------------------------------------------*/ void AEMozillaSuiteHandler::HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply) { OSErr err = noErr; AEEventID eventID; OSType typeCode; Size actualSize = 0L; // Get the event ID err = AEGetAttributePtr(appleEvent, keyEventIDAttr, typeType, &typeCode, (Ptr)&eventID, sizeof(eventID), &actualSize); ThrowIfOSErr(err); try { switch (eventID) { case kDoJavaScriptEvent: // write me! ThrowOSErr(errAEEventNotHandled); break; default: ThrowOSErr(errAEEventNotHandled); break; } } catch (OSErr catchErr) { PutReplyErrorNumber(reply, catchErr); throw; } catch ( ... ) { PutReplyErrorNumber(reply, paramErr); throw; } }
ODSLong GetSLongAttr(AppleEvent* ae, AEKeyword keyword) { OSErr result; ODSLong value; #if !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK) DescType actualType; Size sizeOfBuffer = sizeof(value); Size actualSize; result = AEGetAttributePtr(ae, keyword, typeWildCard, &actualType, (Ptr)&value, sizeOfBuffer, &actualSize); if (result != noErr) THROW((ODError)result); //if ((actualType != typeShortInteger) || (actualSize != sizeOfBuffer)) if (actualSize != sizeOfBuffer) THROW(kODErrOutOfMemory); #endif // !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK) return value; }
// -------------------------------------------------------------------------------------- static pascal OSErr quitApplicationAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, long refcon) { #pragma unused (reply, refcon) OSErr error; DescType returnedType; Size actualSize; error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); if (error == noErr) error = errAEParamMissed; else if (error == errAEDescNotFound) { QuitApplicationEventLoop(); error = noErr; } return error; }
pascal OSErr mac_aevt_odoc(const AppleEvent *req, AppleEvent *reply, long refcon) { DescType type; Size size; AEDescList docs = { typeNull, NULL }; OSErr err; err = AEGetParamDesc(req, keyDirectObject, typeAEList, &docs); if (err != noErr) goto out; if (AEGetAttributePtr(req, keyMissedKeywordAttr, typeWildCard, &type, NULL, 0, &size) == noErr) { err = errAEParamMissed; goto out; } err = mac_openlist(docs); out: AEDisposeDesc(&docs); return err; }
static pascal OSErr appleEventHandler( const AppleEvent* e, AppleEvent*, long ) { OSType id = typeWildCard; AEGetAttributePtr( e, keyEventIDAttr, typeType, 0, &id, sizeof(id), 0 ); switch (id) { case kAEQuitApplication: qApp->quit(); return noErr; case kAEReopenApplication: { foreach (QWidget* w, qApp->topLevelWidgets()) if (qobject_cast<QMainWindow*>(w)) w->show(), w->raise(); return noErr; } default: return unimpErr; } }
// Set s_bSkipExitConfirmation to true if cancelled because of logging out or shutting down OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon ) { DescType senderType; Size actualSize; ProcessSerialNumber SenderPSN; ProcessInfoRec pInfo; FSSpec fileSpec; OSStatus anErr; // Refuse to quit if a modal dialog is open. // Unfortunately, I know of no way to disable the Quit item in our Dock menu if (wxGetApp().IsModalDialogDisplayed()) { SysBeep(4); return userCanceledErr; } anErr = AEGetAttributePtr(appleEvt, keyAddressAttr, typeProcessSerialNumber, &senderType, &SenderPSN, sizeof(SenderPSN), &actualSize); if (anErr == noErr) { pInfo.processInfoLength = sizeof( ProcessInfoRec ); pInfo.processName = NULL; pInfo.processAppSpec = &fileSpec; anErr = GetProcessInformation(&SenderPSN, &pInfo); // Consider a Quit command from our Dock menu as coming from this application if ( (pInfo.processSignature != 'dock') && (pInfo.processSignature != 'BNC!') ) { s_bSkipExitConfirmation = true; // Not from our app, our dock icon or our taskbar icon // The following may no longer be needed under wxCocoa-3.0.0 wxGetApp().ExitMainLoop(); // Prevents wxMac from issuing events to closed frames } } wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_EXIT); wxGetApp().GetFrame()->GetEventHandler()->AddPendingEvent(evt); return noErr; }
static PyObject *AEDesc_AEGetAttributePtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; AEKeyword theAEKeyword; DescType desiredType; DescType typeCode; char *dataPtr__out__; long dataPtr__len__; int dataPtr__in_len__; // TO DO: add dataPtr__actual_len__, dataPtr__out_len__; dataPtr__out_len__ = (dataPtr__actual_len__ > dataPtr__in_len__) ? dataPtr__in_len__ : dataPtr__actual_len__; use dataPtr__out_len__ to specify buffer size in Py_BuildValue, then return dataPtr__actual_len__ so clients can compare this against the value they supplied for dataPtr__in_len__ and decide if they want to try again with a larger buffer #ifndef AEGetAttributePtr PyMac_PRECHECK(AEGetAttributePtr); #endif if (!PyArg_ParseTuple(_args, "O&O&i", PyMac_GetOSType, &theAEKeyword, PyMac_GetOSType, &desiredType, &dataPtr__in_len__)) // TO DO: note: client will normally use AESizeOfAttribute to obtain this value in advance, unless they specify a desiredType different to actual type return NULL; if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) { PyErr_NoMemory(); goto dataPtr__error__; } dataPtr__len__ = dataPtr__in_len__; _err = AEGetAttributePtr(&_self->ob_itself, theAEKeyword, desiredType, &typeCode, dataPtr__out__, dataPtr__len__, &dataPtr__len__); // TO DO: will cause Py_BuildValue to overrun buffer if caller's buffer size is too small; if actual size > buffer size, need to resize buffer and call again; simplest is to return actual size to caller and let them decide if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&s#", PyMac_BuildOSType, typeCode, dataPtr__out__, (int)dataPtr__len__); free(dataPtr__out__); dataPtr__error__: ; return _res; }
// -------------------------------------------------------------------------------------- static pascal OSErr viewsFontChangedAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, long refcon) { #pragma unused (reply, refcon) OSErr error; DescType returnedType; Size actualSize; error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); if (error == noErr) error = errAEParamMissed; else if (error == errAEDescNotFound) { WindowRef window; FourCharCode prefsWindowKind; for (window = GetFrontWindowOfClass(kDocumentWindowClass, false); window != NULL; window = GetNextWindowOfClass(window, kDocumentWindowClass, false)) { GetWindowProperty(window, kAppSignature, kPrefsWindowKindTag, sizeof(FourCharCode), NULL, &prefsWindowKind); if (prefsWindowKind == kPrefsWindowKindDialog) RedrawPrefsDialogDataBrowser(window); else // kPrefsWindowKindWindow RedrawPrefsWindowDataBrowser(window); } error = noErr; } return error; }
/*---------------------------------------------------------------------------- DispatchEvent Handles all OSL messages that this object should handle ----------------------------------------------------------------------------*/ void AEGenericClass::DispatchEvent(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply) { OSErr err = noErr; AEEventID eventID; OSType typeCode; Size actualSize = 0L; // Get the event ID err = AEGetAttributePtr(appleEvent, keyEventIDAttr, typeType, &typeCode, (Ptr)&eventID, sizeof(eventID), &actualSize); ThrowIfOSErr(err); try { switch (eventID) { case kAEClone: HandleDuplicate(token, appleEvent, reply); break; case kAEClose: HandleClose(token, appleEvent, reply); break; case kAECountElements: HandleCount(token, appleEvent, reply); break; case kAECreateElement: HandleMake(token, appleEvent, reply); break; case kAEDelete: HandleDelete(token, appleEvent, reply); break; case kAEDoObjectsExist: HandleExists(token, appleEvent, reply); break; case kAEGetData: HandleGetData(token, appleEvent, reply); break; case kAEGetDataSize: HandleDataSize(token, appleEvent, reply); break; case kAEMove: HandleMove(token, appleEvent, reply); break; case kAEOpen: // == kAEOpenDocuments HandleOpen(token, appleEvent, reply); break; case kAEPrint: HandlePrint(token, appleEvent, reply); break; case kAEOpenApplication: HandleRun(token, appleEvent, reply); break; case kAEReopenApplication: HandleReOpen(token, appleEvent, reply); break; case kAEQuitApplication: HandleQuit(token, appleEvent, reply); break; case kAESave: HandleSave(token, appleEvent, reply); break; case kAESetData: HandleSetData(token, appleEvent, reply); break; // MT-NW suite case kAEExtract: HandleExtract(token, appleEvent, reply); break; case kAESendMessage: HandleSendMessage(token, appleEvent, reply); break; default: err = errAEEventNotHandled; break; } } catch (OSErr catchErr) { PutReplyErrorNumber(reply, catchErr); throw; } catch ( ... ) { PutReplyErrorNumber(reply, paramErr); throw; } }