Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Sync subscribed calendars to the iPhone via MobileMe' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Sync subscribed calendars to the iPhone via MobileMe
Authored by: Supp0rtLinux on Jul 17, '08 09:45:43AM

Sounds like this is begging for an automator script to run through each Subscribed calendar, do the export/import/uncheck thingy. Then, the automator script could be dropped into Lingon and set to run hourly, daily, etc...

Or... Apple could just add the support back in. :)



[ Reply to This | # ]
Sync subscribed calendars to the iPhone via MobileMe
Authored by: mattarino on Jul 17, '08 02:22:19PM
I do have an automator workflow created that does move the events of subscribed calendars into a separate calendar that can be synced with MobileMe. I'm not a programmer so I searched and found a suite of iCal automator actions here:
http://automatorworld.com/archives/yellow-camp-ical-actions/

First, create your catch-all calendar in iCal that will receive the new events and that will be synced with MobileMe.
Then, from automator, the process will go like this:
1. "Launch Application" (under Finder) and select iCal
2. "Get Specified iCal Items" (choose the subscribed calendar with events you want to move)
3. "Move iCal Events" (this is the script from the downloaded actions that you will need) and select your new catch-all calendar.

This process will move all events from the subscribed calendars to the calendar that you sync. The only caveat is that all of the events from the subscribed calendars will be temporarily deleted (since they were moved). They will show back up once those calendars are refreshed, so make sure that you have them set to auto-refresh.

I was worried about duplication of events since the intent is to keep the synced calendar updated and this process would be repeated. Thankfully, that doesn't seem to be the case.

My next step was going to be figuring out how to automate this at specific intervals, then I saw "Lingon" mentioned. I don't have any knowledge of that program. Any thoughts/steps/solutions on automation of the automator workflow?

[ Reply to This | # ]
Sync subscribed calendars to the iPhone via MobileMe
Authored by: dethbunny on Jul 17, '08 09:32:01PM
I wrote a script along these lines to gather my schedule together with my wife's for work. Find it below. There are a few things you should know first, though:

1) This script is rather unsafe, in that it purges the destination calendar before re-populating it with events. Make sure that you're creating a new calendar to use as the destination or you WILL lose data.

2) Repeating events that started before the cutoff date (9 days ago in the example) will not be copied. For me, this isn't a problem. If it is for you, consider setting a cutoff date far enough back to include the repeating event.

3) It's slow, but it works. Don't let me understate how slow it is - prepare for a few minutes of event copying if your calendar is anything like mine. If you know how to improve it let me know.

4) You can schedule this script to run pretty easily by creating a repeating event in iCal with the script as an alarm. Set the event to run once a day, once a week, or whatever makes sense to you. With (3) in mind, you may want to schedule it when you won't be using the computer, or just run it manually when there are changes.
-- iCal Duplicator 2.0
--
-- MobileMe Push Sync with iCal does not currently support susbcribed calendars.  This has disappointed some like
-- myself, who rely extensively on subscribed calendars.  This kludgy solution copies events from a subscribed calendar
-- to a local calendar.  Set your calendar names in the script, then run the script on a weekly/daily basis or manually to
-- update your local copy/copies based on the subscribed calendar.
--
-- Support for copying from multiple calendars has been added.  You'll need to enter the source and destination names as
-- pairs. If you want multiple subscribed calendars copied into one local calendar, you can enter the local calendar names
-- multiple times as I have for the "Combined - Local" calendar.
--
--
-- Christian Lindemer, July 15th, 2008  {macosxhints (a) dethbunny (.) net}

-- **** **** **** Edit values to match actual calendar names **** **** ****
-- The subscribed calendars
property sourceCalendarNames : {"Work", "Second Calendar", "Third"}
-- The blank local calendar(s) to copy in to, in the same order as the source calendars
property destinationCalendarNames : {"Work - Local", "Combined - Local", "Combined - Local"}
-- how many days to go back - the more you add, the slower the script runs.
property oldEntryDays : 9
-- **** **** **** **** **** **** **** **** **** **** **** **** ****

on run
	--make sure we have valid names.
	try
		tell application "iCal"
			repeat with testName in sourceCalendarNames
				--this throws an error if there is no calendar with the given name, thus checking the calendar's validity.
				set testCal to (the first calendar whose title is the testName)
			end repeat
			repeat with testName in destinationCalendarNames
				set testCal to (the first calendar whose title is the testName)
			end repeat
		end tell
	on error
		--if a name can't be found, alert user and halt.
		calendarNotFound(testName)
		return --this effectively quits the script
	end try
	
	
	repeat with destName in destinationCalendarNames
		clearEvents(destName)
	end repeat
	
	
	set calendarCount to 1
	--repeat through all calendar names
	repeat with sourceName in sourceCalendarNames
		--get the calendar names and pass them to the copyEvents function
		set destinationName to item calendarCount of destinationCalendarNames
		copyEvents(sourceName, destinationName)
		set calendarCount to (calendarCount + 1)
	end repeat --repeat through all calendar pairs
	
end run

on calendarNotFound(notFoundName)
	display alert "Calendar named "" & notFoundName & "" was not found in iCal.  Please edit the script to match your calendars."
end calendarNotFound

on clearEvents(destCalName)
	tell application "iCal"
		--Clear the destination calendar	
		set destCalendar to (the first calendar whose title is the destCalName)
		set calendarEvents to (events of destCalendar) -- get the destination calendar's event list
		repeat with myEvent in calendarEvents -- delete each existing event
			delete myEvent
		end repeat
	end tell
end clearEvents

on copyEvents(sourceCalName, destCalName)
	tell application "iCal"
		set sourceCalendar to (the first calendar whose title is the sourceCalName)
		set destCalendar to (the first calendar whose title is the destCalName)
		
		set calendarEvents to (events of sourceCalendar) -- get the calendar's event list
		repeat with myEvent in calendarEvents -- repeat for each item found in the source event list
			
			--Don't bother with old events
			if start date of myEvent > ((current date) - oldEntryDays * days) then --event is in future, or within prefs for old entries
				-- gather relevant details of event to create new event with
				set eventStart to start date of myEvent
				set eventEnd to end date of myEvent
				set eventAllDay to allday event of myEvent
				set eventSummary to summary of myEvent
				-- create event in destination calendar with details of subscribed event
				tell destCalendar
					make new event at end with properties {summary:eventSummary, start date:eventStart, end date:eventEnd, allday event:eventAllDay}
				end tell
			end if --if not older than 'oldEntryDays' days ago
		end repeat --iterate through entries in source calendar
	end tell
	
end copyEvents


[ Reply to This | # ]
Sync subscribed calendars to the iPhone via MobileMe
Authored by: thehigherlife on Jul 21, '08 06:59:57AM

this line doesn't compile. it doesn't like the quotation marks. i also only have one subscribed calendar i'm syncing.

display alert "Calendar named "" & notFoundName & "" was not found in iCal. Please edit the script to match your calendars."



[ Reply to This | # ]
Sync subscribed calendars to the iPhone via MobileMe
Authored by: clp698 on Jul 21, '08 06:04:54AM

I have found a better way by creating an Automator work flow that copies the data from the subscribed calendars into local calendars at specific times every day by creating an Automator plugin alarm into iCal.



[ Reply to This | # ]
Sync subscribed calendars to the iPhone via MobileMe
Authored by: itower on Nov 20, '08 06:16:40AM

really? sounds ideal, clp - how did you achieve this??



[ Reply to This | # ]