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
<div markdown=0>
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
</div>
The decrement priority script
<div markdown=0>
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
</div>
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!
[download id=”7”]
Discussion
blog comments powered by Disqus