Connecting Google Hangouts to OSX Calendar

For the last year I’ve basically given up on the OSX Calendar App and been using the Google Calendar website in a Pinned Tab in Chrome. Although I still keep OSX Calendar synced and up to date, it became a real problem that it didn’t support Google Hangouts invitations. As such, I found myself having to manually open Google Calendar before each meeting, hunting down the meeting and then joining the hangout. I basically had given up on ever finding a solution, but today Google finally won out.

On StackOverflow I found a similar individual with this problem, and someone posted a clever combination of automator, shell scripts, and AppleScript that makes it possible. It’s not perfect, but now I can drag events from OSX Calendar to a little icon in my dock that reprocesses them and adds the hangout URL back in under the URL field, making it a simple click-and-launch to get into hangouts.

For simplicity, the procedure (with my one modification) is:

  1. Create an Automator of type application
  2. Add 'GetSpecified Finder' Items step
  3. Add a 'Run Shell Script’ step, and change the inputs to be As Arguments, not As Stdin.
  4. Copy the following into the text box:

      read url <<< $(cat "$1" | sed "s/$(printf '\r')\$//" | awk -F':' '/X-GOOGLE-HANGOUT/ {first = $2":"$3; getline rest; print (first)(substr(rest,2)); exit 1}’;)
      read uid <<< $(cat "$1" | sed "s/$(printf '\r')\$//" | awk -F':' '/UID/ {print $2; exit 1}’;)
      echo "$url”
      echo "$uid”
  5. Add a step of type 'Run Apple Script’

  6. Copy the following into the box replacing "myCalendar" with the name of your calendar:

      on run {input, parameters}
           set myURL to input's item 1
           set myUID to input's item 2
           set myCal to “myCalendar"
           tell application “Calendar"
                tell calendar myCal
                     set theEvent to first event whose uid = myUID    
                     set (url of theEvent) to myURL
                end tell    
          end tell
          return input
      end run
  7. Save the Application and add to your dock

comments powered by Disqus