Jump to content

Alfred.framework: Objective-C/Cocoa Support for Alfred Workflows

Recommended Posts

Hey everyone! As tends to happen when I have a great deal of other, more pressing work to do, I've just spent a couple of days on what I think has the potential to become a neat little project. It's an Objective-C/Cocoa framework for creating Alfred workflows. Like alp for Python, it makes handling a couple of basic but super-annoying workflow tasks—like providing feedback XML and searching—simpler and faster, resulting in your spending less time and less code on the boilerplate stuff and more time making your workflow work (and flow). There's a great deal more information in the README at my Alfred site, but here are the features I've managed to put together in the past 24 hours or so:

  • Fast feedback XML generation;
  • fuzzy searching of data, modeled on alp.fuzzy_search();
  • argument parsing;
  • the typical methods for accessing cache, storage, and local folders;
  • basic error logging.

If you're interested, I recommend you take a look at the README; but if you just want to get your hands dirty, you can download the latest version of the framework at http://alfred.daniel.sh/framework/Alfred-latest.zip . The source and zip- and tarballs of major releases are also available on Github.

Enjoy, and let me know if you have any trouble!


Edited by phyllisstein
Link to comment

Thanks! I don't just yet, unfortunately, but I'm probably going to refactor my DEVONthink Note workflow in the next couple of days. Which'll also involve making a lot of improvements to the framework, I predict, since even just glancing at the workflow I noticed a passel of things that were missing or implemented awkwardly. (In particular, there needs to be a way to send a mutable array of feedback objects to the output method and a way to parse arguments.)


I've also decided to upload the source to Github; some of alp's best features came from others, so I'm glad to have more eyes on it. See the original post for a link.

Link to comment

This morning, I've corrected a bug in the bundle configuration that was preventing the framework from loading outside of XCode (d'oh!), added a method for generating feedback XML from an array of AWFeedbackItems, and added a method for parsing arguments to the workflow. I've also changed the methods for adding feedback items so that they take the NSNumber literals @YES and @NO with the normal list of arguments, rather than having to be specified separately as BOOLs. The README has been updated accordingly, and the version is now v0.2.

Link to comment

I've just pushed a couple of things to Github and I thought I'd give you guys a heads-up. First of all, some minor but vital updates to Alfred.framework to clean up a number of bugs concentrated in the fuzzy matching algorithm but scattered passim over the rest of it, and second of all, the source for an updated version of my DEVONthink Note workflow, refactored to make use of Alfred.framework's fuzzy matching and feedback systems.


Next up for Alfred.framework is a preferences system; but after that, I'm open to suggestions. What could the framework do that'd make you think, "Hey, cool!"?

Link to comment

I've been using "Command Line Tool," under "Applications." It's linked to the Foundation framework by default, but you can add others as needed. Then, in your workflow, just use "Run Script" (or "Script Filter") options that invoke your program:

./MyAlfredWorkflow "{query}"
Edited by phyllisstein
Link to comment

The framework has been updated to reflect the changes to workflows in v2.0.4 of Alfred. In particular, arguments with newline characters will now be enclosed in <arg></arg> tags rather than in arg="" attributes. Hopefully there'll be some bigger changes soon—I've got some neat stuff coming down the pipe. This update is currently only available through Github, as it's not really a major revision.

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...