Skip navigation.
 
mlRun Apple Script
FROM : Ashutosh Kumar Awasthi
DATE : Fri Apr 01 20:15:25 2005

Hi All,

I have written an application that is calling an apple script it is running fine on mac os x but when i am running the same on mac os 9 it is compiling not running.
it is giving error -1752.

i have done like this.



OSStatus            err;
   ComponentInstance    theComponent    = NULL;
   OSAID                contextID        = kOSANullScript;
   OSAID                resultID        = kOSANullScript;

   theComponent    = OpenDefaultComponent( kOSAComponentType, typeAppleScript );    // Here i am getting Error -1752 on mac os 9.
if ( theComponent == NULL )    { err = paramErr; goto Bail; }

   err    = OSALoad( theComponent, scriptData, kOSAModeNull, &contextID );            //    Compile the script into a new context
   require_noerr( err, Bail );

   err    = OSAExecuteEvent( theComponent, theEvent, contextID, kOSAModeNull, &resultID );    //    Run the script

   if ( resultData != NULL )                                                        //    Collect the results - if any
   {
       AECreateDesc( typeNull, NULL, 0, resultData );
       if ( err == errOSAScriptError )
           OSAScriptError( theComponent, kOSAErrorMessage, typeChar, resultData );
       else if ( (err == noErr) && (resultID != kOSANullScript) )
           OSADisplay(theComponent, resultID, typeChar, kOSAModeNull, resultData);
   }

Bail:
   if ( contextID != kOSANullScript )    OSADispose( theComponent, contextID );
   if ( resultID != kOSANullScript )    OSADispose( theComponent, resultID );
   if ( theComponent != NULL )            CloseComponent( theComponent );
   return( err );
}

Thanks in Advance
Ashutosh kumar awasthi

Related mailsAuthorDate
No related mails found.