我要做的是设置一个智能邮箱,它将列出我每天分配的公司邮箱列表(范围在8到30之间,具体取决于帐户的大小和人数)工作)所以我可以观察和协助公司。理想情况下,脚本将接受公司列表然后通过邮箱并将它们添加到智能邮箱,如“邮箱中的邮件”“公司A”,但公司A位于邮箱>信>公司。这是我到目前为止所拥有的。
set CustomerNames to {"Example, A"}
set CustomerNumber to 1
display dialog "What are the Customer's Names?" default answer ""
set CustomerNames to text returned of result
tell application "Mail" to activate
tell application "System Events"
tell process "Mail"
tell menu bar 1
tell menu bar item "Mailbox"
tell menu "Mailbox"
click menu item "New Smart Mailbox…"
end tell
end tell
end tell
end tell
keystroke "w" using shift down
keystroke "orklist2"
keystroke tab
keystroke "a"
delay 2
keystroke tab
key code 31 using control down -- Down Arrow
delay 2
tell process "Mail"
get the name of front Mail window
get the name of the selected menu
click menu item "Message is in mailbox"
keystroke tab
set the popupbutton to "CustomerNames"
click menu item "add criterion"
end tell
end tell
tell application "System Events"
repeat with CustomerNames from 1 to count of CustomerNames
click menu item "add criterion"
set the popupbutton to menu 13
set CustomerNumber to CustomerNames add 1
end repeat
keystroke return
end tell