Well. You said earlier that your iPad/iPhone doesn’t support more than two alarms (presumably per event), so it would have to be multiple events. I’ve modified my earlier script to create the events using just one repeat loop and to add immediate alarms to all but the first:
on getInput(thePrompt)
repeat
tell application (path to frontmost application as text)
set inputText to text returned of (display dialog thePrompt default answer "" default button 2)
end tell
if ((count inputText) > 0) or (thePrompt contains "optional") then exit repeat
end repeat
return inputText
end getInput
to addMonths(oldDate, m) -- Parameters: (date, positive or negative integer)
copy oldDate to newDate
set {y, m} to {m div 12, m mod 12}
if (m < 0) then set {y, m} to {y - 1, m + 12}
set newDate's year to (newDate's year) + y
set d to oldDate's day
if (m > 0) then tell newDate + (32 * m - d) * days to set newDate to it + (d - (its day)) * days
if (newDate's day is not d) then set newDate to newDate - (newDate's day) * days
return newDate
end addMonths
on main()
set summaryText to getInput("What do you want to call the new events?")
set locationText to getInput("Enter the location (optional):")
set noteText to getInput("What do you want to put in the note?")
set theCurrentDate to (current date)
set repeatDates to {theCurrentDate + 10 * minutes, theCurrentDate + hours, theCurrentDate + days, theCurrentDate + weeks, addMonths(theCurrentDate, 3), addMonths(theCurrentDate, 6), addMonths(theCurrentDate, 12)}
tell application "iCal"
tell calendar "Memorize"
make new event at end with properties {description:noteText, summary:summaryText, location:locationText, start date:theCurrentDate, end date:theCurrentDate + 10 * minutes} -- No alarm on the first event.
repeat with r in repeatDates
(make new event at end with properties {description:noteText, summary:summaryText, location:locationText, start date:r, end date:r + 10 * minutes})
make new sound alarm at end of result with properties {trigger interval:0, sound name:"Submarine"}
end repeat
end tell
end tell
end main
main()
Mind you, the multiple-alarm approach works on real computers (;)) and looks like this:
on getInput(thePrompt)
repeat
tell application (path to frontmost application as text)
set inputText to text returned of (display dialog thePrompt default answer "" default button 2)
end tell
if ((count inputText) > 0) or (thePrompt contains "optional") then exit repeat
end repeat
return inputText
end getInput
to addMonths(oldDate, m) -- Parameters: (date, positive or negative integer)
copy oldDate to newDate
set {y, m} to {m div 12, m mod 12}
if (m < 0) then set {y, m} to {y - 1, m + 12}
set newDate's year to (newDate's year) + y
set d to oldDate's day
if (m > 0) then tell newDate + (32 * m - d) * days to set newDate to it + (d - (its day)) * days
if (newDate's day is not d) then set newDate to newDate - (newDate's day) * days
return newDate
end addMonths
on main()
set summaryText to getInput("What do you want to call the new event?")
set locationText to getInput("Enter the location (optional):")
set noteText to getInput("What do you want to put in the note?")
set theCurrentDate to (current date)
set triggerIntervals to {10 * minutes, hours, days, weeks, addMonths(theCurrentDate, 3) - theCurrentDate, addMonths(theCurrentDate, 6) - theCurrentDate, addMonths(theCurrentDate, 12) - theCurrentDate} -- Alarm trigger intervals in seconds.
tell application "iCal"
tell calendar "Memorize"
set newEvent to (make new event at end with properties {description:noteText, summary:summaryText, location:locationText, start date:theCurrentDate, end date:theCurrentDate + 10 * minutes})
repeat with t in triggerIntervals
make new sound alarm at end of newEvent with properties {trigger interval:t div minutes, sound name:"Submarine"}
end repeat
end tell
end tell
end main
main()