Jump to content

Search the Community

Showing results for tags 'script filters'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
    • Advanced Tips & Tricks
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting


  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Website URL




Found 3 results

  1. Add fuzzy search to your Script Filters This is a simple script you can add to your Script Filters to replace "Alfred filters results" with a fuzzy search algorithm. https://github.com/deanishe/alfred-fuzzy How it works Instead of calling your script directly, you call it via fuzzy.py, which caches your script's output for the duration of the user session (as long as the user is using your workflow), and filters the titles of the items emitted by your script against the user's query using a fuzzy algorithm. Example usage fuzzy.py only works in Script Filters, and you should run it as a bash/zsh script (i.e. with Language = /bin/bash or Language = /bin/zsh). Instead of running your own script directly, place ./fuzzy.py in front of it. For example, if your Script Filter script looks like this: /usr/bin/python myscript.py You would replace it with: # export user query to `query` environment variable, so `fuzzy.py` can read it export query="$1" # or if you're using "with input as {query}" # export query="{query}" # call your original script via `fuzzy.py` ./fuzzy.py /usr/bin/python myscript.py Note: Don't forget to turn off "Alfred filters results"! Caveats As the script is written in Python and uses a more complex matching algorithm, it can only handle a few thousands items at most before it becomes irritatingly sluggish (Alfred can handle many tens of thousands). If there's interest in the script, I will rewrite it in a compiled language. My Go library uses the same algorithm, and it can comfortably handle 20K+ items. You can grab a demo workflow from GitHub to see it in action. See the GitHub repo for more information.
  2. So, this popped up over in the help forum, but this is a better place for it to solicit feedback, methinks. Currently, Alfred allows you to specify alternate subtitles for the result items returned by Script Filters, so that you can let the user know which action would be run. Looks like this: <item arg="/path/to/Ideas.txt" uid="/path/to/Ideas.txt" valid="yes"> <title>Ideas.txt</title> <subtitle>Open file</subtitle> <subtitle mod="cmd">Reveal file in Finder</subtitle> <subtitle mod="alt">Trash file</subtitle> </item> Whereby the Script Filter is connected to three different Actions. The suggestion is to turn the alternate subtitles "inside out" and add a <mod> (or <alternate>) tag that can override not just the subtitle, but any of the item's parameters (that make sense): <item arg="/path/to/Ideas.txt" uid="/path/to/Ideas.txt" valid="no"> <title>Ideas.txt</title> <subtitle>Search in Ideas.txt</subtitle> <icon type="fileicon">/path/to/Ideas.txt</icon> <mod key="shift" valid="yes" arg="/path/to/Ideas.txt"> <subtitle>Open this file</subtitle> <!-- the super-smart workflow has figured out the default app for this filetype --> <icon type="fileicon">/Applications/Sublime Text.app</icon> </mod> <mod key="cmd" valid="yes" arg="/path/to/Ideas.txt"> <subtitle>Reveal in Finder</subtitle> <icon type="fileicon">/Applications/Finder.app</icon> </mod> <mod key="alt" valid="yes" arg="/path/to/Ideas.txt"> <subtitle>Trash</subtitle> <icon type="icon">trash.png</icon> </mod> </item> This would have a few advantages: It's possible to set an item to invalid for if, say, you want to require an additional argument by default, but override that in alternate actions. Currently, an action is always valid or never valid (this was the starting point). You can change not just the subtitle, but also the title and/or the icon, providing more and better contextual information (don't forget, some users turn off subtitles) You can change the arg. This means you can avoid a plethora of Run Scripts/Open URL actions and instead generate alternate URLs (e.g. to different search engines) right in your Script Filter and connect it to just one Open URL action. The same goes for copying different representations of data (e.g. colours, emoji or other non-ASCII text) to the pasteboard. (This would also require Alfred to allow multiple connections to the same Action/falling back to the "bare" action if there isn't another connection for the modifier) By avoiding hard-coded actions, it makes it easier to allow users to configure workflows without having their changes overwritten by a workflow update (which necessarily happens to any user-added actions and connections in a workflow) It wouldn't make sense to be able to override all of an item's options (e.g. uid, copy text and large text). It strikes me (and Florian) as a powerful addition. What do you think?
  3. This is best explained with an example: The Amazon Suggest and Google Suggest workflows work fine on fast internet connections. On a slow connection however, it can take a noticable amount of time to load the suggestions. To make those Workflows more usable, i tried to alter them to output the input value as first feedback item, and do that before any connection is even made. The problem now is, that the output of a script is only read once, when the script finished executing. This python script: import time xml = """ <items> <item uid="0" arg="~/Desktop" valid="YES" autocomplete="Desktop" type="file"> <title>Desktop0</title> <subtitle>~/Desktop</subtitle> <icon type="fileicon">~/Desktop</icon> </item> """ print(xml) time.sleep(5) xml = """ <item uid="0" arg="~/Desktop" valid="NO" autocomplete="Desktop" type="file"> <title>Desktop1</title> <subtitle>~/Desktop</subtitle> <icon type="fileicon">~/Desktop</icon> </item> <item uid="0" arg="~/Desktop" valid="YES" autocomplete="Desktop2" type="file"> <title>Desktop2</title> <subtitle>~/Desktop</subtitle> <icon type="fileicon">~/Desktop</icon> </item> </items> """ print(xml) outputs all items, but does so only after 5 seconds, while i think the expected behaviour would be to output the first item immediately, and then the other ones after 5 seconds. A related problem I have is that when a script outputs multiple <items> groups, only the first one is processed. If Alfred would only read the last one, and combined with the previous problem, a script could also change feedback items while it is running.
  • Create New...