0
我想更改當前撰寫的郵件的內容,並在末尾添加字符串*WF*
。下面是腳本,我得到一個錯誤Microsoft Outlook got an error: Can’t set content of draft window id 9490 to ...
在outlook中更改新郵件的內容
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:"[email protected]"}}
set myContent to my replace_chars(myContent, "</body>", "*WF*</body>")
set the content of theWindow to myContent
end tell
但隨後的窗口中的內容保持不變。有沒有辦法從消息中讀取? – IttayD 2014-09-30 09:46:18
**在最後**結束之前關閉窗口** 告訴**保存內容。我沒有找到任何其他方式...如果你想對消息做其他事情,你可以用 **打開消息ID myObjectID ** – ShooTerKo 2014-09-30 10:21:52