Jump to content

How to capture query made in a file filter?

Recommended Posts

I want to capture a query in this file filter of this workflow (https://transfer.sh/9V1Ep/a-search-for-content.alfredworkflow).


Right now it passes a path to the file but I want to save the actual query. For example I highlight some text, press the trigger and it would do this : 




Then if I press on let's say 'cocoa', I want to put this 'highlight' or any other query I made into my clipboard. I am sure you can do it, just not sure how. 


Thank you for any help.

Link to comment

As a note, perhaps someone does use Keyboard Maestro here. 


I really like how I can combine KM and Alfred. I have an alfred utility folder in KM : 




I can then create quick helpers in KM like this : 




And then call it from Alfred : 




It's a lot faster to glue keystrokes, scripts and everything in KM thanks to its spotlight picker of actions. 




The only downside, is that if I want to share this workflow, I actually have to translate all the actions to applescript since I can't assume users owning KM but for quick personal workflows, it has been really productive for me.




Link to comment

Hey @Vero


The issue is not the saving of the query I get but actually getting what I type into the file filter out. Since what I write in the file filter gets passed onto to somewhere I don't know, all I get is the path of the file in the end.

Edited by nikivi
Link to comment

The only way I see to solve this is this : 




Where I first activate keyword, capture my query, put it to clipboard and then with that query I go to file filter. Although this is really hacky and bad since I have to press return twice. Also if I do decide to change my query whilst in the file filter, the clipboard will have the old value. :( 


I wish there was an easier way to do this and get the query straight from the file filter if possible.

Edited by nikivi
Link to comment

Perhaps I should move this topic into 'feature requests' section. I rely on this action a lot in my workflow but I really don't have any idea as to how I can find a solution to this.


Another option is to look into building a file filter of my own but my request seems like such a trivial thing to add and Alfred's file filter is staggeringly fast. I doubt my implementation would be as fast.

Edited by nikivi
Link to comment
  • 10 months later...

Yes, been wanting this feature for years. Here's my scenario:

  1. Use File Filter to search in a folder and within PDF documents for a work order number. For example: wo 12345
  2. A list of PDF's that contain that number are shown.
  3. Open PDF file in Preview. So far, everything works as expected.

Then I would like to take the work order number, in this case 12345, and enter it into Preview's search field. But, I don't have access to the original query. It would be nice if Alfred would save the original query as an internal variable when using File Filter, similar to {query}. It doesn't seem like it would be a breaking change if implemented.


I have tried using a Keyword first, to grab the original query, but then I have to hit enter to see the results. This breaks backspacing to refine the search.

Link to comment
2 hours ago, Codeplus said:

I have tried using a Keyword first, to grab the original query, but then I have to hit enter to see the results. This breaks backspacing to refine the search.


On 08/03/2017 at 4:49 PM, nikivi said:

building a file filter of my own


I think these are currently your only two options.


Sounds like a useful—and relatively simple—feature. You should submit a feature request.

Link to comment

Not quite. They're talking about Script Filters, and it's very easy to capture the query in a Script Filter by creating a variable for the original query (or back when that thread was posted, saving it to a file).


File Filters and List Filters are a very different matter because there isn't a reasonable workaround. So, I don't think a feature request would be at all inappropriate.

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