我有以下Outlook 2011的Applescript(底部)。我试图将超过四个月的收件箱邮件移至计算机上的#34;"文件夹(在我的应用程序计算机上)。
当我运行脚本时,此行似乎总是返回true,因此它会存档每条消息:
if time received of msg > (current date) - 4 * (4 * weeks) then
我今年11月5日冒充了,收件箱中最早的邮件是9月1号,所以if语句不应该触发。
以下是示例运行的事件日志:
tell application "Microsoft Outlook"
activate
get every message of inbox
count every message of inbox
current date
end tell
tell current application
current date
end tell
tell application "Microsoft Outlook"
get time received of item 1 of every message of inbox
(*time received of item 1 of every message of inbox*)
move item 1 of every message of inbox to on my computer
current date
end tell
tell current application
current date
end tell
tell application "Microsoft Outlook"
get time received of item 2 of every message of inbox
(*time received of item 2 of every message of inbox*)
move item 2 of every message of inbox to on my computer
current date
end tell
tell current application
current date
end tell
tell application "Microsoft Outlook"
get time received of item 3 of every message of inbox
(*time received of item 3 of every message of inbox*)
move item 3 of every message of inbox to on my computer
完整脚本:
tell application "Microsoft Outlook"
activate
if messages of inbox = {} then
error "No messages."
error -128
end if
repeat with msg in messages of inbox
if time received of msg > (current date) - 4 * (4 * weeks) then
move msg to on my computer
end if
end repeat
end tell
答案 0 :(得分:2)
4 *(4 *周)是4月前从11月5日开始的,所以大概是7月5日。如果您的消息时间是9月1日那么它肯定会触发它,因为9月1日大于7月5日。也许您打算使用小于(即<)标志?