Nach kurzem testen scheint unter Android die Datei zu funktionieren wenn man dies .vcs nennt anstelle von .ics. (der vCalendar standard scheint entgegen der Informationen im Internet nicht zu funktionieren)
Kurzum, am einfachsten setzen sie die termine.ics nocmal mit anderem Namen (termine.vcs) in die Email. Ich kann aber nicht versprechen das das auf allen Android Geräten funktioniert. Wir haben Glück das wir ein Gerät in der Firma hatten.
So würde dann das Skript aussehen (orange sind die änderungen zum derzeitigen Skript):
set someText to "$[patientenTermineICALFormat]$"
set textFile to POSIX file "/tmp/termine.ics"
my write_to_file(someText, textFile, false)
set someText to "$[patientenTermineICALFormat]$"
set textFile2 to POSIX file "/tmp/termine_test.vcs"
my write_to_file(someText, textFile2, false)
set theAttachment to textFile
set theAttachment2 to textFile2
set theSubject to "Vorsorgeuntersuchung $[bn]$"
set theAddress to "$[pemail]$"
set theContent to "$[anrede]$,
Ihre letzte Vorsorgeuntersuchung liegt nun ein Jahr zurück. Gern können Sie telefonisch oder online auf unserer Praxiswebseite einen neuen Termin vereinbaren.
Mit freundlichen Grüßen,
$[arztname]$
$[fusszeile]$
"
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}
if the length of someText > 0 then
try
make new attachment with properties {file name:theAttachment} at after the last word of the last paragraph
set message_attachment to 0
make new attachment with properties {file name:theAttachment2} at after the last word of the last paragraph
set message_attachment to 1
on error errmess -- oops
log errmess -- log the error
set message_attachment to 1
end try
log "message_attachment = " & message_attachment
else
display dialog "Patient hat keine Termine"
end if
end tell
end tell
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