我希望能够在apple的mail.app中搜索邮箱中的某个阶段或单词,然后以某种方式返回或复制所有已从搜索结果中成功返回的电子邮件的电子邮件地址来自..如果你明白我的意思
我认为这样做的唯一方法可能就是AppleScript,但如果有其他人知道其他任何方式请告诉我:)
答案 0 :(得分:3)
Mail.app不允许直接通过Applescript进行搜索,但这会有所帮助,虽然它有点慢,因为它必须遍历每条消息:
global searchTerm
property emailList : {}
set searchTerm to "aSearchTerm"
tell application "Mail"
set theInbox to inbox
set firstMessage to 1
set lastMessage to (get count of messages in theInbox)
repeat with thisMessage from firstMessage to lastMessage
set currentMessage to message thisMessage of theInbox
set messageContent to content of currentMessage
if messageContent contains searchTerm then
set end of emailList to sender of currentMessage
end if
end repeat
end tell
return emailList
答案 1 :(得分:0)
您还可以在界面中调用真实搜索,然后收集项目
[Applications launch:@"Mail"];
[Keyboard command_alt_press:'f'];
[Keyboard paste:term];
+(void) command_alt_press:(char)c{
[self runScript:[NSString stringWithFormat:@"tell application \"System Events\" to keystroke \"%c\" using command option down",c]];
}
你似乎有足够的能力来完成其余的代码。