Jump to content

Hiding default results from script filter results


Recommended Posts

I've created a script filter interface to my nvAlt notes. The keyword is 'n <optional argument>'. Pressing 'n<space>' shows all of my notes; any argument is used to filter the list.

 

My problem is that default results, such as contacts and apps, are also added to Alfred's results list, not just what my script filter returns. Is there a way to hide these?

 

Cheers

Nick

Link to comment

I've created a script filter interface to my nvAlt notes. The keyword is 'n <optional argument>'. Pressing 'n<space>' shows all of my notes; any argument is used to filter the list.

 

My problem is that default results, such as contacts and apps, are also added to Alfred's results list, not just what my script filter returns. Is there a way to hide these?

 

Cheers

Nick

 

How would Alfred know whether or not you were trying to action the workflow/script filter or doing a generic search for other matching items? Should prob just try setting a different keyword.

Link to comment

Alfred wouldn't know, but I would which is why I've the specific keyword I've chosen. I assumed the script filter results would override any other results. It would be nice to have an option to suppress default results.

 

It's crazy to think I'd have to keep trying different keywords until I find one that doesn't return default results.

 

Alfred wouldn't know, but I would which is why I've the specific keyword I've chosen. I assumed the script filter results would override any other results. It would be nice to have an option to suppress default results.

 

It's crazy to think I'd have to keep trying different keywords until I find one that doesn't return default results.

 

But by following that logic, you are basically saying "Alfred should know that I am wanting to execute this script filter and not perform a search". How would he know that? It still matches other items. Following that, if I typed 's', Alfred should read my mind and know that I want Safari and not show results for Sublime Text, App Store, Sequel Pro, System Prefs, Sharing, etc. I know it sounds like a silly example, but its the same principle.

 

If Alfred didn't show other results just because it matched a keyword for a script filter, then I would never be able to launch Rdio because the workflow to search Rdio's keyword is rdio.

Link to comment

That's not exactly what I meant. A disconnect occurs between me and Alfred because I'm using an optional argument on the script filter out of necessity, but actually intend for their to be an argument in practical use. 

 

I type 'n' and the script filter shows a list of existing files. Then I either select one of the existing filenames or type a new string which gets passed to nvAlt and created as a new file. I need the optional argument in order to show the list of existing files to begin with.

 

Alfred, quite rightly, matches the script filter and default results the moment I press 'n'. Now that I've actually thought about it, I see there's no reasonable alternative and given that my script filter results are prioritised it's really a non-issue anyway.

Edited by Nick T
Link to comment
  • 8 months later...

I think we could get around this if the developers add the option for a script filter to only activate/show its results if the user presses 'enter' after they type the keyword. I too have this problem as I've set up a script filter called 'sync' and it also shows two applications that the 'sync' keyword applies to.

If I had the option in Alfred, I would gladly have it set to run the script filter only when I chose the 'sync' workflow in the results and press the 'enter' key.

Link to comment

I think we could get around this if the developers add the option for a script filter to only activate/show its results if the user presses 'enter' after they type the keyword. I too have this problem as I've set up a script filter called 'sync' and it also shows two applications that the 'sync' keyword applies to.

If I had the option in Alfred, I would gladly have it set to run the script filter only when I chose the 'sync' workflow in the results and press the 'enter' key.

Unfortunately, that doesn't solve the problem of "how can Alfred know if you want the sync workflow or other results containing 'sync'?".

If you, as the developer, set some flag to ensure that only the workflow is shown, you'd likely break things for any of your workflow users who want to use an app called "sync".

In such cases, a good solution is to use a keyword like ".sync" or "/sync", not just "sync". This will do what you want, and won't make other results inaccessible.

Edited by deanishe
Link to comment

Unfortunately, that doesn't solve the problem of "how can Alfred know if you want the sync workflow or other results containing 'sync'?".

If you, as the developer, set some flag to ensure that only the workflow is shown, you'd likely break things for any of your workflow users who want to use an app called "sync".

In such cases, a good solution is to use a keyword like ".sync" or "/sync", not just "sync". This will do what you want, and won't make other results inaccessible.

 

Currently I do have my sync workflow keyword with a period before it ".sync" to get around ths issue. But by "developers" I meant the team behind Alfred itself.

 

I am really not sure if script filters provide this feature already but I've made two images to illustrate my problem better:

 

What it currently does (mixes the script results in with the default results if you don't use a unique keyword):

 

JEZ15be.gif

 

What I'd like it to do:

xIPDwoD.gif

Edited by jaster
Link to comment

Actually, you can do this now.

 

So, just make a keyword (not script filter) called "sync" and attach it to a "run script" (Applescript) object.

 

Next, create an "External Trigger" that links directly to a script filter that has no keyword, space not required, argument required. To get Alfred to let you save a script filter without a keyword, you'll have to enter something like the placeholder text, but it really doesn't matter. Then, put the contents of your current script filter in the keyword-less script filter.

 

Lastly, make that Applescript "run script" option to invoke the External Trigger.

 

Now, when you type, your keyword will appear, and, after the user presses enter, it will invoke the script filter.

 

(Note: current pre-release needed).

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