El Capitan and Calendar's script

Hi all,
I’m disperately trying to run the
following trite script but it fails.
I’m going crazy…

tell application “Calendar”
set MyCalendar to (the first calendar whose name is “Ronald”)
tell MyCalendar
set allEvents to (every event of MyCalendar)
set totalEvents to count allEvents
display dialog "Total Events = " & totalEvents
end tell
end tell

Any idea ?

Gianni

Here, your script behaves flawlessly.

Here is the events log I got :

tell application "Calendar"
	get calendar 1 whose name = "Work"
	get every event of calendar id "15796FB4-0796-43DD-ACD4-C41067C1012D"
end tell
tell application "Script Editor"
	display dialog "Total Events = 1"
end tell
Résultat :
{button returned:"OK"}

It would be helpful to tell exactly what is the issued error message.
Writing : “I’m disperately trying to run the following trite script but it fails.” give absolutely no info about what you get and, as far as I know, there is no sooth sayer here.

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) jeudi 3 décembre 2015 15:06:24

If you really want help, it would be useful to give us the exact error message which you got !

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) vendredi 4 décembre 2015 17:07:53