我的应用需要知道Mail.app中设置的所有帐户,然后要求用户选择一个用于特定用途。 我怎样才能做到这一点?
答案 0 :(得分:2)
AppleScript可能就是这样(检查NSAppleScript):
http://www.mactech.com/articles/mactech/Vol.21/21.09/ScriptingMail/index.html
样品:
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);