Search the Community
Showing results for tags 'helper'.
Note: This is not a workflow, but a helper CLI (command-line utility) geared toward Alfred users who manage development of multiple workflows intended for sharing. I suggest installing via the npm registry, if you have Node.js installed - if not, consider installing it just to benefit from its great package manager, npm; try curl -L http://git.io/n-install | bash ): [sudo] npm install -g awf Alternatively, here are instructions for manual installation. Note, however, that the npm-based installation makes updating to a newer version much easier. Below is a high-level overview; you can find the full manual in the repo's Usage chapter, or, once installed, you can execute awf help (concise overview), awf help all (full manual), or awf help <sub-command>. ------ awf (Alfred Workflow) is an OS X CLI for managing and assisting in the development of workflows for command-line launcher Alfred 2. It comes with a broad range of features: Note: Some features related to Alfred Preferences.app involve GUI scripting and therefore require that the application running awf - typically, Terminal.app - be granted access to accessibility features - you will be prompted for authorization on first use; for more information, see Apple’s support article on the subject. Retrieving information about workflows List all workflows or workflows matching a filter, optionally with selectable output fields.awf list -s i net.same2u. # list matching workflows by bundle ID substring Print information about a given workflow.awf info net.same2u.speak.awf Locating workflows Locate a workflow’s installation folder by its bundle ID.awf which net.same2u.speak.awf # prints installation folder path Reveal a workflow’s folder in Finder.awf reveal net.same2u.speak.awf Trigger a keyword search for workflows in Alfred Preferences.awf search speak Editing workflows Change to a workflow’s folder in Terminal.awf cd net.same2u.speak.awf # opens a tab in a new window Open a workflow in Alfred Preferences for editing.awf edit net.same2u.speak.awf awf edit # from a workflow source folder Installing and exporting workflows Install a (copy of a) workflow from a source folder.awf install . Export a *.alfredworkflow archive from a source folder.awf export . # exports to '*.alfredworkflow' in same folder by default Developing workflows Note: The purpose of the following features is to allow you to store workflows being developed in a separate location instead of directly among the installed workflows. A symlink to the dev location placed among the installed folders ensures that you can still use and develop the workflow from within Alfred and Alfred Preferences. These features move directories, create symlinks, and delete files. Care is taken not to accidentally overwrite or delete files, but use these features with caution and always create backups. Symlink a dev folder (source folder) into the folder of installed worklows or remove a dev folder’s symlink.awf link . # effective installation without moving the directory awf unlink . # remove a symlink - effective uninstallation Move an existing, regular workflow to a dev folder in a different location and replace the original workflow folder with a symlink to the dev folder.awf todev net.same2u.speak . # move to current folder and perform 'awf link' Conversely, move a dev folder back to the folder of installed workflows as a regularly installed workflow.awf fromdev . # -k keeps the source folder Manage workflow version numbers via file version.awf version patch # bumps the patch component of the workflow's version number
Hey all Alfred lovers out there, After David Ferguson created the PHP Workflows class to help PHP gurus create complex workflows with ease, I decided to create an equivalent solution for AppleScript gurus, because let's face it: you can't really do with PHP (or other languages) what you can do with AppleScript in terms of controlling your Mac system and its apps. This library provides an object-oriented library of functions for working with plist settings files, reading and writing data to files, generating Alfred feedback results, requesting remote data, and more. But before you begin working with it, please make sure you read the documentation first as it contains vital information on how to use it, as well as help & examples (there's even an example AlfredWorkflow file that uses this library to show you how you can use it for your own workflows). P.S. at the moment the library lacks JSON support since AppleScript doesn't know anything about it, so until I develop a JSON parser for AppleScript you can either use David's PHP class or improvise on my work and keep an eye on the github repository because I will probably add more AlfredWorkflows, and hopefully I'll manage to make a proper JSON parser in the meantime.
Please see this newer thread for a more up-to-date list of libraries that support Alfred 3 and beyond. Since the introduction of Alfred 2, there have been several extremely useful utility classes and other helpers crop up that simplify a lot of the tedious, common tasks associated with creating workflows. These utilities are developed and maintained by community members, not by the Alfred team. All support requests for these utilities should be directed to the original author. If you have another utility class that needs to be included in this list, send me a message or email (email@example.com) with information about it (name, description, short list of features, link to post or download page) and I will make sure that it gets added to the list. Special thanks to all the developers for their hard work and for sharing their work with us. Python Alfred-Workflow (by deanishe) A state-of-the-art Python library for Workflow developers. Support for Alfred 2 and 3. The library is simple to install, has no external dependencies, is very well-documented and maintained, and boasts an eye-wateringly high feature-to-size ratio at just 140 KB. Main features Catches, logs and notifies users (and developers) of errors in Workflows. No more confusing, silent failure. Super-simple, yet powerful data caching (e.g. from a web service) and storage. Easy-to-use storage of Workflow settings. Keychain access for secure storage (and cross-machine syncing) of sensitive data, like passwords and API keys. Tunable and understandable Alfred-like fuzzy search (e.g. got matches Game of Thrones as well as Baby Got Back. Or not: that's up to you.) Now with solid support for multi-word queries. Extremely lightweight, but full-featured, HTTP library with Requests-like interface, but just 12 KB instead of > 2 MB. Convenient access to standard OS X icons, for high-quality, familiar icons without adding size to the library. Also available via proper English. Pre-configured, built-in logging to enable simpler Workflow debugging. Painlessly run (update) scripts in the background without blocking your workflow, so you can still show "old" results while fetching new ones. Supports Alfred's new (version 2.3) modifier-specific subtitles. Simple support for 3rd-party libraries your Workflow relies on. "Magic" arguments to make developing/debugging Workflows so much easier, especially when helping less technically-inclined users. With "magic" arguments, you and your Workflow's users can open the Workflow's log file in Console.app, its cache and data directories in Finder, and its root directory in Finder orTerminal from the comfort of Alfred's query box. You can also delete the cache/data/settings if something is corrupted. Your workflow can update itself via GitHub releases. Accent-folding, so you can search non-ASCII text (e.g. voilà will be matched by voila) Functions to support migrating settings/data from older versions of your workflow. Well supported and kept up-to-date with Alfred's features as they are added. Alfred 3-only features Workflow variables Advanced modifiers Alfred 3-only updates And as you can see from the above links, there is extensive documentation, including a two-part tutorial on building a Workflow from scratch. Examples Here are a few examples of how you can do some pretty cools stuff in just a few lines of code. A simple Workflow I made to search Packal in ~90 lines of code. A simple Workflow to search your recent Pinboard posts in ~50 lines of code. A polished, user-friendly, wicked-fast Workflow to search your recent Pinboard posts in ~200 lines of code. Remember, each of these Workflows also has—for free—full error-catching and -logging support, and the ability to open its log file (which contains all errors) via Alfred's query box. No need to ask users to grub around in ~/Library or flounder in Terminal here. This is not the Workflow library 2014 deserves, but it's the one it needs Alp (developed by phyllisstein) alp is a Python module for developing Alfred workflows that bridges the gaps between Python and OS X and Python and Alfred, making the process of creating a workflow quick and easy. As it's essentially a collection of shortcuts for common and repetitive tasks, developers will find that working with alp results in less and more efficient code and a generally more sane workflow development experience. A painstaking guide to its various features, bells, and whistles is available in the README at the Github repository. Features: Simplified generation of feedback XML. Shortcuts for bundle ID, storage paths, settings, and arbitrary plist and JSON files. OS X interaction features, including the sending of additional notifications, interaction with the Keychain, and interaction with Spotlight. Internet interaction features, including bundled modules for making and caching HTTP requests, parsing markup data, and sending e-mail. The ability to remove unneeded modules for a svelte workflow bundle. Alfred-Python (developed by JinnLynn) alfred-python is a full-featured python module that helps building Alfed workflow quick and easy. Features: Simple feedback XML generation Provides functions for storing or retrieving cache data Workflow configuration management Includes an easy way to download remote file Easily get bundle id, query arguments, etc. More code example can be found on my own workflows. PHP Workflows (developed by David Ferguson) Workflows is a PHP library for building Alfred 2 workflows using PHP. Installation is quick and easy. Just drop in the Workflows.php class file, import it into your code, and initialize it. Full documentation, with usage examples can be found on David's blog. Features: Simple XML generation Read/writing files as plain text, json, etc. Read/write plist values Find local files Provide access to commonly used paths (home, cache, current, data storage, etc) Easy HTTP/cURL requests Haskell AlfredLibraryInHaskell (developed by raguay.customct) This is a Haskell library for creating Alfred workflows. AppleScript qWorkflow (developed by ursanrazvan) qWorkflow is an AppleScript library for creating workflows with Alfred 2. This library provides an object-oriented approach for working with plist settings files, reading and writing data to files, generating Alfred feedback results, requesting remote data, parsing JSON data, and more. Features: object-oriented approach to write less & more readable code heavily documented with code samples internal workflow introspection (finding the bundle ID, cache & storage paths) generate Alfred-compatible XML feedback with ease saving & retrieving workflow-related settings (with support for default settings file) remote data requests, as well as JSON support sending notifications through the Notification Center various internal utilities that improve AppleScript (string and date manipulation, file system utilities) More info & example workflows created with this support library can be found on the project's github repo Go goAlfred (Developed by raguay.customct) This go library is used to create workflows for Alfred 2 easier in the go language from Google (http://golang.org/). It will automatically create your cache and data directories. It also creates the xml listing for the feedback system. Examples included. Installation and Usage You install the library with:go get github.com/raguay/goAlfred # (You might have to use sudo). Any program that you want to use the library, just place this line in it: import "github.com/raguay/goAlfred" Functions The accessible function calls are: goAlfred.BundleId() - This will get your Bundle Id for your workflow. goAlfred.Cache() - This function returns the location of your cache directory. goAlfred.Home() - This function returns the location of your home directory. goAlfred.Data() - This function returns the location of your workflow's data directory. goAlfred.Path() - This function returns the location of your workflow's directory. goAlfred.Error() - Returns the last error received. AddResult( uid string, arg string, title string, sub string, icon string, valid string, auto string, rtype string) - This function allows you to build up the xml string for returning to Alfred. AddResultSimilar(instring string, uid string, arg string, title string, sub string, icon string, valid string, auto string, rtype string) - This function allows you to build up the xml string for returning to Alfred only if the title is similar to the instring given. goAlfred.SetDefaultString(title string) - This function sets a different default message if no results have been added. goAlfred.GetXML() - This function returns the XML string that needs to be given to Alfred. Bash BashWorkflowHandler (developed by _mk_) Features: create feedback xml save/read preferences volatile and non-volatile get workflow's cache dir get workflow's data dir get workflow's bundle id Usage examples can be found in the README at the GitHub repo. Bash Workflow Framework (developed by djc) BASH workflow framework which makes it simple to create a workflow which allows you to display feedback within Alfred after selecting a result, getting around the issue that "Script Filters are the only way to pass feedback to Alfred." Built to create easy reference workflows, or any other kind of workflow which does not want to leave Alfred immediately on selection of a result. Features: - Two modes for two different kinds of data: static and dynamic. - Creation of a static workflow only requires modification of a CSV-like file. - Static mode handles searching on query for you. - Dynamic workflow can be created using a BASH library ARF+. - Both modes allow for result and field-specific icons, validities, arguments, and autocomplete attributes. Extensive documentation in the README, and examples are included with download. Two methods of installation can be found on the github page. Ruby Alfred2-Ruby-Template (developed by zhauwu) A template for Ruby-based Alfred 2 workflow development. Features: Use standard bundler to easily package, manage, and update ruby gems in the workflow. Friendly exception and debug output to the Mac OS X Console Automate rescue feedback items to Alfred when something goes wrong. Automate saving and loading cached feedback Alfredo (developed by Dennis Paagman) Alfredo is simple ruby gem that makes it easy to create workflows and items to it. You can get started with only 4 lines of code. Features: Generates valid Workflow XML Add items with one line of code Supports all Alfred 2 workflow features Swift AlfredSwiftLibrary (developed by raguay.customct) General Alleyoop (developed by phyllisstein) Alleyoop is a meta-workflow that implements a system for updating other workflows. Users can make use of its features by downloading the workflow module and entering the query oop, which searches for compatible workflows and checks for available updates. Developers can implement Alleyoop compatibility with two simple, human-readable JSON files, described in the original post: one stored on a remote server, one placed in the workflow's folder. Alfred Dependency Downloader Framework (developer by Shawn Rice) Do you want to have versioned libraries and utilities live side-by-side? Do you want to make your workflows smaller but keep or expand the functionality with helper apps? Do you want to make sure that everything works regardless of whether Gatekeeper is active on other users' computers? Then you might consider implementing the Alfred Bundler* dependency framework in your workflows. If you want to see a _very_ basic implementation, then download an example workflow from Packal and open it up to see the workflow's anatomy. The libraries / utilities mentioned below are just pre-defined assets that you can load with no additional work. You can actually use this framework for any asset** by including a small JSON file with your workflow. Take a look at the documentation page on Github or the original post for more information.