Outlook 如何使用AppleScript和文本文件创建事件电子邮件?

Outlook 如何使用AppleScript和文本文件创建事件电子邮件?,outlook,applescript,outlook-addin,osx-mavericks,Outlook,Applescript,Outlook Addin,Osx Mavericks,我必须使用文本文件作为模板创建Outlook电子邮件。我看过一些剧本,但一点也不像我需要的。在创建电子邮件之前,我还需要编辑文件的某些内容。我还需要知道什么是放置模板文件的最佳位置 有一个创建新电子邮件的脚本,但我不知道如何从这里加载测试和编辑 更新代码---- 请提供帮助。您使用的是哪一版本的Mac OS X?是否可以选择Apple Mail而不是Outlook?您的代码来自。我建议你在@adayzdone-hmm脚本中发布或雇佣一位有才华的开发人员。我正在使用Mavericks和outloo

我必须使用文本文件作为模板创建Outlook电子邮件。我看过一些剧本,但一点也不像我需要的。在创建电子邮件之前,我还需要编辑文件的某些内容。我还需要知道什么是放置模板文件的最佳位置

有一个创建新电子邮件的脚本,但我不知道如何从这里加载测试和编辑

更新代码----


请提供帮助。

您使用的是哪一版本的Mac OS X?是否可以选择Apple Mail而不是Outlook?您的代码来自。我建议你在@adayzdone-hmm脚本中发布或雇佣一位有才华的开发人员。我正在使用Mavericks和outlook 11,现在我可以读取文件并生成电子邮件,但我仍然需要用其他字符串替换某些字符串
    --read source from the file

set theFile to "/Users/eclit/Desktop/MeetingTemplate.html"
open for access theFile
set fileContents to (read theFile)
close access theFile

on replaceText(find, replace, subject)
    set prevTIDs to text item delimiters of AppleScript
    set text item delimiters of AppleScript to find
    set subject to text items of subject

    set text item delimiters of AppleScript to replace
    set subject to "" & subject
    set text item delimiters of AppleScript to prevTIDs

    return subject
end replaceText

-- log fileContents

on categoryForName(_categoryName)
    tell application "Microsoft Outlook"
        try
            return category _categoryName
        on error
            try
                -- Getting by name doesn't always work.
                repeat with _category in categories
                    if _category's name is _categoryName then return _category
                end repeat
            end try
            make new category with properties {name:_categoryName}
        end try
        return category _categoryName
    end tell
end categoryForName

log fileContents

tell application "Microsoft Outlook"
    --set newMessage to make new outgoing message with properties {subject:"Hooray for automation", content:fileContents & return & return}
    set theCategory to my categoryForName("Work")
    --set theCategory to make new category with properties {name:"Fanciful", color:{12345, 23456, 11111}}
    set newEvent to make new calendar event with properties {subject:"Dial In : +442034333797  Conference code: 5270687926", content:fileContents}
    --make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank@example.com"}}
    --open newMessage
    open newEvent
end tell
    --read source from the file

set theFile to "/Users/eclit/Desktop/MeetingTemplate.html"
open for access theFile
set fileContents to (read theFile)
close access theFile

on replaceText(find, replace, subject)
    set prevTIDs to text item delimiters of AppleScript
    set text item delimiters of AppleScript to find
    set subject to text items of subject

    set text item delimiters of AppleScript to replace
    set subject to "" & subject
    set text item delimiters of AppleScript to prevTIDs

    return subject
end replaceText

-- log fileContents

on categoryForName(_categoryName)
    tell application "Microsoft Outlook"
        try
            return category _categoryName
        on error
            try
                -- Getting by name doesn't always work.
                repeat with _category in categories
                    if _category's name is _categoryName then return _category
                end repeat
            end try
            make new category with properties {name:_categoryName}
        end try
        return category _categoryName
    end tell
end categoryForName

log fileContents

tell application "Microsoft Outlook"
    --set newMessage to make new outgoing message with properties {subject:"Hooray for automation", content:fileContents & return & return}
    set theCategory to my categoryForName("Work")
    --set theCategory to make new category with properties {name:"Fanciful", color:{12345, 23456, 11111}}
    set newEvent to make new calendar event with properties {subject:"Dial In : +442034333797  Conference code: 5270687926", content:fileContents}
    --make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank@example.com"}}
    --open newMessage
    open newEvent
end tell