Apr 2006 09

Adding next actions via scripts: the Tracks API

Version: API Applescripts
File:
Subversion URL:
The Subversion trunk version of Tracks now has a nice API, provided by Luke Melia. This means that it’s possible to communicate with Tracks via scripts to add next actions without using the browser interface. This is all exciting stuff, and I decided to knock up a couple of AppleScripts for the Mac OS X users to take advantage of this. One (NewTodoAPI.scpt) is a fairly simple thing that pops up a dialog box asking for a description, and then sends that to your Tracks installation to a hard-coded context. The other, NewTodoMailAPI.scpt takes the sender and subject of the selected email(s) in Mail and creates a new action for each one, with the description, “Email [sender] about [subject]”. The description gets truncated to 100 characters (the validation limit for the field) if it’s longer than that. It also has Growl notifications if you’ve got Growl installed.

Luke then took my scripts and raised me a Quicksilver: his lovely script (quicksilver_add_to_tracks.zip) can be used very smoothly from Quicksilver. His instructions are as follows.

  1. Download the AppleScript.
  2. Edit the script to include your own username, token, context id, and url
  3. Compile and save the script
  4. Copy the script to ~/Library/Application Support/Quicksilver/Actions/ (you may need to create the Actions directory)
  5. Restart Quicksilver
  6. Activate Quicksilver (Ctrl+Space by default)
  7. Press ”.” to put quicksilver into text mode
  8. Type the description of the next action you want to add
  9. Press tab to switch to the action pane.
  10. By typing or scrolling, choose the “Add to Tracks” action.

For both scripts, you need to edit them to include your username, your token (check the feed links for a long string of letters and numbers and copy that), the id of the context you want the actions to go into, and the URL for your installation. The comments should make it all fairly self explanatory. Have fun!

10 Comments

Is there anything for the Windows world to remotely add items to Tracks?

I don’t really know anything about Windows, but I would imagine that you might be able to find something. Basically, you want something that can send an XML string to a URL with the included information. Does anyone else know what people use for scripting on Windows?

I’m going to write a tool for adding items for Windows. Don’t hold your breath, but it’s got a priority somewhere below eat and above sleep. smile

Luke: Great! The poor Windows folk with thank you grin. Nice addition to the API, by the way!

Just tried to setup the Add to tracks script and it doesn’t appear to be working. QuickSilver says that it added something but it isn’t in my local instance.
I copied over my username, the context that i want to add stuff to (inbox) and that long string of numbers/letters/etc.

any help is greatly appreciated.

enter the context *id*, not the actual context name. you can find out the id number for each context by looking into your tracks db in the contexts table.

Yeah, I figured this out from the forum. Currently working a new addition to the api that takes a context name instead. I’ll post it somewhere once i get the script working along with the patch.

Has anyone had problems with the plugin corrupting the Tracks db? 

My copy (not hosted on my machine) shows “Application Error (Rails)” when I log in now.  The box admin, on the same instance of Tracks, does not have this problem.  He doesn’t use the Quicksilver plugin, other than that there’s no difference in how we use Tracks.

My RSS feeds still work, for what it’s worth.

Shawn, the quicksilver plugin corrupting the DB doesn’t seem possible, off the top of my head. The fact that feeds work but the rest of the app doesn’t, suggests that session storage is broken. This could be a permissions issue or a missing database table.

How do you add an action, context and project at the same time? I use quicksilver and it would be nice to know how to do this, or a way that I can edit the quicksilver script I downloaded to do this. Looks like the functionality is available here:
http://dev.rousette.org.uk/ticket/384

Name:

Email (not shown on page):

Location (optional):

URL:

Remember my personal information

Notify me of follow-up comments?

Please enter the word you see in the image below: