如何提高iCal和Outlook的兼容性

如何提高iCal和Outlook的兼容性,outlook,applescript,icalendar,Outlook,Applescript,Icalendar,eHow有一篇关于某些Applescript的文章,该文章假定在Outlook中使iCal邀请格式正确,而不是发送ICS文件 但是,当我按照说明减去HTML标记后,在单击“编译”后,它会在Tell-Mail命令方面出现以下错误: 语法错误:应为或},但找到标识符 在整个脚本中使用相同的命令,但出于某种原因,它只在这里有问题。如果我删除它,我会得到脚本末尾所期望的错误 我对AppleScript一无所知-只是想让iCal适合专业人士使用。摘自您的文章参考链接: on send_mail_sbrp

eHow有一篇关于某些Applescript的文章,该文章假定在Outlook中使iCal邀请格式正确,而不是发送ICS文件

但是,当我按照说明减去HTML标记后,在单击“编译”后,它会在Tell-Mail命令方面出现以下错误:

语法错误:应为或},但找到标识符

在整个脚本中使用相同的命令,但出于某种原因,它只在这里有问题。如果我删除它,我会得到脚本末尾所期望的错误


我对AppleScript一无所知-只是想让iCal适合专业人士使用。

摘自您的文章参考链接:

on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
    set pfile to POSIX file invitationPath
    set myfile to pfile as alias

    try
        -- define a carriage return
        set cr to (ASCII character 13) & (ASCII character 10)

        -- retrieve the user's name and e-mail
        set listOfAccounts to {}

        tell application "Mail"
            repeat with oneAccount in every account
                set listOfAccounts to listOfAccounts & ¬
                    {"\"" & (get full name in oneAccount) & "\" <" & ¬
                        (get email addresses in oneAccount) & ">"}
            end repeat
        end tell

        if ((get length of listOfAccounts) is 1) then
            set theAccountTouse to get first item of listOfAccounts
        else
            set theAccountTouse to ¬
                choose from list listOfAccounts ¬
                    default items (get first item of listOfAccounts) ¬
                    with prompt ¬
                    ¬
                        "Please select which mail account to send the invitation from:" without multiple selections allowed and empty selection allowed
        end if

        -- open and read the iCal event file to insert into an e-mail
        set myEventFileHandle to ¬
            open for access myfile without write permission
        set myEventFileContent to read myEventFileHandle
        close myEventFileHandle

        -- pre-pend mail headers to the event contents
        set myNewEmailText to ¬
            "Subject: " & subjectLine & cr & ¬
            "From: " & theAccountTouse & cr & ¬
            "To: " & myrecipient & cr & ¬
            "content-class: urn:content-classes:calendarmessage" & cr & ¬
            "Content-Type: text/calendar;" & cr & ¬
            "  method=REQUEST;" & cr & ¬
            "  name=\"meeting.ics\"" & cr & ¬
            "Content-Transfer-Encoding: 8bit" & cr & cr & ¬
            myEventFileContent

        -- create a random event file name
        set tempMailName to (random number from 1 to 1000000) & ".ics"
        set aliasTempMail to "/tmp/" & tempMailName

        -- write the new e-mail to a temp file
        set myEventFileHandle to ¬
            open for access (POSIX file aliasTempMail as string) with write permission
        write myNewEmailText starting at 1 to myEventFileHandle
        close myEventFileHandle

        -- use SENDMAIL to send the file with proper headers
        do shell script "sendmail < " & aliasTempMail

        -- delete the temp file
        do shell script "rm " & aliasTempMail
    on error errMsg
        display dialog errMsg
    end try
end send_mail_sbrp