Archive for the ‘Google Calendar’ Category

With the holiday season upon us, I got a few Evites that broke my Greasemonkey script to add Evite invitations to your Google Calendar. I went through and cleaned up the code a bit, and I think it’ll work a bit better now.

You’ll find the “Add to Google Calendar” link next to the Print link on most invites.

Evite2GoogleCal.user.js v1.2

There’s lots of little things that, if tweaked, would just make life a lot nicer . . .

For instance . . .

The Google Calendar sync tool should support syncing Outlook to secondary Google Calendars, not just your primary calendar. That would mean I could drop SyncMyCal which runs in my Outlook-only Parallels Virtual Machine. I’d have a nifty, no-click workflow to sync my Work calendar to my secondary Work Google Calendar, which get sync’d down to iCal and to my iPhone.

Better yet . . .

The iPhone should support syncing both iCal and Outlook calendars. It’s sort of a dumb thing that if you turn on Outlook calendar and contact syncing, that’s the *only* calendars and contacts you get. Why not keep them separate? If Apple added the ability to have your Outlook calendar sit right along side your iCal calendars, then I wouldn’t even need to sync my Work calendar up. I could just accept meeting invites on my phone and have everything work nice and happy.

Oh, and same goes for Contacts. Just let me sync my Exchange contacts as a separate group. Seriously.

Even better . . .

Apple Mail and iCal should build in real Exchange support. Then I could actually not run Outlook in my virtual machine all day. Instead, I could just use Mail and iCal as Exchange clients and have the most simplified workflow of all. Supposedly, this is going to happen in Snow Leopard. That would be awesome.

Making life even sweeter . . .

