我已经编写了一个从Active Directory获取信息并在Microsoft Outlook for Mac中创建新签名的脚本。
我使用以下代码来创建签名(我将省略其他代码,因为它实际上并不相关):
tell application "Microsoft Outlook"
make new signature with properties {name:strName, content:contentHTML, plain text content:"", include in random:false}
end tell其中strName是我从别处获得的签名的名称,而contentHTML是我在别处构建的实际签名。
将此签名添加到Microsoft Outlook可以完美地工作,但我看不到如何将我创建的签名设置为当前帐户的默认签名。我已经做了相当多的研究,但都没有任何帮助,我还翻了翻字典。
发布于 2013-02-27 13:47:30
这可以使用AppleScript来完成。Outlook 2011字典中没有专门介绍这一点,因此可以通过编写UI元素脚本来实现这一点,这无疑是相当笨拙的。
签名是按帐户设置的,因此您需要向此脚本提供帐户的名称,以及要为该帐户设置的签名的名称。
setDefaultSignature to "strName" for "Gmail"
on setDefaultSignature to mySignature for accountName
tell application "Microsoft Outlook" to activate
tell application "System Events"
-- turn on UI automation - may throw a permissions dialog
if UI elements enabled is false then set UI elements enabled to true
click menu item "Preferences..." of menu 1 of menu bar item "Outlook" of menu bar 1 of application process "Outlook"
click item 1 of (buttons of window "Outlook Preferences" of application process "Outlook" whose description is "Signatures")
click button "Default Signatures..." of window "Signatures" of application process "Outlook"
repeat with thisRow in rows of table 1 of scroll area 1 of sheet 1 of window "Signatures" of application process "Outlook"
if value of text field of thisRow as string is accountName then
click pop up button 1 of thisRow
click menu item mySignature of menu 1 of pop up button 1 of thisRow
click button "OK" of sheet 1 of window "Signatures" of application process "Outlook"
click item 1 of (buttons of window "Signatures" of application process "Outlook" whose description is "close button")
exit repeat
end if
end repeat
end tell
end setDefaultSignaturehttps://stackoverflow.com/questions/10089478
复制相似问题