gpt4 book ai didi

email - AppleScript 和 Mail.app : checking if new messages contain a string

转载 作者:行者123 更新时间:2023-12-01 02:34:26 25 4
gpt4 key购买 nike

我正在编写一个脚本来检查是否已提交特定的 Web 表单。

到目前为止的脚本是这样写的:

tell application "Mail"
check for new mail
set newmail to get the unread count of inbox
repeat with msg in newmail
if msg's subject contains "New newsletter built by" then
return msg's subject
end if
end repeat
end tell

我的收件箱中有一封未读电子邮件供脚本使用,但我仍然收到错误消息:
error "Mail got an error: Can’t make 1 into type specifier." number -1700 from 1 to specifier

任何帮助都将不胜感激。

干杯!

最佳答案

tell application "Mail"
check for new mail
repeat until (background activity count) = 0
delay 0.5 --wait until all new messages are in the box
end repeat
try
return subject of (first message of inbox whose read status is false and subject contains "New newsletter built by ")
end try
end tell

关于email - AppleScript 和 Mail.app : checking if new messages contain a string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10890749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com