Posted By

sudarkoff on 02/16/08


Tagged

cocoa applescript


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tcol


Running a pre-canned AppleScript


 / Published in: Objective C
 

URL: http://www.borkware.com/quickies/single?id=307

  1. #define runScriptName @"checknewnow"
  2. #define runScriptType @"scpt"
  3.  
  4.  
  5. - (IBAction)runScript:(id)sender
  6. {
  7. /* Locate that darn thing*/
  8. NSString *scriptPath = [[NSBundle mainBundle]
  9. pathForResource: runScriptName
  10. ofType: runScriptType];
  11. NSURL *scriptURL = [NSURL fileURLWithPath: scriptPath];
  12.  
  13. initWithContentsOfURL: scriptURL
  14. error: nil];
  15. [as executeAndReturnError: NULL];
  16. [as release];
  17. }

Report this snippet  

You need to login to post a comment.