Ich habe da mal was vorbereitet.
In der version v1.48.1.0 gibt es ein neues Briefschreibungskommando. Das heisst: $[patientenTermineICALFormat]$
Damit bekommt man alle Anstehenden Termine des Patienten als ics-Format, wleches man in eine Datei schreiben kann.
Mit diesem Applescript kann man dann den Inhalt an eine Email hängen. (achtung, der Emailinhalt muss dann noch angepasst werden)
set someText to "$[patientenTermineICALFormat]$"
set textFile to POSIX file "/tmp/termine.ics"
my write_to_file(someText, textFile, false)
set theAttachment to textFile
set theSubject to "Vorsorgeuntersuchung $[bn]$"
set theAddress to "$[pemail]$"
set theContent to "$[anrede]$,
hier ihr Termin!
Mit freundlichen Grüßen,
$[arztname]$
$[fusszeile]$
"
if theAddress as string is not equal to "" then
tell application "Mail"
activate
set theNewMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:theAddress}
try
make new attachment with properties {file name:theAttachment} at after the last word of the last paragraph
set message_attachment to 0
on error errmess -- oops
log errmess -- log the error
set message_attachment to 1
end try
log "message_attachment = " & message_attachment
end tell
end tell
end if
on add_leading_zeros(this_number, max_leading_zeros)
return text (max_leading_zeros * -1) thru -1 of ("00000000000000000" & this_number)
end add_leading_zeros
on write_to_file(this_data, target_file, append_data)
-- set theFolder to POSIX file "/Users/mth/Desktop/"
set theFolder to my getParentPath(target_file)
try
alias theFolder
on error
display dialog "Folder does not exist"
end try
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
on getParentPath(myPath)
set oldDelimiters to AppleScript's text item delimiters -- always preserve original delimiters
set AppleScript's text item delimiters to {":"}
set pathItems to text items of (myPath as text)
if last item of pathItems is "" then set pathItems to items 1 thru -2 of pathItems -- its a folder
set parentPath to ((reverse of the rest of reverse of pathItems) as string) & ":"
set AppleScript's text item delimiters to oldDelimiters -- always restore original delimiters
return parentPath
end getParentPath