【问题标题】:Change contents of new message in outlook在 Outlook 中更改新消息的内容
【发布时间】:2014-11-24 17:44:06
【问题描述】:

我想更改当前编写的消息的内容,并在末尾添加字符串*WF*。下面是脚本,我收到错误Microsoft Outlook got an error: Can’t set content of draft window id 9490 to ...

on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to ""
    return this_text
end replace_chars

tell application "Microsoft Outlook"

    activate

    set theWindow to window 1

    -- check it's really draft
    if class of theWindow is not draft window then
        display dialog "Not a draft"
        return
    end if

    -- save the draft
    save theWindow

    --get the id of the object of the draft window
    set myObjectID to id of (object of theWindow)

    -- to make it secure
    set myContent to content of message id myObjectID

    --edit recipient
    -- set theBCC to bcc recipient of message id myObjectID
    -- set emailString to theBCC
    make new bcc recipient at message id myObjectID with properties {email address:{name:"Ittay Dror", address:"idror@akamai.com"}}

    set myContent to my replace_chars(myContent, "</body>", "*WF*</body>")
    set the content of theWindow to myContent
end tell

【问题讨论】:

    标签: macos outlook automation applescript


    【解决方案1】:

    您不能设置窗口的内容。请设置留言内容:

    set the content of message id myObjectID to myContent
    

    干杯, 迈克尔/汉堡

    【讨论】:

    • 但是窗口的内容保持不变。有没有办法从消息中读取?
    • 在最后一个 end tell 保存内容之前close theWindow。我没有找到任何其他方法...如果您想对消息执行其他操作,可以使用 open message id myObjectID 再次打开它
    猜你喜欢
    • 2019-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-06
    • 1970-01-01
    • 2011-07-01
    • 1970-01-01
    相关资源
    最近更新 更多