我正在尝试自动化打开通过电子邮件发送的特定链接的过程。
电子邮件中有多个链接,包括一个取消订阅服务的链接,因此打开正确的链接而不是所有链接很重要。
流程将是:
- 电子邮件进来并触发规则
- 规则查找两个参数:来自地址的电子邮件和电子邮件正文中的关键字(不是链接)
- 规则将电子邮件移动到特定邮箱,然后触发 AppleScript
- AppleScript 搜索特定 URL 的开头并在浏览器中打开它(我在白天方便时手动查看打开的浏览器选项卡)
- 电子邮件标记为已读
这就是我所拥有的无法正常工作的:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
repeat with eachMessage in theMessages
tell application "Mail" to set t to paragraphs of the content of eachMessage
repeat with i in t
if i starts with "http://www.website.com/specific/link" then tell application "Safari" to open location i
end repeat
end repeat
end perform mail action with messages
end using terms from
关于我可以做些什么来使这个过程有效的任何建议?