
A few scripts for TaskPaper users
I’ve been using Things for task management lately, mostly because it has a decent iPad app. I really do love my iPad… however, I often use TaskPaper from Hog Bay Software for weekend to-do lists and for tracking bugs and fixes on my various freetime projects. I sometimes edit my TaskPaper files (which are just plain text) in TextMate and use some Ruby scripts adapted from the GTDAlt bundle to do some fun things, but I really like the interface you get when you actually use TaskPaper. So I started scripting it…
There are three scripts I’m going to share, two are pure AppleScript and one depends on a Ruby library called “Chronic.” A download will be available at the end of the article that is an AppleScript bundle with the Ruby library included, so it should run fine without any extra hassle.
The first two scripts work in tandem, and increment and decrement the priority of the current or selected tasks. TaskPaper lets you add a value to a tag, e.g. @priority(4). These can be used for sorting or searching and can be very valuable. Read on for the scripts I’ve been using to make it even more so…
The basic idea is to assign a keyboard shortcut to the scripts and be able to add a priority tag if it doesn’t exist, remove it if we decrement it below 1, and be able to change the priority incrementally with repeat keystrokes.
To add a script to TaskPaper, just pull down its script icon in the top menu and choose “Open Scripts Folder.” That’s where you’ll put your compiled scripts and they’ll show up in TaskPaper. Add keyboard shortcuts using the Keyboard Preference pane in System Preferences, adding an application shortcut for TaskPaper and setting it to the exact name of the menu item your script creates (the title of the script without the extension). I have my increment and decrement scripts set to ⌘⇧- and ⌘⇧+ (command shift minus, and command shift plus).
The increment priority script
tell application "TaskPaper"
repeat with _task in selected entries as list
if exists tag named "priority" of _task then
set _val to value of tag named "priority" of _task as integer
if _val < 9 then
set _val to _val + 1
set value of tag named "priority" of _task to _val
else if _val = 9 then
tell _task to delete tag named "priority" of _task
end if
else
tell _task to make tag with properties {name:"priority", value:1}
end if
end repeat
end tell
The decrement priority script
tell application "TaskPaper"
repeat with _task in selected entries as list
if exists tag named "priority" of _task then
set _val to value of tag named "priority" of _task as integer
if _val > 1 then
set _val to _val - 1
set value of tag named "priority" of _task to _val
else if _val = 1 then
tell _task to delete tag named "priority" of _task
end if
else
tell _task to make tag with properties {name:"priority", value:5}
end if
end repeat
end tell
The other script
I’m just going to make this one available for download (see the bottom of the post for all three scripts) and not try to post the code here. What it does is expand natural language dates into a date format that TaskPaper and other scripts can easily recognize. It looks for @start() and @due() tags, and runs whatever value they contain through the Ruby Chronic library. This turns things like “next tuesday” and “in 3 days” into usable dates. I have it assigned to ⌘= (command equal). It will function on the current line or an entire selection.
That’s it for now. I’ve got others, but some of them are too complicated to try to share, and some just do things I don’t think anyone else would actually want to do. If you have any questions or suggestions, though, feel free to comment or contact me!
Download the scripts!
TaskPaper Scripts — A few scripts for TaskPaper users. Allows keyboard shortcuts for incrementing and decrementing priority tags, and expansion of natural language dates in start and due tags. More Info

Really looking forward to the natural language date script. Thanks for posting.
The ruby chronic library doesn’t appear to be in the download. Can you check?
Never mind.. seems to work anyway.. maybe I already have it on my system?
It’s inside of the .scptd bundle itself :).
Hi Brett — one other question if you don’t mind.. and I’m not even sure how it happened because it was working fine for a while… but now when I run the expand dates script through TaskPaper, it pops up the AppleScript Editor. I click “Run” and it runs through and expands the date. But I’m not sure why it’s popping open. One thing I did notice was in the “replies” section after running it I’m getting the following error:
Any ideas?
Hm. I’ve had that happen to scripts before, and I can’t remember what was causing it. You could try compiling the script as an app bundle instead of a script bundle… but that error is going to be problematic. Do you know if you’ve upgraded your Ruby installation lately?
Not that I know of but I did just get a new MBP. I used the OSX migration tool to bring my stuff over. Would that explain anything?
Could actually be a permissions issue. Easiest thing would be to remove the scripts and reinstall them from the archive here. I’m not absolutely sure there’s not something in my script that could be different (like not calling a shell script within a tell block, maybe), but I’m not having any issues like that. The 10004 error is a “privileges error,” which I think could be caused by a change in ACL or permissions on the file or directory. I could be wrong… I’ll look into it on my end, but let me know if any of that helps.
The permissions look the same as the other scripts I have. One thing to note is that when I run the script it pops open the Apple Script Editor. It doesn’t actually automatically run the script. It’s only after I hit “Run” manually that it runs, correctly expands the date and returns the error code.
All I did to check the permissions was “Get Info” on the file. If there is a different (or more detailed) view of the permissions to look at, let me know.
I also tried converting it to an app but then it can’t find the bundle contents .rb files.
Also — I did try removing the scripts and installing them again from here. That didn’t work.
Brett, the increment and deincrement scripts are awesome! Thanks so much for writing and sharing :)
Absolutely, glad they’re helpful!