【发布时间】:2014-11-06 00:02:53
【问题描述】:
我有以下适用于 Outlook 2011 的 Applescript(底部)。我正在尝试将超过四个月的收件箱消息移动到“在我的计算机上”文件夹(在我的应用程序计算机上)。
当我运行脚本时,这行似乎总是返回 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
【问题讨论】:
标签: applescript