Macos Applescript问题:在邮件中对所选邮件重复操作

Macos Applescript问题:在邮件中对所选邮件重复操作,macos,email,loops,applescript,repeat,Macos,Email,Loops,Applescript,Repeat,问题:我想对Apple OS X Mail中的选定邮件列表运行applescript 现在,我编写的脚本只适用于单个选择,所以我猜问题在于如何为所有选择的项目循环它。任何帮助都将不胜感激 以下是脚本: tell application "Mail" set theSelection to selection set theSelectedMessage to item 1 of theSelection set theSelectedMessageSender to sender of the

问题:我想对Apple OS X Mail中的选定邮件列表运行applescript

现在,我编写的脚本只适用于单个选择,所以我猜问题在于如何为所有选择的项目循环它。任何帮助都将不胜感激

以下是脚本:

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
将其替换为:

repeat with theSelectedMessage in theSelection
在最后一行之前,添加:

end repeat

好的,非常感谢你。我已经玩了几个小时的重复循环来让它工作。摇滚明星!
end repeat