Jag får inte scriptet som bara väljer family till att fungera. Det fungerar superbra fram tills jag lägger till (every group). Då får jag felmeddelande om att det inte hittar födelsedagar på repsektive personer.
Kommenterar som gäst
property tDate : current date
-- These are the groups of a person that will have an alarm attached to their reminder
property alarmGroups : {"Family", "Friends"}
-- This is the name of the calendar in which the dates should be added
property calName : "Dagar"
-- First, lets empty the calendar
tell application "iCal"
delete every event of (item 1 of (calendars whose title is "Dagar"))
end tell
tell application "Address Book"
set theList to every person
repeat with i in theList
if exists birth date of i then
set myName to name of i
set myDate to birth date of i
set age to (year of tDate) - (year of myDate)
set mylabel to myName & " " & age & " år"
set willAlarm to false
set tGroups to name of every group of i
repeat with g in alarmGroups
if g is in tGroups then
set willAlarm to true
end if
end repeat
my insertBirthday(mylabel, myDate, willAlarm)
end if
set cDates to custom dates of i
repeat with c in cDates
set myDate to value of c
set yearCount to (year of tDate) - (year of myDate)
set mylabel to "År " & yearCount & ": " & myName & ", " & label of c
my insertBirthday(mylabel, myDate, true)
end repeat
end repeat
end tell
on insertBirthday(Label, myDate, willAlarm)
tell application "iCal"
set startDate to tDate
set month of startDate to month of myDate
set day of startDate to day of myDate
set time of startDate to 0
set stampDate to startDate - 432000
set endDate to startDate + 86400
set tCal to (item 1 of (calendars whose title is "Dagar"))
set theEvent to make new event at the end of events of tCal with properties {start date:startDate, end date:endDate, summary:Label, allday event:true}
if willAlarm is true then
set nAlarm to make new display alarm at the end of display alarms of theEvent with properties {trigger interval:-3600}
set nAlarm to make new display alarm at the end of display alarms of theEvent with properties {trigger interval:480}
end if
end tell
end insertBirthday set theList to every personset theList to every person of (every group whose name is "Family")set theList to every person
Till detta (och byter ut "Family" mot gruppen du skapat med alla vars födelsedagar du vill ha in i kalendern):set theGroup to item 1 of (every group whose name is "Family")
set theList to every person of theGroup