如何设置通过的AppleScript当前Mail.app传出消息的发送者? [英] How to set the sender of the current Mail.app outgoing message via AppleScript?

查看:840
本文介绍了如何设置通过的AppleScript当前Mail.app传出消息的发送者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个AppleScript设置在苹果的Mail.app目前传出的消息的发送者。

I'd like to write an AppleScript to set the sender of the current outgoing message in Apple's Mail.app.

我试过这样:

tell application "Mail" to set sender of front outgoing message to "<my email address>"

但我得到的错误信息错误的邮件得到了一个错误:无法设置项目的发送者的。从项目的发送到任何数量-10006 这是没有道理给我。

当我尝试如下询问前传出消息:

When I try to interrogate the front outgoing message as follows:

tell application "Mail" to get properties of front outgoing message

我得到 {类:项目} 的回报,而不是一个传出消息对象就像我期望

I get {class:item} in return, instead of an "outgoing message" object like I'd expect.

任何想法?

推荐答案

不幸的是,的你不能获取或设置传出消息邮件对象,AppleScript的,的属性

Unfortunately, you cannot get or set the properties of the outgoing message object of Mail with Applescript.

相反,你可以使用GUI脚本,直接操纵窗口元素一个解决办法做到这一点。

Instead, you can accomplish this with GUI scripting, a workaround that directly manipulates window elements.

这code应该为你工作:

This code should work for you:

tell application "System Events"
  tell process "Mail"
    click pop up button 1 of window 1
    click menu item 6 of menu 1 of pop up button 1 of window 1
  end tell
end tell

更改菜单项6 第四行到列表中所需的发送者是取其号(例如,如果发件人要更改与此脚本第四个上市,改变菜单项6 菜单项目4 )。

Change the menu item 6 on the fourth line to whichever number in the list your desired sender is (e.g., if the sender you want to change to with this script is the fourth one listed, change menu item 6 to menu item 4).

更新:如果您感到好奇,因为这个答案是超过两年:为2014年4月26日,获取/设置传出消息的属性 s是仍无法与这种解决方法还处于OS工作点¯x10.9小牛。

Update: If you're curious, since this answer is over two years old: as of 2014-04-26, getting/setting the properties of outgoing messages is still impossible and this workaround still works in OS X 10.9 Mavericks.

这篇关于如何设置通过的AppleScript当前Mail.app传出消息的发送者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