简体   繁体   English

如何使用AppleScript编辑器在Mac上记录邮件GUI操作

[英]How to record Mail GUI actions on Mac using AppleScript Editor

I'm a newbie to Mac and trying to use AppleScript to ease my daily job. 我是Mac的新手,因此尝试使用AppleScript简化日常工作。 One of the things I want to achieve is to automatically create Smart Mailbox based on the groups in my Address Book. 我要实现的目的之一是根据通讯簿中的组自动创建智能邮箱。 While I have no problem automate Address Book, there's no much article about how to automatically create Smart Mailbox. 虽然我没有任何问题可以使通讯簿自动化,但关于如何自动创建智能邮箱的文章也很少。 After some searches on the web I realized it can only be done through GUI scripting. 在网上进行一些搜索后,我意识到只能通过GUI脚本来完成。 But most of the answers are about how to bring up the new Smart Mailbox dialog but no further information about eg how to select different rules. 但大多数答案都是关于如何启动新的智能邮箱对话框,但没有关于例如如何选择不同规则的进一步信息。 I tried to use AppleScript Editor to record my activity so that I can learn from that but found out after recording, there's nothing get recorded! 我尝试使用AppleScript编辑器记录我的活动,以便我可以从中学习,但在录制后发现,没有任何记录! I tried with other apps like Finder the recording does work! 我试过像Finder这样的其他应用,录音确实有效! If anyone knows how to record it, or how to get more information on this type of GUI scripting would be very appreciated! 如果有人知道如何记录它,或如何获取有关此类型GUI脚本的更多信息,将不胜感激!

Unfortunately Mail's Applescript support is more than a little maddening at times due to being so limited. 不幸的是,由于受到如此限制,Mail的Applescript支持有时令人抓狂。 Control of smart mailboxes is but one example. 控制智能邮箱只是一个例子。 I'd hoped SL would have fixed this but Apple's thinking about Applescript can be pretty schizophrenic at times. 我希望SL可以解决此问题,但Apple有时对Applescript的想法可能会导致精神分裂症。 I'm not sure they have decided what to do with it. 我不确定他们是否已决定如何处理。

I'd got a Smart Mailbox creation script working but it never worked reliably so I never deployed it. 我有一个智能邮箱创建脚本工作,但它从来没有可靠的工作,所以我从来没有部署它。 If you really want it I can give you the code - although it's written in Python + Appscript rather than pure Applescript. 如果您真的想要它,我可以给您代码-尽管它是用Python + Appscript而不是纯Applescript编写的。

Were I you I'd submit this as a bug to Apple and hopefully it'll be fixed with Lion. 如果我是你,我会将此作为一个错误提交给Apple,并希望它可以通过Lion修复。

The problem with GUI scripting as I'm sure you discovered is that figuring out how to get the name of each particular element can be maddening. 我确信您发现GUI脚本的问题在于弄清楚如何获取每个特定元素的名称可能令人抓狂。 There are a few utilities out there that will help, but unless you are doing a lot of GUI scripting they probably aren't worth the cost. 有一些实用程序可以提供帮助,但是除非您执行大量的GUI脚本编写,否则它们可能不值得花这笔钱。

Regarding Applescript recording this was a really nice feature often supported under the old MacOS. 关于Applescript录制,这是一个非常好的功能,通常支持旧的MacOS。 However with the switch to OSX almost no application supports it so it's basically a dead feature for all practical intents. 然而,切换到OSX几乎没有任何应用程序支持它,所以它基本上是所有实际意图的死机功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM