Jump to content

Things: Search, Show, and Add Tasks


Recommended Posts

Another quickie from my own personal self, a Things workflow for adding tasks that also, thanks to Alfred's feedback system, searches them. I've been pestering Cultured Code to add this to the Quick Entry panel for ages, since I have a tendency to add one task five times (the number of incomplete "Watch and return Netflix DVDs" tasks I have floating around at any given time is absurd), but now Alfred will handle it for you! Just enter "things" to see a list of all projects, areas, and tasks; keep typing to start entering a task using the plug-in syntax (see below) while searching through pre-existing tasks. Select any item to show it in Things. You can also skip searching new items by adding a plus sign to your input (e.g., "things +Get this done").

 

The format for new tasks is as follows:

#tag1 #tag2 name [project/area] ::note >duedate

…with duedate specified in the format MM/DD/YYYY.

 

Give it a try and let me know if anything else breaks!

 

things_screen.jpg

Edited by phyllisstein
Link to comment

On the surface this workflow has the potential to melt my face right off with it's awesomeness but the performance is not good and the bouncy Pythons of which there are a couple at any time or not pleasant.

 

I'm pretty good at not using nasty characters in Things, any chance you could let me have the applescript version pwwwease?

Link to comment

We now have a third option available, my current favorite, at http://alfred.daniel.sh/Workflows/Things.alfredworkflow . It's pure Objective-C, meaning that it has all the advantages of the pure-Python version (coping correctly with special characters, including commas) without the drawbacks (it's actually the fastest, and nothing bounces in the Dock). What I don't know is whether GateKeeper will put the kibosh on it. So if someone could download and test it, I'd be super-grateful. I haven't worked in Obj-C in an eternity, but it seems to work on my machine, so if you get no output it's probably being bocked by GateKeeper.

Link to comment

Awesome work!

 

The third option 'kind of' works in that I can search for tasks and add tasks. But it doesn't display like the applescript and pure python versions with all the icons and sections (a la your screen grab). If I type 'things ' a full list of every task in Things appears instead.

 

Applescript version is working fine here. :)

Link to comment

Awesome work!

 

The third option 'kind of' works in that I can search for tasks and add tasks. But it doesn't display like the applescript and pure python versions with all the icons and sections (a la your screen grab). If I type 'things ' a full list of every task in Things appears instead.

 

Applescript version is working fine here. :)

 

Great! If it runs, then it's the one I'm gonna stick with debugging. Not worth supporting three versions at once. I think the projects and lists were sorted to the bottom, after the tasks, in the initial version, but I've changed that. I've also fixed it so that it only pulls open tasks, where before it was pulling open, completed, and canceled ones. You can get an updated version above—or just stick with the AS version, if that's what you prefer.

Link to comment

Hey phyllisstein, this is a really cool workflow and I am flirting with the idea of using obj-c for a workflow and was wondering if there is anywhere I could browse the source for this workflow on GH or something to get an idea of how one would go about it? If not are there any docs you used to create the workflow or did you just figure it out on your own?

 

Thx

Glad you like it! I've just pushed the code to https://github.com/phyllisstein/ThingsWorkflow. I mostly figured it out on my own, with some aggressive Googling when I got stuck, but the basic process is to create a Foundation command-line tool that outputs the XML David describes here: http://www.alfredforum.com/topic/5-generating-feedback-in-workflows/

 

ETA: Also, this one relies on Scripting Bridge to communicate with Things, which is where Things.h comes from. You can generate that header file by running:

sdef /path/to/application.app | sdp -fh --basename applicationName

 

 

I love the idea! The Objective-C version was working for me, then I tried the Applescript version after you updated and it won't let me add or search tasks.

I think I'm gonna stick with the Obj-C version as the officially-supported one. I've removed the other two from the initial post. Adding and searching tasks appear to work fine, albeit with a slight delay while it checks each task for whether it's open or not.

Edited by phyllisstein
Link to comment

Hmm for some reason the applescript isn't working for me. I use the "Things" keyword and the dialog "Things Tasks" appears but it isn't populate with my existing tasks / projects.

Using Things 2.1.1 and Alfred 2.0.2.

 

Seeing the same - get no feedback at all from this workflow, neither can I create tasks

Link to comment

Hmm for some reason the applescript isn't working for me. I use the "Things" keyword and the dialog "Things Tasks" appears but it isn't populate with my existing tasks / projects.

Using Things 2.1.1 and Alfred 2.0.2.

 

 

Seeing the same - get no feedback at all from this workflow, neither can I create tasks

 

Sorry that it's giving you trouble, guys. Wanna do me a favor and change the script filter so that it runs the following command, then let me know what shows up in the log file? I'll be able to try a solution once I have a better idea of what the problem is.

 

./ThingsWorkflow {query} 2>&1 | tee feedback.log
Link to comment

Found the source of the issue: I tried running the ThingsWorkflow binary directly from a terminal window - I get no feedback at all

 

Yes - I'm running with Dropbox Sync also, though I tried copying the binary outside of Dropbox and runningfrom there - no change

Edited by sphardy
Link to comment

When I try to run ThingsWorkflow binary from the Terminal i get

"Illegal instruction: 4"
but no hanging...
 
hmm perhaps an OS issue? (mountain lion here).
 
"The "illegal instruction" message is simply telling you that your binaries contain instructions the version of the OS that you are attempting to run them under does not understand. I can't give you the precise meaning of 4 but I expect that is internal to Apple." (from stackoverflow)
Edited by bmscmoreira
Link to comment

The former - just hangs and has to be killed

Alright, I suspect that what's happening in your case is that it's taking too long to iterate through all of your tasks and check to see whether they're open. It only takes an instant normally, but I can see how it would start to cascade. I've uploaded a new version to the address linked in the first post that doesn't do that check; see if you have better luck with that.

 

When I try to run ThingsWorkflow binary from the Terminal i get

"Illegal instruction: 4"
but no hanging...
 
hmm perhaps an OS issue? (mountain lion here).
 
"The "illegal instruction" message is simply telling you that your binaries contain instructions the version of the OS that you are attempting to run them under does not understand. I can't give you the precise meaning of 4 but I expect that is internal to Apple." (from stackoverflow)

I'm also on Mountain Lion, so that strikes me as especially strange. I'll poke around a bit, but try the updated version in the meantime and see if it works any better.

 

ETA: Just uploaded a second revised version with the build target adjusted down to 10.6, which was one suggested solution. Maybe that'll help a bit.

 

Edited Again to Add: And a third version, again at the same link, properly built for both 32- and 64-bit systems. Sorry for the multiple tries, my Obj-C is a little rusty.

Edited by phyllisstein
Link to comment

Alright, I suspect that what's happening in your case is that it's taking too long to iterate through all of your tasks and check to see whether they're open. It only takes an instant normally, but I can see how it would start to cascade. I've uploaded a new version to the address linked in the first post that doesn't do that check; see if you have better luck with that.

I'm also on Mountain Lion, so that strikes me as especially strange. I'll poke around a bit, but try the updated version in the meantime and see if it works any better.

ETA: Just uploaded a second revised version with the build target adjusted down to 10.6, which was one suggested solution. Maybe that'll help a bit.

Yes, improved :) now "Things" keyword makes the tasks / projects / areas list appear (as in the first screenshot) and selecting any of them will open Things main app in the corresponding section.

Adding tasks works: I've managed to add a task with title, notes, areas, projects. But wasn't able to pass in tags and duedates.

Edited by bmscmoreira
Link to comment

Yes, improved :) now "Things" keyword makes the tasks / projects / areas list appear (as in the first screenshot) and selecting any of them will open Things main app in the corresponding section.

Adding tasks works: I've managed to add a task with title, notes, areas, projects. But wasn't able to pass in tags and duedates.

Excellent! Glad we're getting somewhere. You're right that tags were fouling it up, since Alfred doesn't escape "#"; adding a plus sign to the beginning of the query should fix it in your version, but I've also uploaded yet another revision that should allow you to enter tags without the plus. If I remember correctly, the tag must already exist in order for you to use it, and due-dates' formats are something like ">+n," where n is a number of days. This may take some experimenting, though, since Cultured Code pulled their docs on it.

Link to comment

The update appears to have fixed my issue also and I can now create tasks and see the list as shown in the 1st post of this thread.

 

I can also search - but while selected items are highlighted, the window is not re-opened if Things is minimised. Could that be added?

 

Edit: Ummm... Looking at the script it appears Things should activate and open, but doesn't

Edited by sphardy
Link to comment

The update appears to have fixed my issue also and I can now create tasks and see the list as shown in the 1st post of this thread.

 

I can also search - but while selected items are highlighted, the window is not re-opened if Things is minimised. Could that be added?

 

Edit: Ummm... Looking at the script it appears Things should activate and open, but doesn't

 

Excellent! As far as bringing the window forward, I've made a small change to act.py that seems to help. Try downloading it again.

Link to comment

Yep, only problem which is not the workflows fault is tags not added if they are not already existing tags in Things, i.e. assigned to another task already or had been used before. So end result, workflow is SWEET! Lot of hard work went into this one! Always appreciated.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...