//-------------------------------------------- // LAESubDesc example to extract the position // enumeration from the keyAEInsertHere // parameter of "inAppleEvent" // The vanilla AE Manager way... { DescType position; AEDesc insertD = {typeNull, NULL}, positionD = {typeNull, NULL}; OSErr err = noErr; if (!err) err = AEGetParamDesc(&inAppleEvent, keyAEInsertHere, typeAERecord, &insertD); if (!err) err = AEGetParamDesc(&insertD, keyAEPosition, typeEnumeration, &positionD); if (!err) position = **(DescType**)positionD.dataHandle; AEDisposeDesc(&insertD); AEDisposeDesc(&positionD); ThrowIfOSErr_(err); } // The exception and memory safe UAEGizmos way... { LAESubDesc ae(inAppleEvent); DescType position = ae.KeyedItem(keyAEInsertHere). KeyedItem(keyAEPosition).ToEnum(); } //-------------------------------------------- // LAEStream example to constructing a // typeInsertionLoc record // The vanilla AE Manager way... { AEDesc desc = {typeNull, NULL}, ospec = {typeNull, NULL}; OSErr err = noErr; if (!err) inObject->MakeSelfSpecifier(ospec); if (!err) err = AECreateList(NULL, 0, true, &desc.mDesc); if (!err) err = AEPutParamDesc(&desc.mDesc, keyAEObject, &ospec); if (!err) err = AEPutParamPtr(&desc.mDesc, keyAEPosition, typeEnumerated, &inPosition, sizeof(inPosition)); if (!err) err = AECoerceDesc(&desc.mDesc, typeInsertionLoc, outDesc); AEDisposeDesc(&desc); AEDisposeDesc(&ospec); ThrowIfOSErr_(err); } // The equivalent LAEStream version is: { LAEStream stream; stream.OpenRecord(typeInsertionLoc); stream.WriteKey(keyAEObject); stream.WriteSpecifier(inObject); stream.WriteKey(keyAEPosition); stream.WriteEnumDesc(inPosition); stream.CloseRecord(); stream.Close(&outDesc); }