home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / AppleScript / Stufffolder 1.0 / Sources / Stufffolder OSAX / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-15  |  881 b   |  43 lines  |  [TEXT/KAHL]

  1.  
  2. pascal OSErr main( AppleEvent *theEvent, AppleEvent *theReply, long theRefCon)
  3. {    
  4.     OSErr theErr = noErr;
  5.  
  6.     ProcessSerialNumber mySelf;
  7.  
  8.     theErr = theFUNC( &mySelf);
  9.  
  10.     if( theErr == noErr)
  11.     {
  12.         ProcessInfoRec InfoAboutMe;
  13.         FSSpec myFSSpec;
  14.  
  15.         InfoAboutMe.processInfoLength = sizeof( ProcessInfoRec);
  16.         InfoAboutMe.processName = 0L;
  17.         InfoAboutMe.processLocation = 0L;
  18.         InfoAboutMe.processAppSpec = &myFSSpec;
  19.  
  20.         theErr = GetProcessInformation( &mySelf, &InfoAboutMe);
  21.  
  22.         if( theErr == noErr)
  23.         {
  24.             AliasHandle aliasToMe;
  25.  
  26.             theErr = NewAliasMinimal( &myFSSpec, &aliasToMe);
  27.  
  28.             if( theErr == noErr)
  29.             {
  30.                 long size = GetHandleSize( (Handle)aliasToMe);
  31.                 HLock( (Handle)aliasToMe);
  32.  
  33.                     theErr = AEPutParamPtr( theReply, keyDirectObject, typeAlias, *aliasToMe, size);
  34.  
  35.                 HUnlock( (Handle)aliasToMe);
  36.  
  37.                 DisposeHandle( (Handle)aliasToMe);
  38.             }
  39.         }
  40.     }
  41.     return theErr;
  42. }
  43.