I'm not at all a coder and someone may have already posted a solution for this, but it works really well for me so I thought I'd share it with others here.
This script will allow you to directly create events in your Google Calendar using Launchbar and Google's natural language Quick Add feature. Just activate Launchbar, type in the script name, hit the space bar, type in your event in natural language (e.g. Dinner with Bob at 6pm on Thursday) and your Google Calendar will open in your browser with the event nicely added.
Just to be clear, I am standing on the shoulders of giants here. The original sources and inspiration for this method can be found here
http://hackaddict.blogspot.com/2007/10/ ... k-add.html
and here
http://inik.net/launchbar_terminal_command#attachments
A hearty thank you to both authors/coders! There is absolutely no way I could have done this without you!
OK, now for the how-to:
Making this script work requires some initial set-up that sounds scary for us non-coders, but it's actually very easy and didn't take me more than 10 minutes.
As I said, the actual heavy lifting to interface with your Google Calendar is done in Terminal, so you need to install a few Python scripts.
Here's the step-by-step
1) You need to install the GData Python module and the dateutil Python module. You can find links for both here
http://code.google.com/p/gcalcli/
(As for the other requirements mentioned on this page, the version of Python included with OS X 10.5.4 works just fine and includes the ElementTree Python module, so no need to install those if you are up to date. Otherwise, if you need them, links for those updates can also be found on that page.)
Full instructions for installing the GData Python module can be found here:
http://code.google.com/support/bin/answ ... swer=75582
But it's actually amazingly easy if you're using an admin account. Download the module with the most recent revision number, open the zip file which will reveal a folder, select that folder in Finder, hit CMD and hold down the Space Bar to send that folder location to Launchbar, select "Terminal" in Launchbar, then type
Code: Select all
./setup.py install
into the command line in Terminal and hit Enter. The module installs automatically.
Now do the same thing with the dateutil module.
2) Download the gcalcli script (again found at http://code.google.com/p/gcalcli/), unzip it and save it in Documents/Scripts. (You can, of course, save it anywhere you like, you'll just need to update my AppleScript with the new folder.)
3) Open the gcalcli script with TextEdit and insert your Google username and password in the appropriate spot in the script. (I use Google Apps for Your Domain, which works just fine with this -- if you do too, make sure you change the Calendar URL in my Applescript to "calendar.yourdomain.com" -- right now I have it set up for general Google users.)
4) Compile the script below using Script Editor and name it Quick Add to Google Calendar:
Code: Select all
on handle_string(s)
set cmd to "~/Documents/scripts/gcalcli quick " & quoted form of s
doTerminal(cmd)
end handle_string
on doTerminal(cmd)
tell application "Terminal"
activate
if (count of (windows whose busy is false)) > 0 then
set theWindow to first window whose busy is false
set frontmost of theWindow to true
try
do script cmd in theWindow
on error
do shell script "/bin/sleep 5"
do script cmd in the window
end try
else
try
do script cmd
on error
do shell script "/bin/sleep 5"
do script cmd in the window
end try
end if
end tell
tell application "Safari"
activate
open location "http://calendar.alexwoolfson.com"
end tell
end doTerminal
(I can't see how to attach files, but if someone knows how, I'll attach the script for those who are intimidated with compiling it using Script Editor. But again, it's really easy: copy the text above into a Script Editor window, click on the Compile icon in the tool bar and then Save As with "Quick Add to Google Calendar" anywhere you've told Launchbar to index.)
5) That's it! Now you can use Quick Add for Google Calendar with all its natural language goodness right from LaunchBar! Just summon up the script name in Launchbar, hit space and type in your event. Sorted!
I hope some people find this helpful. Again, all the thanks should go to the previous authors, I just tweaked their amazing work to do something I needed. I notice some people on this forum have been asking for iCal support from Launchbar. Well, this all started with me creating my own poor man's MobileMe using BusySync to sync iCal and my Google Calendars
http://www.busymac.com/
and GooSync to sync Google Calendar with my Treo
http://www.goosync.com/
So if I change the calendar in any one of them, they all get updated. Thus, I can use this script to quickly add events to my iCal using natural language right from LaunchBar -- and I get an online backup of my calendar data I can access anywhere on the web as well. If any of my fellow iCalers think this might be useful as well, I recommend you sign up for Google Calendar, try this AppleScript out and take a look at BusySync.
Cheers,
Alex
P.S. For those curious, a description of the kinds of language you can use with Quick Add can be found here
http://www.google.com/support/calendar/ ... 36604#text