【发布时间】:2011-11-10 04:28:44
【问题描述】:
所以我一直在寻找一种方法来执行以下操作,在 Mail.app 中按顺序使用 AppleScript:
- 拦截传出消息(我们称之为“A”)
- 制作和精确复制外发消息“A”的消息(我们称之为“B”)
- 格式化这条新消息(“B”)的文本/内容等
- 发送这条新格式化的消息(“B”)
- 忽略原来的(“A”)。
我为什么要做一些看起来如此迟钝的事情?
- Apple 的 Mail.app amazingly doesn't format the outgoing content of your messages.
- 通过执行基本的消息 > 首选项 > 等等,它只会改变 您 通过 Mail.app 看到的消息的字体样式。当您的收件人收到邮件时,选择的字体是客户端的默认字体(对于 Outlook 等客户端来说,这可能是令人讨厌的 Times New Roman)。
那么,为什么不直接要求一个 Applescript 来格式化您的外发消息呢?
- (现在我们要开始了……)
- Apple doesn't allow us to get hold of the current outgoing message as an object,太傻了。
- 然而,Apple 确实允许我们使用对象获取“新生成的消息”(通过生成新的传出消息)
仍在学习 AppleScript 的基本原理,因此如果有人能编写出符合要求的 AppleScript 将不胜感激。
我的意图是在我点击“发送消息”时触发 Applescript(通过可爱的键盘大师)。
这是我能想出的骨架 applescript 代码:
set theFont to "Lucida Sans, Lucida Sans Unicode, Lucida Grande, Verdana, Arial"
set theSize to 12
tell application "Mail"
-- 1. intercept an outgoing message
set outMsg to front outgoing message
-- 2. make and exact duplicate of this outgoing message
-- need a little help with extracting...
set fmtMsg to make new outgoing message with properties
{ sender:,
subject:”Convert”,
content:”Please convert and send”
message signature:,
to recipient:,
cc recipient:,
bcc recipient:
}
tell fmtMsg
-- 3. format the text/content etc of this newly made message
set font of content to theFont
set size of content to (theSize)
-- set visible to true
-- 4. send this newly formatted message
send
-- 5. disregard the original one.
-- help?
end tell
end tell
干杯。
【问题讨论】:
标签: fonts applescript apple-mail