告诉 Mail.app 使用 MacRuby 检查新邮件
我想使用 MacRuby 告诉 Mail.app 检查新电子邮件。但在使用 SBApplication 获得应用程序参考后,我不知道如何解决这个问题。
我有以下简单的脚本:
#!/usr/local/bin/macruby
framework 'ScriptingBridge'
mail = SBApplication.applicationWithBundleIdentifier("com.apple.mail")
# mail.check_for_new_mail?
基本上我想在 MacRuby 中执行以下 AppleScript:
tell application "Mail"
check for new mail
end tell
是的,我可以只使用 AppleScript。但我更喜欢Ruby。
I want to use MacRuby to tell Mail.app to check for new email. But I cannot figure out how to go about this after I get an application reference using SBApplication.
I have the following simple script:
#!/usr/local/bin/macruby
framework 'ScriptingBridge'
mail = SBApplication.applicationWithBundleIdentifier("com.apple.mail")
# mail.check_for_new_mail?
Basically I want to do the following AppleScript in MacRuby:
tell application "Mail"
check for new mail
end tell
Yes, I can just use the AppleScript. But I much prefer Ruby.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
提示:使用
puts (mail.methods(true,true) - Object.new.methods)
返回对象和祖先可用的仅可可方法列表tip: use
puts (mail.methods(true,true) - Object.new.methods)
which returns available cocoa only methods list for object and ancestors