Jump to content

Workflow Picker


Recommended Posts

Workflow Picker

 

Newly updated to work with Alfred 3

 

Select from Installed Workflows

 

I have more workflows and associated keywords and script filters than I can remember. Rather than going into Alfred’s Preferences, I wanted a quick way to see the keywords & script filters available in the workflows I have installed, (optionally) grouped by the categories that have been available since Alfred 2.2. Inspired by Shawn Rice’s Workflow Help workflow and deanishe’s Appscript workflow, I put this together.

 

There are five keywords:

  • wfa - List all installed keywords/script filters
  • wfp - Select a category to list keywords/script filters
  • wfc - List keywords/script filters within a category alphabetically
  • wfg - List keywords/script filters within a category, grouped by workflow
  • hot - List all hotkeys (this does not execute the hotkey - it’s just a way of seeing them all, and potential hotkeys which have no key assigned)

 

By default, wfp outputs to an Applescript which calls wfc on the selected category. This can easily be changed in the workflow layout in Alfred Preferences to call wfg instead.

Alfred 2 compatible version hosted at http://public.dfay.fastmail.fm/alfred/Workflow%20Picker.alfredworkflow

 

Alfred 3 compatible version hosted at

https://www.dropbox.com/s/14sxodqbyoqa74n/Workflow Picker 3.alfredworkflow?dl=0

 

Version History:

  • 2014–05–13: initial release
  • 2014–05–15: 1.01 updated to make sure prefs.plist file with categories exists
  • 2014–05–15: 1.02 added wfa, updated prompts
  • 2014-05-20: 1.03 added hot
  • 2014-05-22: 1.04 updated to make afp and hot filter by query
  • 2016-05-20: 3.0 updated for Alfred 3

 

Edited by dfay
update url
Link to post
This is a great idea for a workflow, but I'm hitting an issue. I don't have a prefs.plist file in my workflows directory. So, when I try to run wfp, I get this error log:

 


Starting debug for 'Workflow Picker'
 
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 22:27:27 workflow.py:1256 ERROR    [Errno 2] No such file or directory: '/Users/smargheim/Dropbox/Alfred.alfredpreferences/preferences/workflows/prefs.plist'
Traceback (most recent call last):
  File "/Users/smargheim/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.EB3BA534-54EA-4950-8F05-7815C0A63EDA/workflow/workflow.py", line 1254, in run
func(self)
  File "categories.py", line 38, in main
pl = readPlist(workflowPath)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 75, in readPlist
pathOrFile = open(pathOrFile)
IOError: [Errno 2] No such file or directory: '/Users/smargheim/Dropbox/Alfred.alfredpreferences/preferences/workflows/prefs.plist'

Where else might this file be? I back up Alfred to Dropbox, so (as you can see) my .alfredpreferences directory is there. Does that change something?

Link to post

This is odd, b/c it means the script has successfully read your prefs in ~/Library/Preferences/com.runningwithcrayons.Alfred-Preferences.plist (which aren't synced) and found the syncfolder key therein.  And the path that is created looks correct.

 

Looking in the ....Alfred.alfredpreferences/preferences/workflows/prefs.plist file, the only thing that is in there is the list of categories.

 

Two questions for you:

 

- are you running Alfred 2.2 or later?  This is the version that introduced categories, and the file may not exist in prior versions.

- have you placed any workflows into categories?  It may be the case that Alfred only creates the file if new categories are created, not by default.

Link to post

Try the new version I just posted as well -- it should avoid the error message in any case.

Hi,

 

When I try your workflow, I get:-

Starting debug for 'Workflow Picker'

[ERROR: alfred.workflow.input.scriptfilter] Code 1: 00:02:43 workflow.py:1256 ERROR    'categories'
Traceback (most recent call last):
  File "/Users/vdesabou/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.00D8AA6A-5472-4597-8407-BF65330664C1/workflow/workflow.py", line 1254, in run
    func(self)
  File "categories.py", line 53, in main
    for i in pl['categories']:
KeyError: 'categories'

Any idea what's wrong?

 

Thanks!

Link to post

Yeah, it's reading your .plist correctly but it seems there's no 'categories' key in your plist.  This probably means you haven't created any.

 

I just posted an updated version which should handle this situation and just default to All.

Edited by dfay
Link to post

It would be good to type in the key and search for those items that match. If I type anything, it just bombs to default search. 

 

Also, The hotkeys is great, but I think it would be best just to not list the ones not assigned yet.

 

Thanks! Great workflow.

Link to post

Updated to filter based on query.  I am leaving assigned and unassigned in the output -- this can be easily changed by editing list_hotkeys.py in the workflow directory & changing the line:

 

results = start+end
 
to
 
# defined hotkeys only
results = start
 
or
 
# undefined hotkeys only
results = end
Link to post
  • 3 months later...

@dfay This is an awesome workflow! 

 

Some feedback:

 

- I have some problems with arrow based keyboard shortcuts. (Error reading Hotkey : Try re-enter ...).

 

-Iin the results, I think it would be better to display modifier keys (cmd,option,ctrl,shift,fn) first, then letters, numbers. Better readability (to me). 

 

Feature request :

 

(When using wfp, wfc, wfg) Would be awesome to be able to filter results by starting typing the workflow's keyword. For example, "wfc Category Name g". 

(When using hot) Would be awesome to filter workflows by keyboard shortcut. 

 

What do you think? 

Edited by politicus
Link to post
  • 2 months later...

Strange if I use wfp I see only the option All, but when I double click on a workflow in alfred preferences, I see the category of the workflow belongs to, for example I see MyIp workflow belongs to internet.

Grep for "prefs.plist" I see no results, but files where prefs.plist is mentioned.

 

Any hint?

Link to post

Hmm....that is a file that seems to exist in some people's Alfred installations and not others.  The workflow checks for its existence, and if it doesn't exist, it defaults to All.

 

Could you try adding a category in Alfred prefs., and/or changing a category?  I'm not sure what it takes for Alf to generate this file.

Link to post
  • 1 year later...
  • 1 year later...

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