Jump to content

Custom XML in File-Filter


Recommended Posts

Yes. Just spit all the results out of your Script Filter and select the "Alfred filters results" box.

 

Alfred will call your Script Filter once to get the results, then take care of the filtering for you. It won't call your Script Filter again until you leave and restart the workflow.

Link to comment
  • 1 month later...

Yes. Just spit all the results out of your Script Filter and select the "Alfred filters results" box.

 

Alfred will call your Script Filter once to get the results, then take care of the filtering for you. It won't call your Script Filter again until you leave and restart the workflow.

I'm sorry this isn't entirely clear to me. I don't have a script filter right now. I have a file filter that works but I want to replicate the behavior of the default file-filter block using a script filter. In particular I'm searching through contacts from Address Book right now and rather than just show the contact name, the default contact icon, and "View in Alfred", I'd like it to be the contact name, the contact's picture if it exists as the icon, and the subtext can be any option I choose from the contact card. What you seem to be suggesting is that I generate xml for all the contacts and pass that to Alfred and let it filter it down. This seems like it would be slow if you have a lot of contacts. I guess I could cache this xml somewhere and update it in the background each time the script is run but that doesn't seem very elegant. I would think you would just run the script on a partial match of the first few characters (1 or 2) so as to dramatically reduce the subset and then filter it from there.

Link to comment

If you want Alfred to do the filtering for you, you need to give it a list of all the data.

Otherwise you need to handle filtering the results based on the query yourself. You'd likely want to do that anyway in this case, as Alfred only performs a "word starts with" comparison on the item title, and you'd presumably want to search other fields, too.

My MailTo workflow uses the contacts database, and I found the best way was to cache all the contact data in a background process and only use the cached data in the workflow. The AddressBook API was too slow for my liking (I was probably using it wrong).

Edited by deanishe
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...