title: integrating applescript in cocoa
body: <p>I have made a short applescript that sends an email with attachment. Now I want to integrate this script in my cocoa application. I have tried the following code that i found on the internet:</p>
  
  <pre><code>NSAppleScript *mailScript;
  NSString *scriptString= [NSString stringWithFormat:@"the applescript"];
  mailScript = [[NSAppleScript alloc] initWithSource:scriptString];
  [mailScript executeAndReturnError:nil];
  [mailScript release];
  </code></pre>
  
  <p>This code doesn't work however. I am a complete newbie at cocoa and could use some help.</p>
  
  <p>UPDATE:
  The email is created. The applescript seems to stop when the attachment is added though.The applescript works perfectly when runned in scripteditor. Any clue?</p>
  
  <p>Thanks</p>