Jump to content
nikivi

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 : 

 

WzeQDRJ.png 

 

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.

Share this post


Link to post

I just realised that I can solve it by connecting the trigger to the clipboard so this works. 

 

PW44G4V.png 

Edited by nikivi

Share this post


Link to post

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 : 

 

UGxOCSW.png 

 

I can then create quick helpers in KM like this : 

 

Uh02i3a.png 

 

And then call it from Alfred : 

 

Eu8jHxR.png 

 

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

 

MFfhetB.png 

 

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.

 

 

 

Share this post


Link to post

Now that I think of it, you can actually create a pretty handy library of actions this way in KM, and then all you need is to call an applescript of it.

Share this post


Link to post

Actually sadly that only solves the 'selection in macOS' trigger.

 

If I do actually do want to make a search from an external trigger, it doesn't save the query. How can I save a query from there if I can?

 

Here is the workflow at its current state : https://transfer.sh/c2BJI/search-for-content.alfredworkflow

 

Thank you for any help.

Edited by nikivi

Share this post


Link to post

@nikivi I haven't had a chance to look at your workflow, but you may find the Arg/Vars utility useful, as it can be used to save a query as a variable if needed.

 

Save it as a variable, then use {var:name} to use it later on in your workflow :)

https://www.alfredapp.com/help/workflows/advanced/variables/

 

Let us know how you get on!

 

Cheers,
Vero

Share this post


Link to post

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

Share this post


Link to post

The only way I see to solve this is this : 

 

IynLqJN.png 

 

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

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post
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.

Share this post


Link to post
10 minutes ago, deanishe said:

 

 

I think these are currently your only two options.

 

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

The following is in the Feature Request section of the forum from 2013:

 

Share this post


Link to post

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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...