Jump to content

Script Filter: Mixing fixed and smart ordering?


Recommended Posts

For a Script Filter, I want to use Alfred's smart ordering, which one can produce by passing in uid's to items. However, I want to exclude precisely one item from this, which I always want to be the top result. Is there any way to get the best of both worlds? 

 

Incidentally (and maybe this should be a separate question), in my system, this fixed item is always (intentionally) invalid: it is additional information that just hangs in there. Is there any way to make the default selection (what gets actioned if we press return) start at the first valid entry? 

 

Thanks!

  Abhijit

Link to comment

This doesn't answer your question directly, but one approach which i've used is to set the subtitle of items to display additional info. Another trick I've used is to create multiple items with the same keyword.  I use both in this example:

 

 

Screen Shot 2020-06-29 at 8.48.16 PM.png

Link to comment

Thanks for the response, @dfay. I do use subtitles for information about the items. What this top item is doing is information about the entire list of responses.

 

What I am doing is this: I  have set up a system, backed up by a local database, where I can set up sets of contexts (people, projects, etc), and for which I can capture URLs, file links, and other bookmarkable paraphernalia. Now, for a given hub, all these possibilities are shown, plus other possibilities such as "Create an omnifocus project for this" (shown only if none exists), "Create a Devonthink group", etc. All the heavy lifting is done by python scripts, and Alfred's role is showing the responses and shuffling state around, and enabling the possibility of filtering down shown responses based on what I type in the box. The box real estate is thus at a premium, and I don't have space to show what item the responses are for (the python script gets it through variables, not through argv).

 

What I need, then, is a way to show a response at the top announcing "This is me!". Currently, I do have that, but it can be anywhere. A distinct icon helps me see it if it is in the top 9, but a little additional UI assistance from Alfred will help.

 

Hope that explains the strange request :)

Link to comment

Does the "This is me!" item need to respond to the script filter or is it going to be fixed regardless of the search?  If not you could create a new trigger with a name which is a subset of or the same as your existing keyword.  Then if you trigger it a couple times it should always appear before the filter.

Screen Shot 2020-06-30 at 5.59.00 PM.png

Edited by dfay
Link to comment

 

It depends on the query (which  is coming in through vars). Here, I show some results when the query context is "Alfred". The distinct logo tells me that this is the context. When the context is a URL, it can be very long and I can't stuff it into the query box and still have space for additional words that filter down the result set.

 

 

730539045_ScreenShot2020-06-30at8_58_00PM.thumb.png.7eb17c257d872ad62f440c52d8106fe1.png

Link to comment
On 6/30/2020 at 12:52 AM, amahabal said:

Is there any way to get the best of both worlds? 

 

You can't set UIDs and impose ordering at the same time. What might work for you is only setting UIDs if there's a search query. That way, you can have your informational item at the top (and other items in a predictable order), but still train Alfred to associate specific items with specific queries.

 

On 6/30/2020 at 12:52 AM, amahabal said:

Is there any way to make the default selection (what gets actioned if we press return) start at the first valid entry?

 

No, but if you do the above, your default results should be in a predictable order, and you can also omit the invalid/informational items when there's a query.

Link to comment
  • 2 weeks later...

Thanks, @deanishe, I followed your suggestion and it works reasonably well.

 

Do you know what happens if two results have the same UID? One way I could simulate this "top order fixed" behavior is to have the fixed items share UIDs. Quite soon, they will be the most popular follow ups and will show as a group at the top, ordered by the order they were seen in responses. But this strategy hinges on how repeated UIDs are treated.

 

--Abhijit

Link to comment
2 hours ago, amahabal said:

Do you know what happens if two results have the same UID?

 

Don't know. In any case, if I've understood correctly, I don't think that will work. Alfred bases its rankings on how often an item is actioned (for a specific query). Informational items typically can't be actioned, so if you assign UIDs, they'll sink to the bottom, not rise to the top.

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