Passing text to your applescripts with Alfred Workflows
The great thing about Alfred, the awesome Spotlight replacement for OS X, is that – unlike Spotlight – you can run applescripts and shell scripts right from the launcher. This makes it a great tool to quickly run all sorts of actions and services1 – just type the first few letters of the name of your script and press enter.
However, even more advanced actions are possible with Alfred’s Workflows feature. Workflows are basically the same as scripts, but you can use Alfred’s interface to pass a String as a variable.2 This makes Alfred useful for much more than just executing scripts. Here I will explain several of the workflows that I use.
Create new note
I use this one all the time. It creates a new Markdown file with the specified title (or a date stamp, if no title is given) in my “Notes” folder and opens it in my default editor (Sublime Text!). For added convenience, the content of the file are the current clipboard contents (most of the time, that is what I want):
Compose new mail
It can be very useful to be able to compose a new email message without having to see your inbox. For this I have this self-explanatory workflow:
Search for synonyms
Many Workflow ideas can also be implemented as custom Alfred searches. For example this simple synonym finder. Just create a new custom web search with the address http://www.thesaurus.com/browse/{query}
.3 I find this very handy while writing.