Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Software>iCal Event per Applescript als Mailanhang verschicken?

iCal Event per Applescript als Mailanhang verschicken?

Oli
Oli06.03.1212:32
Hallo zusammen,

ich würde gerne unseren Kunden bei Terminbestätigungen gleich einen Kalendereintrag mitschicken, so wie man das von Anbietern wie Lufthansa, Sixt oder so kennt.
Die Daten der Anmeldung lese ich mit einem Applescript aus, und habe es auch schon geschafft darüber automatisch einen Kalendereintrag erstellen zu lassen.

Nur am nächsten Schritt scheitere ich, und finde auch nirgends im Netz etwas dazu: Das Event dann als Attachment an die Mail zu hängen. Ich packe hier mal eine stark verkürzte Version des Scripts rein. So geht es nicht, das ist klar, aber hat jemand eine Idee, wie ich das Event an Mail weitergereicht bekomme? Mäuschen?

tell application "iCal"
tell calendar "Aufnahmetermine"
set Starttermin to date "Mittwoch, 7. März 2012 00:00:00"
set Kalendereintrag to make new event at end with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:Starttermin, allday event:false}
end tell
end tell


tell application "Mail"
activate
set Nachricht to "Testtext"
set newMessage to make new outgoing message with properties {subject:"Test", content:Nachricht, visible:true}
tell newMessage
make new to recipient at end of to recipients with properties {address:"test@test.com"}
end tell
tell content of newMessage
make new attachment Kalendereintrag at after last paragraph
end tell
end tell
0

Kommentare

Oli
Oli06.03.1216:56
Keiner eine Idee? Das iCal-Scripting treibt mich noch zum Wahnsinn , seit Stunden komme ich keinen Schritt weiter...
0
_mäuschen
_mäuschen06.03.1216:57


tell application "iCal"
tell calendar "Aufnahmetermine"
set Starttermin to date "Samstag, 10. März 2012 00:00:00"
make new event at beginning with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:Starttermin, allday event:true}
set eventUID to uid of last event
end tell
end tell

delay 2
set sc to "find -f ~/Library/Calendars/ \\( -path \"*.calendar/Events/" & eventUID & ".ics\" \\)"
set icsPOSIXPath to paragraphs of (do shell script sc)

set subjectLine to "Test"
set messageText to "Nachricht"
set myrecipient to "test@test.com"
set myrecipientname to "test"
set theSender to "Joe"
set invitationPath to item 1 of icsPOSIXPath

set pfile to POSIX file invitationPath
set myfile to pfile as alias
tell application "Mail"
activate
set mymail to make new outgoing message with properties {subject:subjectLine, content:messageText & return & return}
tell mymail
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties {name:myrecipientname, address:myrecipient}
tell content
make new attachment with properties {file name:myfile} at after the last paragraph
end tell
end tell
send mymail
end tell


0
Oli
Oli06.03.1217:16
Wow! Mir ist es echt ein Rätsel, aus welchem Hut du so was immer hervorzauberst! Tausend Dank, und falls ich mich irgend wie mal revanchieren kann, dann lass es mich wissen!
0
_mäuschen
_mäuschen06.03.1217:21
0
Oli
Oli06.03.1217:49
Dann zeig ich dir mal mich bei der Arbeit. Ausversehen hab ich wohl den ganzen Tag lang die falsche Suchmaschine verwendet...
0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.