首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Applescript设置默认Microsoft Outlook for Mac签名

使用Applescript设置默认Microsoft Outlook for Mac签名
EN

Stack Overflow用户
提问于 2012-04-10 21:12:16
回答 1查看 3.3K关注 0票数 2

我已经编写了一个从Active Directory获取信息并在Microsoft Outlook for Mac中创建新签名的脚本。

我使用以下代码来创建签名(我将省略其他代码,因为它实际上并不相关):

代码语言:javascript
复制
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可以完美地工作,但我看不到如何将我创建的签名设置为当前帐户的默认签名。我已经做了相当多的研究,但都没有任何帮助,我还翻了翻字典。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-02-27 13:47:30

这可以使用AppleScript来完成。Outlook 2011字典中没有专门介绍这一点,因此可以通过编写UI元素脚本来实现这一点,这无疑是相当笨拙的。

签名是按帐户设置的,因此您需要向此脚本提供帐户的名称,以及要为该帐户设置的签名的名称。

代码语言:javascript
复制
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 setDefaultSignature
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10089478

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档