简体   繁体   English

Applescript问题:对选定的邮件在MAIL中重复操作

[英]Applescript Question: Repeat an action in MAIL on selected messages

Question: I would like to run an applescript against a list of selected messages in Apple OS X Mail. 问:我想对Apple OS X Mail中的选定消息列表运行applescript。

Right now, the script I wrote will work on a single selection only, so I am guessing the issue is how to loop it for all items selected. 现在,我编写的脚本仅适用于单个选择,因此我想问题是如何针对所有选定项目循环执行该脚本。 Any help would be appreciated. 任何帮助,将不胜感激。

Here is the script: 这是脚本:

tell application "Mail"

set theSelection to selection
set theSelectedMessage to item 1 of theSelection
set theSelectedMessageSender to sender of theSelectedMessage
set theSelectedMessageRecipient to address of to recipients of theSelectedMessage
set theSelectedMessageSenderName to extract name from sender of theSelectedMessage
set theSelectedMessageSenderAddress to extract address from sender of theSelectedMessage
set theSelectedMessageSubject to subject of theSelectedMessage
set theSelectedMessageContent to content of theSelectedMessage


set MessageText to ¬
"This email (" & theSelectedMessageRecipient & ") does NOT ¬
care to receive emails regarding this matter." & return & return & ¬
"This email was originally delivered to: " & ¬
theSelectedMessageRecipient & return & return & ¬
"Remove this email from your list: " & ¬
theSelectedMessageRecipient & ¬
return & return & ¬
"---------- ORIGINAL MESSAGE ----------------"

set theMessage to make new outgoing message with properties {visible:true, subject:"REMOVE: RE:" & theSelectedMessageSubject, content:MessageText & theSelectedMessageContent, reply to:theSelectedMessageRecipient}
tell theMessage
    make new to recipient at end of to recipients with properties {name:theSelectedMessageSenderName, address:theSelectedMessageSenderAddress}
end tell
end tell
set theSelectedMessage to item 1 of theSelection

Replace this with: 替换为:

repeat with theSelectedMessage in theSelection

Just before the last line, add: 在最后一行之前,添加:

end repeat

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM