Adding event and ToDos to iCal?

General discussions about LaunchBar
Post Reply
Guest

Adding event and ToDos to iCal?

Post by Guest » Tue Aug 21, 2007 3:22 pm

I saw a note recently about adding items to iGTD. I haven't made the jump to that program yet, but would really like to know if there is an easy LB-way to add things to iCal. I know Quicksilver has something, but... I'm a LB users. ;)

Thanks,
Travis

eth0

Post by eth0 » Tue Aug 21, 2007 3:52 pm

I use this AppleScript to add To-Do's to an iCal calendar:

Code: Select all

property calendarName: "Personal"

on run
   display dialog "This script adds to-do's to iCal." buttons {"OK, now go away!"} default button 1 with icon 1
end run

on handle_string(s)
   tell application "iCal" to make new todo at end of todos of calendar calendarName with properties {summary:s}
   open location "x-launchbar:hide"
end handle_string

Hope it helps. :)

Guest

string 's'?

Post by Guest » Tue Aug 21, 2007 11:13 pm

So, where does the string 's' come from? Do I have something highlighted or do I need something on the clipboard?

Travis

eth0

Post by eth0 » Tue Aug 21, 2007 11:33 pm

Just select the AppleScript file in LaunchBar, hit Space, type the text you want to make into a To-Do and hit Enter. The same as with a search template. :)

FredB
Rank 2
Rank 2
Posts: 69
Joined: Sun Dec 31, 2006 8:19 am
Location: Liège, Belgium
Contact:

Post by FredB » Wed Aug 22, 2007 1:27 am

Hi,

I made a ruby script to add events to iCal using "natural" language.
e.g.

"Meeting with Paul @ monday 14pm > Office -d 30m -r 2h" creates an event on next monday at 14pm with location "office", a duration of 30 min and a reminder 2 hours before.

Every parameters except the message and date/time can be omitted.

Problems :
  1. I'd like to share it, but making it for myself or for other people is a different game.
  2. I don't have the time to clean and fully document it now.
  3. It has dependencies: Chronic, Growl and ruby growl.


So, if some of you are interested and not scared by a command line, I can set up a basic howto ASAP.

--
FredB

Guest

Post by Guest » Fri Aug 24, 2007 6:49 am

I would be interested, I been looking for this final piece to my getting away from QS puzzle (to slow and bloated). Thats the only feature I miss from QS, is quickly adding events to iCal. QS also used this normal language algorithm and its cool to see that it can be used with LB too. Rock on dude!!

Travler (original poster)

Updated ical todo script

Post by Travler (original poster) » Fri Aug 24, 2007 5:57 pm

Okay, I asked the question originally, now realize how to get LB to do things with scripts. Guess I never needed to know, even though I've been using LB for years.

With this new knowledge, I got inspired and hunted around for some other scripts. Found one and heavily modified it for some further functionality. Now you can assign a todo to a specific calendar and also assign a priority. I don't think I'll get around to adding a date mechanism, but someone else could, of course. :wink:

Here you go. I tried to comment as I went. Let me know how it works for you.


Code: Select all

--  Add ToDo item to ical, mainly for Launchbar users
--  Insprired by eth0's and an iGTD script
--  Adapted by Travler, 2007, under GPL

--  Basic syntax is
--      <todo title> [p:1,2,3] [c:<calendar name>]

-- Examples:
--  "I need to get this done"  creates a todo with that text
--  "Do this please p:1" creates a todo saying "Do this please" with low priority
--  "Do this at home c:Home" creates a todo saying "Do this at home" in the "Home" calendar


property calendarName : "Personal"

on run
   display dialog "This script adds to-do's to iCal." buttons {"OK, now go away!"} default button 1 with icon 1
end run


on handle_string(inString)
   
   set AppleScript's text item delimiters to " "
   try
      set theTitleWords to {}
      set thePriority to ""
      
      --  Divide up the string into parts
      set theItems to the text items of inString
      
      set AppleScript's text item delimiters to ""
      repeat with oneItem in theItems
         if oneItem starts with "P:" then
            if item 3 of oneItem as text is "1" then
               set thePriority to "low priority"
            else if item 3 of oneItem as text is "2" then
               set thePriority to "medium priority"
            else if item 3 of oneItem as text is "3" then
               set thePriority to "high priority"
            end if
         else if oneItem starts with "C:" then
            set calendarName to items 3 thru -1 of oneItem as text
         else
            set the end of theTitleWords to oneItem as text
         end if
      end repeat
      
      set AppleScript's text item delimiters to " "
      set theTitle to theTitleWords as text
      
   on error
      -- no spaces or parse error use the entire input string
      set theTitle to inString
   end try
   
   -- restore default value
   set AppleScript's text item delimiters to ""
   
   --  Send to iCal
   if thePriority is "low priority" then
      tell application "iCal" to make new todo at end of todos of calendar calendarName with properties {summary:theTitle, priority:low priority}
   else if thePriority is "medium priority" then
      tell application "iCal" to make new todo at end of todos of calendar calendarName with properties {summary:theTitle, priority:medium priority}
   else if thePriority is "high priority" then
      tell application "iCal" to make new todo at end of todos of calendar calendarName with properties {summary:theTitle, priority:high priority}
   else
      tell application "iCal" to make new todo at end of todos of calendar calendarName with properties {summary:theTitle}
   end if
   
   -- Hide Launchbar
   open location "x-launchbar:hide"
   
end handle_string


[/code]

Travler

Possibly helpful URL

Post by Travler » Fri Aug 24, 2007 6:03 pm

I didn't use anything from this script, because it just seemed too complex, but if someone does get inspired to add date functionality, I think this allows for "plain english" dates. Or someone could just add a specific syntax, such as:

D:8/31/2007

http://scriptbuilders.net/files/sendtodostoical0.92.html

Maybe this helps,
Travler

Guest

Post by Guest » Wed Oct 24, 2007 5:27 am

I have also been attached to quicksilver and am now moving to launchbar because of reliability problems (Quicksilver is crashing pages and omniweb!) but this feature in quicksilver is absolutely amazing and I would love to have it in launchbar. I hope this feature becomes a possibility soon.

FredB
Rank 2
Rank 2
Posts: 69
Joined: Sun Dec 31, 2006 8:19 am
Location: Liège, Belgium
Contact:

Post by FredB » Thu Dec 20, 2007 3:08 am

Hi guys,

Sorry for not posting a follow-up sooner.

As I wrote before I have a solution using natural language that works great, for me at least.

N.B:
- I made this for me and I don't know if it will fit other's workflow.
- It will open iCal if it's not already opened. I experimented with ways to add events without opening iCal but it was too hard/dangerous for me.
- I made it with ruby and it has dependencies, nothing hard to install if you're on Leopard, a bit harder if you're not, as Leopard already includes a recent Ruby, RubyCocoa and Rubygems.

I'll make a page about it as soon as I have the time to write some documentation.
I'll try to do it this week, early january at the very latest.

Update: As noted here Obdev is working on iCal support, so there is no need for this anymore.

Post Reply