Sync calendars to an older iPod

Dec 17, '12 07:30:00AM

Contributed by: chrischram

I have a perfectly serviceable 5th generation iPod nano (2009-2010). Unfortunately, every time a new major version of iTunes is released, this iPod loses part of its usability.

In an earlier hint, I showed one way to restore the ability to sync Contacts. With the release of iTunes 11, Apple has also removed the ability to sync Calendars. Under the Info tab for my nano, I now see these incorrect and misleading messages:

"No contacts are available on this computer."
"No calendars are available on this computer."

Here are two ways to remedy that situation. In Calendar, select a calendar in the sidebar, then choose File > Export > Export... and direct the output to the Calendars folder on your older iPod. Repeat this operation for all the calendars you wish to export. (File > Export > Calendar Archive... also works, but on the iPod, all events will appear under All Calendars. If you have a lot of calendars or a lot of events, this option may make it hard to navigate through.)

I tried several ways to create an AppleScript to automate the above procedure, but it turns out that Calendar is not scriptable enough to get the desired result. The script below produces an .ics file for each calendar in the sidebar, but on the iPod everything still appears under All Calendars. It would take a "real programmer" to recreate the proper export format that the manual method produces.

-- set ipodCalPath to "/Calendars/"
-- for instance:
set ipodCalPath to "/Volumes/Chris Schram’s iPod/Calendars/"

tell application "Calendar"
	
	try
		do shell script ("rm -rf " & (quoted form of ipodCalPath) & "*")
	end try
	
	delay 5 -- so Calendar is fully launched and shell script is finished
	
	set allCals to calendars
	repeat with oneCal in allCals
		set thisName to name of oneCal & ".ics"
		set thisUID to uid of oneCal
		set thisPath to (do shell script "find ~/Library/Calendars -maxdepth 2 -name " & thisUID & ".calendar") & "/Events"
		set newPath to quoted form of (ipodCalPath & thisName)
		try
			do shell script ("cat " & thisPath & "/*.ics > " & newPath)
		on error
			do shell script ("cp -rf " & thisPath & " " & newPath)
		end try
	end repeat -- with oneCal in allCals
	
	say "done exporting calendars"
	-- quit -- application "Calendar" (Optional; you choose)
	
end tell -- application "Calendar"

Comments (1)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20121214081638895