Google should fix contact management. I love Gmail. I use it for everything. I hate Google’s Contact stuff. It is awful. They tried to make it better. It didn’t work very well. But they’ve got the keys right in their hands … Social Graph. Imagine you gave Google some information about you that they could use some OAuth or other authentication means to determine that it is really you. So you hand them some keys to Flickr and Twitter and (if they can work out their differences), Facebook. Now, Google pulls all that information together and makes a nifty contact for you. Name, picture, email address, home address, work address, phone number, Twitter, Flickr, etc, etc. You only get as much information as the contact allows (if we’re not friends on Facebook, you don’t get my phone # or address).

Now, Google can do all this behind the scenes and give you a little button to “add so-and-so” as a contact. If I add them, they go into my Contacts section. Then, I subscribe to my Google Contacts like they’re an LDAP source or however else they want to get hooked into your setup.

Boom. All of a sudden I’ve got a real contact solution that’s continually updated.

Ok, sure, that’s a lot like what Plaxo promises. Except Plaxo really doesn’t work all that well.

So. When all this happens, I’ll have my calendars all seamlessly syncing together to my computer and to my phone. On top of that, my contacts (work and personal) will all sync nicely as well. And stay up-to-date, thanks to something like Social Graph or the like. Plus, Snow Leopard will mean I don’t have to run a Virtual Machine just to use Outlook (and don’t tell me to use Entourage … it barely works).

With my work life (and personal contacts) working so seamlessly . . .

I’ve got time to kill. I want to get through some movies or TV while I’m out and about.

Give me Netflix Watch Instantly and Hulu on my iPhone! Now that they’re on my XBox and Mac, I’d love them remotely. When I’m out eating lunch or riding in a car, I don’t need HD video. I just need crappy streaming video that will let me knock off an old episode of Newsradio or watch 15 minutes of a crappy movie.

But, if I don’t want to watch something . . .

Sometimes I just want to listen. The fact that the new version of the iPhone firmware lets you download podcasts is great. By why doesn’t it sync my entire podcast list and let me just quickly scan for a new episode of something I listen to? Even better, why not do something similar to Genius and recommend me a podcast I might like?

All that would be very cool.

Oh, and why can’t I sync stuff over bluetooth. That would be good too.

So, Google announced recently that it would support CalDAV syncing with iCal, which means if you update an entry in iCal (or Google Calendar), they’ll be in sync within a few minutes. Awesome.

Unfortunately, it meant that my previous script iteration would now continually add alarms, leading to each entry having 3 or 4 alarms. Turns out that updating a local iCal calendar and adding an alarm actually updates that same info at GCal. Which is awesome (but was unexpected).

So, I made a small tweak to the script, which makes it run a bit faster and makes sure that you only get one alarm on an entry:

Try this instead:

tell application "iCal"
  set theCalendars to {"Cal1", "Cal2"}
  repeat with theCurrentValue in theCalendars
	tell calendar theCurrentValue
	  set theEvents to every event
	  repeat with theCurrentEvent in theEvents
	    tell theCurrentEvent
	      if not (exists sound alarm of theCurrentEvent) then
		   make new sound alarm at end /
		   with properties {trigger interval:-15}
		  end if
	    end tell
	  end repeat
	end tell
  end repeat
end tell

That basically means it won’t add another sound alarm if the entry already has one. Much handier. In fact, you could just take that script and have it run every few hours (either cron’d or via iCal), and not have to worry about the iTunes Sync script.

My biggest gripe with the iPhone thus far has really been a gripe with iCal. Namely, that there’s not an easy way to add alarms to subscribed calendars. I know that sounds like a silly gripe, but let me set the stage.

My main calendaring info is in Google Calendar, like a lot of folks. This is great because I can access my calendar from anywhere, on any computer, most cell phones, etc. It gives me a central way to maintain a calendar and have access to it pretty much all the time. I subscribe to my Google Calendar in iCal on my Mac, which gives me native calendaring (one-way, at least) that’s always up-to-date with the data in the Google cloud. It’s nice.

Taking it one step further, I use SyncMyCal to push my Outlook calendar to my Google Calendar as well. (I would use the normal Google Calendar Sync application, but it only syncs with the primary calendar, and I’d rather keep my personal calendar and work calendar separate.) So, every day, before I leave the office, I click a little sync button and it pushes my Outlook info up to Google Calendar. Again, one-way sync, but it’s one-way from my primary source, so I’m not worried about it.

That means I’ve got my personal and work calendars all centrally located on Google Calendar, accessible from pretty much anywhere. Including my primary machine of my Mac, where iCal subscribes to all of my various calendars. It’s a wonderful system.

Except one thing. iCal doesn’t allow you to set alarms on subscribed calendars. At least not through the interface. That makes this wonderful sync system decidedly less useful. See, between my MacBook and my iPhone, I’m pretty much covered. One is with me most of the time. If I had alarms on my calendars, then I’d pretty much have a perfect setup.

It worked incredibly well with my Motorola Q (and The Missing Sync from Mark/Space), which would import all of the calendar items from iCal, and set default alarms on them on the Q. Beautiful.

Not so much on the iPhone. For a couple of months, I’ve just dealt with the fact that using Google Calendar put me in the middle of the two supported options: using iCal and using Exchange (which became available with the 2.0 firmware). I could see the calendar events on my iPhone, but they were never going to make that nice “bleep bleep” sound and let me know that I had a meeting or I had to be somewhere in a few minutes. It’s something I had taken for granted with previous smartphones, but just chalked up to a deficiency in the early years of the iPhone.

Except I finally got fed up enough to do some digging into AppleScript and found some pointers to adding an alarm to an event. I figured why not give it a shot on subscribed calendars? Maybe I could add some alarms to my subscribed calendars?

After poking around and playing with AppleScript (something brand new to me, I got this working):

tell application "iCal"
	set theCalendars to {"Subscribed 1", "Subscribed 2"}
	repeat with theCurrentValue in theCalendars
		tell calendar theCurrentValue
			set theEvents to every event
			repeat with theCurrentEvent in theEvents
				tell theCurrentEvent
					make new sound alarm at end with properties {trigger interval:-15}
				end tell
			end repeat
		end tell
	end repeat
end tell

Basically, we grab our two subscribed calendars (those are placeholder names, replace with your own subscribed calendar names), go through each entry and add a sound alarm 15 minutes before the event. It takes maybe 10 or 15 seconds to go through both of my calendars, but lo! I end up with alarms both in iCal and on the iPhone!

Bingo. Exactly what I need. I’m sure there’s something more elegant, but this worked for me.

The next issue, of course, was a “race condition” of sorts. My calendars update themselves periodically. If they updated before I sync with my iPhone, the alarms would be gone. How could I resolve that?

How about another AppleScript? I did a bit more googling, and of course, there’s a nice way to sync your iPhone (or iPod), via AppleScript. Why not combine both scripts and drop it into the iTunes script directory? That’s a brilliant idea!

tell application "iCal"
	set theCalendars to {"Sub1", "Sub2"}
	repeat with theCurrentValue in theCalendars
		tell calendar theCurrentValue
			set theEvents to every event
			repeat with theCurrentEvent in theEvents
				tell theCurrentEvent
					make new sound alarm at end with properties {trigger interval:-15}
				end tell
			end repeat
		end tell
	end repeat
end tell

tell application "iTunes"
	repeat with s in sources
		if (kind of s is iPod) then update s
	end repeat
end tell

Now, when I’m about to leave the house, I just do this:

iTunes Sync

That’s it. All of my calendar items, from Google Calendar, sync’d to my iPhone with alarms. It’s a beautiful thing.

And I wish nothing more than for iCal to render it useless my having a “add default alarm to subscribed calendar” checkbox.

Hey, I made a small revision to my Greasemonkey script that makes it smarter about handling time (particularly AM/PM).

It’s updated here and updated on Userscripts, where I’m up to like 566 installs! I’m a hit! Or something. And I’m like the 4th link in Google if you search for “google calendar evite!”

If you’ve got Greasemonkey, install your Evite to Google Calendar script right from here.