通过AppleScript通过电子邮件发送文件夹的内容


0

我正在尝试编写一个AppleScript,该电子邮件通过电子邮件发送指定文件夹的所有文件。只有一个文件时,它可以按预期工作,但有多个文件时,它就不会工作。它只是给我这个错误:

"Mail got an error: Can’t make {alias \"Macintosh HD:Users:me:temp_photos:IMG_2902.JPG\", alias \"Macintosh HD:Users:me:temp_photos:IMG_2903.JPG\"} into type file." number -1700 from {alias "Macintosh HD:Users:me:temp_photos:IMG_2902.JPG", alias "Macintosh HD:Users:me:temp_photos:IMG_2903.JPG"} to file

这是我的AppleScript

    tell application "Finder"
    set attchList to (every item of TempPhotos) as alias list
end tell

set theSender to "Me<me@me.me>"
set recipName to "You"
set recipAddress to "you@you.com"

tell application "Mail"

    set newmessage to make new outgoing message with properties {subject:"Important File Attachment", content:msgText & return & return, visible:false}
    tell newmessage
        set visible to false
        set sender to theSender
        make new to recipient with properties {name:recipName, address:recipAddress}
        make new attachment with properties {file name:attchList} at after the last paragraph

    end tell
    send newmessage
end tell

有什么帮助吗?

Answers:


0

尝试:

--For Demo  
set TempPhotos to (choose folder)
set msgText to "My Test"

tell application "Finder" to set attchList to (every item of TempPhotos) as alias list

set theSender to "Me<me@me.me>"
set recipName to "You"
set recipAddress to "you@you.com"

tell application "Mail"

    set newmessage to make new outgoing message with properties {subject:"Important File Attachment", content:msgText & return & return, visible:false}
    tell newmessage
        set visible to false
        set sender to theSender
        make new to recipient with properties {name:recipName, address:recipAddress}
        repeat with attach in attchList
            make new attachment with properties {file name:(contents of attach)}
        end repeat

        --For Demo  
        set visible to true
    end tell
    --send newmessage
end tell
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.