Applescript 如何使用apple脚本单步浏览我的apple邮箱并查看是否存在地址
我对苹果的脚本非常陌生,老实说,我不是一个太多的程序员。我想做一些非常类似的事情: 除了我想查看我的所有电子邮件,并搜索特定地址(我有一个csv/excel/numbers格式的数千个列表),以查看是否存在任何电子邮件通信。我知道如何浏览我的列表和搜索,但不知道如何返回邮件是否存在。我经常向人们发送两封电子邮件,向他们发送营销材料,我宁愿不这样做。下面是我的基本搜索脚本,它是从数字中提取的,只需要弄清楚如何在运行每个电子邮件搜索之后询问邮件应用程序是否存在邮件项目Applescript 如何使用apple脚本单步浏览我的apple邮箱并查看是否存在地址,applescript,apple-mail,Applescript,Apple Mail,我对苹果的脚本非常陌生,老实说,我不是一个太多的程序员。我想做一些非常类似的事情: 除了我想查看我的所有电子邮件,并搜索特定地址(我有一个csv/excel/numbers格式的数千个列表),以查看是否存在任何电子邮件通信。我知道如何浏览我的列表和搜索,但不知道如何返回邮件是否存在。我经常向人们发送两封电子邮件,向他们发送营销材料,我宁愿不这样做。下面是我的基本搜索脚本,它是从数字中提取的,只需要弄清楚如何在运行每个电子邮件搜索之后询问邮件应用程序是否存在邮件项目 set {eAddress}
set {eAddress} to getData()
repeat with i from 1 to 4
activate application "Mail"
tell application "System Events"
tell process "Mail"
tell window 1
keystroke "f" using {command down, option down}
keystroke {item i of eAddress} as string
end tell
end tell
end tell
end repeat
on getData()
set colA to {}
tell application "Numbers"
activate
tell table 1 of sheet 1 of document 1
#set lastRow to 4
set lastRow to row count
#first row index of (get end (last cell of column 1) direction toward the top)
repeat with i from 2 to lastRow
set end of colA to (value of cell i of column "A")
end repeat
end tell
end tell
return {colA}
end getData
我不确定这是否能100%回答你的问题,但如果你只是想知道你是否有来自某个特定地址的邮件,你可以这样做:
set eAddresses to getData()
tell application "Mail"
repeat with thisAddress in eAddresses
if ((count of (messages of inbox whose sender contains thisAddress)) > 0) then
-- there are messages from this address, so do something
else
-- there are no messages from this address, so do something else
end if
end repeat
end tell
on getData()
set colA to {}
tell application "Numbers"
activate
tell table 1 of sheet 1 of document 1
#set lastRow to 4
set lastRow to row count
#first row index of (get end (last cell of column 1) direction toward the top)
repeat with i from 2 to lastRow
set end of colA to (value of cell i of column "A")
end repeat
end tell
end tell
return colA
end getData
第四行的
which
命令-(其收件箱中的邮件数…)
-要求邮件对来自该发件人的邮件进行内部搜索,这比尝试自己循环查看邮件更有效。谢谢,这非常有帮助。告诉数字在这个循环中标记电子邮件相邻单元格的最佳方法是什么?或者在2列数组中添加一个标记并将其添加到后面的数字中会更容易些如果((发件人包含此地址的收件箱的邮件数))>0),则将colB设置为X```@chuckbarry,这是一个单独的问题,应作为新问题发布。如果Ted的答案解决了原来的问题,你可以用绿色勾选他的答案,将这个问题标记为“已解决”。