08 June 2009

Applescript for Journler: puts Contacts in Comments

Ok, now I'm just being annoying. I didn't want to be mucking around with Applescript at all, but Journler is so cool and so useful that I just can't help myself. With just a few little scripty tweaks, I'm able to use it as my dream PIM (that's a personal information manager for those of you who aren't annoying).

[p.s. Did you know that when you hover over the date of an entry in the browser list for a few seconds, the tip will show the amount of time that has elapsed since the date of the entry? So hover over 9/8/08 a few seconds, and underneath the tip showing "~ 8 months 4 weeks and 2 days ago". That is so cool! Make your savant computer slave calculate for you!]

Anyway, I used the script from my last post to import a bunch of iCal entries for meetings that I've had, each with one attached contact. In Journler, I needed to be able to see a list of all those meetings, see the date, see the topic of the meeting in the title, and also see the contacts so that I could see at a glance when I last saw who in comparison to everyone else. Because the contacts/resources have a many-to-one relationship to the entries, they aren't easily listed in the grid view. The entry Comments to the rescue!

This script makes a list of all the contacts names and copies it to the comments column, which can then be shows in the grid list and sorted on and so forth. Voila (hey, those French lessons are coming in handy, too).

All warnings apply; again, this was quick and dirty scripting.

-- place in ~/Library/Scripts/Journler
-- Copies selected entry's contact resources to comments
- Created by Courtney Lamb 6/7/09 (www.courtneylamb.com)
-- Use at your own risk!
tell application "Journler"
set theEntriesList to selected entries
repeat with theEntry in theEntriesList
set theNames to ""
repeat with theResource in resources of theEntry

if type of theResource is contact then
if theNames is not "" then
set theNames to theNames & ", " & name of theResource
else
set theNames to name of theResource
end if
end if

end repeat
set comments of theEntry to theNames
end repeat
end tell

1 comment:

Unknown said...

Journler is great, I agree. It's the main reason I feel the need to learn applescript.