我写了一个简单的AppleScript,它在Entourage收件箱中无限循环,并获取“未读”消息的主题:
tell application "Microsoft Entourage"
activate
repeat with eachMsg in messages of folder named "Inbox"
if read status of eachMsg is untouched then
set messageSubject to subject of eachMsg as string
-- bla bla bla
-- How to delete the message and proceed with the next one???
end if
end repeat
现在,问题是,我想在获得主题后删除邮件。我怎样才能做到这一点?你能给我一个例子吗?
再次感谢!
答案 0 :(得分:0)
以下是Microsoft Entourage帮助页面上的示例摘录(特别是“Nuke Messages”脚本):
repeat with theMsg in theMsgs
delete theMsg -- puts in Deleted Items folder
delete theMsg -- deletes completely
end repeat
答案 1 :(得分:0)
删除邮件后,您已经更改了邮件列表的长度,因此在某些时候,您将遇到一个不再存在的索引,因为您已删除了足够的邮件。要解决这个问题,你必须(基本上)硬编码循环;得到消息的数量,从最后一条消息开始,然后从那里向上移动。即使您删除了一条消息,当前索引之上的索引也将始终保持不变。未经测试但是我在其他地方使用的模式......
tell application "Microsoft Entourage"
activate
set lastMessage to count messages of folder named "Inbox"
repeat with eachMsg from lastMessage to 1 by -1
set theMsg to message eachMsg of folder named "Inbox"
if read status of theMsg is untouched then
set messageSubject to subject of theMsg as string
-- bla bla bla
-- How to delete the message and proceed with the next one???
end if
end repeat
Applescript的“方便”语法有时不是,这就是为什么我通常完全避免它。