How do I edit the notes section of iCal automatically using Applescript or anything else?
March 4, 2005 10:12 AM Subscribe
Simplified scenario: I have a text file called "blah.txt" with some text in it. I also have a To-Do item in iCal named "Blah". I'd like to be able to doubleclick something to make the contents of blah.txt appear in the notes section of the Blah to-do item.
-The real goal of this is to get my Getting Things Done lists synced across my Symbian phone, my laptop, and my desktop, and while iCal seems to be the only way to syncronize this information, it's not a particularly good place to enter my data in the first place.
-Any tool is fair game, not just Applescript
-Most of the variables above can be changed (I can move my lists into any format, for example), but I believe iCal is the only way to keep all my devices synced with the same information.
-Possible hint discovered on 43 folders google group: This php module apparently can interface with the iCal files extensively, and is used in some Konfabulator widgets: http://phpicalendar.sourceforge.net/
-May the force be with you
-The real goal of this is to get my Getting Things Done lists synced across my Symbian phone, my laptop, and my desktop, and while iCal seems to be the only way to syncronize this information, it's not a particularly good place to enter my data in the first place.
-Any tool is fair game, not just Applescript
-Most of the variables above can be changed (I can move my lists into any format, for example), but I believe iCal is the only way to keep all my devices synced with the same information.
-Possible hint discovered on 43 folders google group: This php module apparently can interface with the iCal files extensively, and is used in some Konfabulator widgets: http://phpicalendar.sourceforge.net/
-May the force be with you
in script editor, there's a "open dictionary" menu option. you can select iCal and see it's applescript hooks. of course, that won't help much if you've never made an applescript before. i can probably make what you want in about five minutes assuming the to-do notes are editable via applescript. i'm at work now on windows, but i'll take a crack at it after work if you're still looking then.
posted by scottreynen at 11:47 AM on March 4, 2005
posted by scottreynen at 11:47 AM on March 4, 2005
This won't exactly work: in order for it to work, all ".txt" files would need to open in the todo-adding widget, and you probably don't want that.
There should be ways to get close. You could create a script that, say, watches a certain folder and executes whenever anything gets added to it. In rough terms, the script would
- get the names of all the files in the directory; drop the extensions
- for each name, see if there's an existing ical todo entry that matches; if so, set its description to the contents of that file. If not, create one (?) and set its description to the contents of the file
- having done this successfully, delete the .txt file (perhaps)
My Applescript-fu is weak, but I know it's do-able.
posted by adamrice at 11:48 AM on March 4, 2005
There should be ways to get close. You could create a script that, say, watches a certain folder and executes whenever anything gets added to it. In rough terms, the script would
- get the names of all the files in the directory; drop the extensions
- for each name, see if there's an existing ical todo entry that matches; if so, set its description to the contents of that file. If not, create one (?) and set its description to the contents of the file
- having done this successfully, delete the .txt file (perhaps)
My Applescript-fu is weak, but I know it's do-able.
posted by adamrice at 11:48 AM on March 4, 2005
Response by poster: Applescript's ical dictionary shows a todo class with various properties.
While one of these properties is "summary", which seems promising, the event class contains "summary" as well as "description", which leads me to think that "description" is what I'm after, and it doesnt exist for the todo class.
Any ideas? (My applescript-fu is weak too, so even if there was a description property, I wouldn't know what to do with it..)
posted by sirion at 3:00 PM on March 4, 2005
While one of these properties is "summary", which seems promising, the event class contains "summary" as well as "description", which leads me to think that "description" is what I'm after, and it doesnt exist for the todo class.
Any ideas? (My applescript-fu is weak too, so even if there was a description property, I wouldn't know what to do with it..)
posted by sirion at 3:00 PM on March 4, 2005
The todo class inherits the properties of its superclass, and if you do some more noodling around, you'll see there is a "description" property in the superclass. I'm guessing the summary is the title--the text that appears in the list sidebar.
There are a bunch of utility scripts that install by default with OS X -- check out /Library/Scripts. Although none are iCal-specific, they might give you some ideas on how to code.
Setting a property is pretty simple. If you have a list of todo items called "my_todos" you'd do this:
posted by adamrice at 3:28 PM on March 4, 2005
There are a bunch of utility scripts that install by default with OS X -- check out /Library/Scripts. Although none are iCal-specific, they might give you some ideas on how to code.
Setting a property is pretty simple. If you have a list of todo items called "my_todos" you'd do this:
repeat with i from 1 to number of items in my_todos set description of item i of my_todos to "some description" end repeatNow, what you'd really want to do to make this work is get the "summary" of each todo list item, see if there's a file by that name (adding .txt as necessary), if so, open it, read its contents into a variable, close it, and set the description to that variable.
posted by adamrice at 3:28 PM on March 4, 2005
Response by poster: Thanks, adamrice!
Anyone posessing decent applescript skills want to throw together a demo script?
(I imagine if I spent a few hours looking through how applescript works I might figure this out, but I also imagine someone who's applescript-savvy could probably throw one together in a few minutes)
posted by sirion at 5:28 PM on March 4, 2005
Anyone posessing decent applescript skills want to throw together a demo script?
(I imagine if I spent a few hours looking through how applescript works I might figure this out, but I also imagine someone who's applescript-savvy could probably throw one together in a few minutes)
posted by sirion at 5:28 PM on March 4, 2005
you'll see there is a "description" property in the superclass.
i don't see that. i see the superclass of the todo class is item, which has only "class" and "properties" - no "description." further, when i create a todo with a note and then view it's properties via applescript, the note doesn't appear. i see no way to read nor edit todo notes in ical via applescript.
an alternative would be to edit the .ics file for the calendar directly, but that's a bit more complicated, and leaves more room for breaking things. you could do that with any language. you'd just need to scan the .ics file for the line "SUMMARY:blah" and then replace the next line that starts "DESCRIPTION:" with "DESCRIPTION: contents of blah.txt"
posted by scottreynen at 5:32 PM on March 4, 2005
i don't see that. i see the superclass of the todo class is item, which has only "class" and "properties" - no "description." further, when i create a todo with a note and then view it's properties via applescript, the note doesn't appear. i see no way to read nor edit todo notes in ical via applescript.
an alternative would be to edit the .ics file for the calendar directly, but that's a bit more complicated, and leaves more room for breaking things. you could do that with any language. you'd just need to scan the .ics file for the line "SUMMARY:blah" and then replace the next line that starts "DESCRIPTION:" with "DESCRIPTION: contents of blah.txt"
posted by scottreynen at 5:32 PM on March 4, 2005
This thread is closed to new comments.
posted by scottreynen at 10:33 AM on March 4, 2005