J'ai déjà fais cela. Réglages Système > Confidentialité et sécurité > Calendriers et j'ai autoriser mon script dedans. Voici le script:
tell application "Calendar"
-- Obtenir la date actuelle
set currentDateiMac to current date
-- Obtenir la date de fin (7 jours plus tard)
set endDate to currentDateiMac + (7 * days)
-- Récupérer tous les calendriers
--set allCalendars to calendars
-- Créer une liste pour stocker les rendez-vous
set appointmentList to ""
-- Parcourir tous les calendriers
repeat with currentCalendar in calendars
-- Récupérer les événements entre aujourd'hui et dans 7 jours
set theEvents to (events of currentCalendar whose start date is greater than or equal to currentDateiMac and (start date is less than or equal to endDate))
set detecteEvents to false
-- Ajouter le nom du calendrier s'il contient des événements
if (count of theEvents) > 0 then
set appointmentList to appointmentList & "Calendrier: " & name of currentCalendar & return
-- Parcourir tous les événements de ce calendrier
repeat with theEvent in theEvents
if detecteEvents is false then
set eventStart to start date of theEvent
set eventSummary to summary of theEvent
if eventSummary is "Christian ****" or eventSummary is "Silvia ****" then
set detecteEvents to true
set leNom to eventSummary
-- Formater la date et l'heure
set eventDateString to (day of eventStart as string) & "/" & (month of eventStart as integer as string) & "/" & (year of eventStart as string)
set eventTimeString to (hours of eventStart as string) & "... " & (minutes of eventStart as string)
-- Ajouter l'événement à la liste
set appointmentList to appointmentList & " • " & eventDateString & " à " & eventTimeString & " - " & eventSummary & return
-- Ajouter le lieu si disponible
if location of theEvent is not "" then
set appointmentList to appointmentList & " Lieu: " & location of theEvent & return
set leLieu to location of theEvent
end if
end if --if eventSummary is "Christian **" or eventSummary is "sisiva ******" then
end if --if detecteEvents is false then
end repeat
set appointmentList to appointmentList & return
end if
end repeat
-- Afficher les rendez-vous
if appointmentList is not "" then
say "Manuel"
if heureAujourdhui as string is day of eventStart as string then
say "tu as un rendez-vous aujourd'hui"
else
say "tu as un rendez-vous cette semaine"
say "le " & day of eventStart as string
end if
say "avec" & leNom
say "à " & (hours of eventStart as string) & "... " & (minutes of eventStart as string)
say "la locaton " & leLieu
end if --if appointmentList is not "" then
end tell -- tell application "Calendar"
on error errorMessage
tell application "System Events"
tell process "System Preferences"
activate
end tell
end tell
Et j'ai même mis ce script dans un endroit que je ne trouve plus. Cet endroit permet une autre autorisation de son utilisation.... Mais il a toujours le message. This script needs access to calendars to run.... Merci à vous....
[Modifié par l’Hôte]