Cocoa 如何以编程方式在mail.app中设置所有邮件帐户?
我的应用程序需要知道在Mail.app中设置的所有帐户,然后要求用户为特定用途选择一个帐户。Cocoa 如何以编程方式在mail.app中设置所有邮件帐户?,cocoa,email,Cocoa,Email,我的应用程序需要知道在Mail.app中设置的所有帐户,然后要求用户为特定用途选择一个帐户。 我怎样才能做到这一点呢?AppleScript可能是一种方法(请查看NSAppleScript): 样本: NSAppleScript* script= [[NSAppleScript alloc] initWithSource:@"tell application \"Mail\" \nname of every account \nend tell"]; NSDictionary* scriptE
我怎样才能做到这一点呢?AppleScript可能是一种方法(请查看NSAppleScript):
样本:
NSAppleScript* script= [[NSAppleScript alloc] initWithSource:@"tell application \"Mail\" \nname of every account \nend tell"];
NSDictionary* scriptError = nil;
NSAppleEventDescriptor* descriptor=[script executeAndReturnError:&scriptError];
if(scriptError)
{
NSLog(@"Error: %@",scriptError);
return;
}
NSLog(@"Result: %@",descriptor);
Thx这么多,但我如何与AppleScript通信?我怎样才能得到结果?我不太熟悉AppleScript..添加了示例,这将正确返回我的邮件帐户。