Having now fixed an AppleScript to add events to Calendar.app that stopped working following an update to Catalina. (AppleScripts to add Calendar event not working in Catalina? - #9 by justal) I’m now trying to get another script that also stopped working under Catalina.
This one is supposed to delete alarms from a Calendar event (amongst other things). All seem to be working with it except for the bit that delete the alarms. I’ve set up a test script in Script Editor to try to work out where the issue lies. The script looks like this:
tell application "Mail"
set invoicenumber to "94"
my removeAlarm(invoicenumber)
end tell
-- Remove Alarm from specified calendar event.
on removeAlarm(invoicenumber)
set receiptdate to current date
tell application "Calendar"
tell calendar ("Invoices")
set thisevent to first event where its summary = "Check Invoice #" & invoicenumber
set description of thisevent to description of thisevent & return & "Paid: " & receiptdate
delay 10
tell thisevent
delete mail alarms of thisevent
delay 10
delete sound alarms of thisevent
end tell
end tell
end tell
end removeAlarm
When I run it I get the following error:
error “Calendar got an error: AppleEvent handler failed.” number -10000
The line highlighted in the script is:
delete mail alarms of thisevent
Can anyone see what is wrong with that line? has the syntax for deleting mail alarms changed in Catalina?
Note: It was all working perfectly in High Sierra.
Thanks,
Alan.