Make Team Calendars Macro

This is a macro I use to add calendar entries into the OS X calendar for the fixtures from Fox Sporting Plus fixture lists.

It has no trigger since it's designed to just paste in the fixtures, select all the action and then Try the macro. Since this only happens at the start of each season I haven't bothered to give it an explicit trigger.

The macro has a few Search&Replace actions to simplify the location names (eg Court 3 because C3, and Striker Leeming becomes Leeming).

The AppleScript at the end specifies the calendar to put the event in as well as the name of the team.

Make Team Calendars.kmmacros (6.7 KB)

1 Like

This is just the sort of thing I need -- but while it runs I dont get any events.
I changed the Calendar from "Teams" to be one I have.
And on the the AppleScript command I asked it to show results. This gives me one message per row (I cut it back to 2 rows for testing):

display alarm 1 of event id F5A71759-4A40-4D3E-B1D7-AD53D8A8CB44 of calendar id D4ABC3E7-529D-43AC-9795-5E69F29BA727

So it makes me think something has been created, but when I look on the dates, or even search for "MyTeam" I find nothing. I've restarted Calendar. Nada.

I'm on Mojave with KM 8.2.4

Any clues ??


The AppleScript is fairly straight forward.

Check the values of the variables: Date, Time, Vs, Location.

Copy it in to Script Editor, and replace the system attribute "KMVAR_Whatever" with the values from the variable and run it and see if it gets the right result and if the entry appears.

Also, in Calendar, do a search for the team name and see what you find - if the dates are confused, maybe it is adding all the calendar entries to some time in 2001 or something like that.

In Script Editor, run the command:

properties of event id "F5A71759-4A40-4D3E-B1D7-AD53D8A8CB44"

to see what the properties of the created event are.

set ds to (system attribute "KMVAR_Date") & " " & (system attribute "KMVAR_Time")
set v to system attribute "KMVAR_Vs"
set l to system attribute "KMVAR_Location"

set d to date ds
tell application "Calendar"
	tell calendar "Team"
		set newEvent to make new event at end with properties {summary:"MyTeam v " & v, location:l, start date:d, end date:d + 60 * minutes, allday event:false}
		tell newEvent
			set theAlarm to make new display alarm at end with properties {trigger interval:-60}
		end tell
	end tell
end tell

Thanks for your help -- it turned out that I had two calendars with the same name - one on my Mac, and one in iCloud...! The events were going into the former, which was set to invisible, and I was looking in the latter.

1 Like