我似乎在努力运行一个简单的脚本。
我的脚本现在做的不多,只是循环浏览电子邮件并获取发件人的电子邮件和姓名。
using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
tell application "Mail"
set the message_count to the count of these_messages
repeat with i from 1 to the message_count
set this_message to item i of these_messages
tell (sender of this_message)
set theFromName to (extract name from it)
set theFromAddress to (extract address from it)
end tell
log "joel was here"
end repeat
end tell
end perform mail action with messages
end using terms from
当我尝试添加一个规则来运行这个脚本时,我进入了文件选择器,当我选择文件时没有任何反应,它只是在脚本编辑器中打开一个文件到一个新窗口。我的文件以 .scpt 结尾,我尝试将它放在 com.apple.mail 文件夹中,在下面的子文件夹中,也在原始位置(在 ScriptEditor 文件夹中),似乎没有任何效果。
这一定是一些愚蠢和基本的东西,有什么想法吗?
还有什么实用的方法可以测试这个脚本,从我用谷歌搜索的日志来看是行不通的。