AppleScript, ToDo.txt, & GTD
A month after switching my GTD needs to the nerdtastic ToDo.txt system (paired with GeekTool and the awesome Visor), I created an AppleScript to email my assistant the items that I’ve delegated to him.
I think it’s pretty neat, but then again, I’m easily impressed.
How’s it all work? It’s all pretty easy, actually. (It’d have to be, because I’m not a great programmer, and I’m very new to AppleScript.) I label items that I’ve delegated to my assistant with @steve. To list all the items I’ve delegated to Steve, I run the terminal command t list @steve. The trick is just to (automatically) email Steve the terminal output.
The “automatically” is taken care of by Cronnix and Anacron (mentioned in my previous AppleScript post), and the emailing is taken care of with a bit of AppleScript.
When it’s all said and done, Steve gets an email with something like this:
14 @steve +CHI new design 13 @steve +FB +PFM remake the homepage 15 @steve +TT install crazyegg on homepage 12 zzz @steve +HSI swap stevens picture
Other Uses, @phone, @errand
I’m thinking I might modify this oh-so-slightly to have it send my phone a text message every morning with all my @phone and @errand items.
Interesting Ideas for the Future
It might be interesting to create a script that could process a response from Steve on my own ToDo.txt list. For example, if Steve were to email back t do 13 , we could send that command to the terminal. I don’t have a need for this at the moment, but it’s interesting to think about…
As it is now, Steve just replies to the email at the end of his day with an ’@x@’ before the tasks he’s completed. It’s the first task-managerment/productivity type system that he’s stuck with for more than 4 days, so I count it a success.
The Code
Disclaimers:
- Make sure you change the email addresses and your username (chucknorris).
- I’m very new to AppleScript, so this might be a horrible way to do things. It seems to work though, so I’m happy.
Other than that, you should be good to go.
-- set the date
set theDate to (do shell script "date '+%Y.%m.%d'")
-- set the mail options
set theRecipient to "steve@yourdomain.tld"
set theCCRecipient to "list@yourdomain.tld"
set theSender to "list@yourdomain.tld"
set theSubject to "ToDo for Steve: " & theDate
set theBody to (do shell script "/Users/chucknorris/Documents/ToDo/todo.sh list @steve")
if theBody is not "" then
tell application "Mail"
-- create and send the message
activate
set newMessage to make new outgoing message
tell newMessage
set visible to true
set subject to theSubject
set content to theBody & return & return
set sender to theSender
-- set to recipients to theRecipient
make new to recipient at end of to recipients with properties {name:"Steve", address:"steve@yourdomain.tld"}
end tell
send newMessage
end tell
end if
Known Issues
None so far, but I’m sure the programming department and/or the ToDo.txt mailing list will find something. I’ll update if there’s anything.
Over and out.
-Kelley, Web Developer for Cari.net
Network Status







