Scripting Additions Guide
Table Of Contents
CHAPTER 3
Writing Scripting Additions
98 Sample Scripting Addition
if(theErr == noErr) {
/* now grab the 'snd ' resource by ID */
theSndHandle = GetResource (kSndType, ourRezID);
/* check the error */
theErr = ResError();
if(theErr == noErr)
theErr = PlaySound(theSndHandle); /*call our */
/* sound code*/
}
}
else {
if(typeCode == typeAlias) {
/*
If we receive a typeAlias, the user is asking us
to play a sound file. We want to use a FSSpec to
open the resource file, so once again we ask the
Apple Event Manager to coerce data to the type
we need.
*/
theErr = AEGetParamPtr(theAEEvent, keyDirectObject,
typeFSS, &typeCode,
(Ptr)&ourSoundFile,
sizeof(ourSoundFile),
&actualSize);
if(theErr != noErr)
return theErr;
/* save off our current resource file */
curResFile = CurResFile();
/* open our resource file for reading */
ourFileRef = FSpOpenResFile(&ourSoundFile,
fsRdPerm);