Scripting Additions Guide

CHAPTER 3
Writing Scripting Additions
96 Sample Scripting Addition
way we can determine the type and move its data directly
into a variable instead of an AEDesc. Now we don't have to
worry about disposing of the AEDesc later.
*/
theErr = AESizeOfParam( theAEEvent,
keyDirectObject,
&typeCode,
&sizeOfParam);
if(theErr != noErr){
/*
If we fail here, just return the error. We don't need to
do any cleanup, because we've allocated nothing on the
heap yet. The Apple Event Manager automatically adds the
error number to the reply as keyErrorNumber for nonzero
handler returns.
*/
return theErr;
}
else{
if((typeCode == typeChar) || (typeCode == typeStyledText) ||
(typeCode == typeIntlText)) {
/*
If one of these types match, we've been passed a name
of a resource. Use AEGetParamPtr to move it into our
string and transform it into a Pascal type string
that we can pass to GetNamedResource. If we get an
error in AEGetParamPtr, just let it fall through to
the bottom of this handler.
*/