Ich versuche, mehrere Anhänge zu einer E-Mail in Applescript hinzuzufügen. Ich setze den Betreff oben auf Ordner und Wochennummer.Apple Mail-Anwendung, Hinzufügen mehrerer Anlagen
set {b, c} to {"1/1/1000", 364876}
set {year:yy, month:mm, day:dd} to (current date)
set yy to text 3 thru 4 of (yy as text)
set d to ((((current date) - (date b)) div days + c) div 7) + 1
set e to ((((date ("1/1/" & (year of the (current date)) as string)) - (date b)) div days + c) div 7) + 1
set weekCode to (yy & (d - e) as text)
set rSpace to "
"
set theSubject to "folder Week " & (text 3 thru 4 of weekCode)
tell application "Finder"
\t set folderPath to folder ((get (path to home folder) as Unicode text) & "Documents:folder" as Unicode text)
\t set thefList to ""
\t set fcount to 1
\t repeat
\t \t try
\t \t \t set theFile to ((file fcount) in folderPath as alias)
\t \t \t set theFile to name of theFile
\t \t \t if thefList is "" then
\t \t \t \t set thefList to theFile
\t \t \t else
\t \t \t \t set thefList to thefList & "
" & theFile
\t \t \t end if
\t \t \t set fcount to (fcount + 1)
\t \t on error
\t \t \t set fcount to (fcount - 1)
\t \t \t exit repeat
\t \t end try
\t end repeat
\t
\t --return thefList
\t set theAttachment to theFile
end tell
repeat (fcount - 1) times
\t set rSpace to "
" & rSpace
end repeat
tell application "Mail"
\t activate
\t set theMessage to make new outgoing message with properties {visible:true, sender:"[email protected]", subject:theSubject, content:rSpace}
\t
\t
\t tell theMessage
\t \t make new to recipient with properties {address:"[email protected]"}
\t \t set acount to 1
\t \t repeat fcount times
\t \t \t
\t \t \t try
\t \t \t \t make new attachment with properties {file name:(paragraph acount of thefList)} at after the last word of the paragraph acount
\t \t \t \t set message_attachment to 0
\t \t \t on error errmess -- oops
\t \t \t \t log errmess -- log the error
\t \t \t \t set message_attachment to 1
\t \t \t end try
\t \t \t log "message_attachment = " & acount
\t \t \t set acount to (acount + 1)
\t \t end repeat
\t \t
\t \t send
\t end tell
end tell
Es ist das Hinzufügen nicht die Anlagen, aber es ist die E-Mail zu senden.
Wie kann ich das Programm korrigieren, um die Anhänge hinzuzufügen?
Vielen Dank Vadian! –