Jump to content

Manual actions on results of script filters


Recommended Posts

I'm writing script filters that return file results in the XML format described elsewhere in this forum (example below). The filter works fine in that I can invoke it in Alfred and I see the correct results presented by Alfred.

 

I expected to be able to manually use right-arrow to invoke actions on the results. Unfortunately, the right-arrow doesn't seem to have any effect. I can wire up a specific action in the workflow and that works, but I'd like it to be manually specified.

 

(BTW, I have also tried file filters and they allow manual actions to be performed on their results. However, file filters are not general enough to do some of the things I would like. E.g., just return the files that are one level deep in a particular directory. Hence I am trying the more general script filters.)

 

Can anyone help? Is there some way to manually action script filter results or is this not supported?

 

PS. Example of results:

 

<?xml version="1.0"?>
<items>
  <item arg="/Users/asloane/Projects/Kiama/repos/kiama-1.3.0" uid="/Users/asloane/Projects/Kiama/repos/kiama-1.3.0">
    <title>kiama-1.3.0</title>
    <subtitle>/Users/asloane/Projects/Kiama/repos/kiama-1.3.0</subtitle>
    <icon type="fileicon">/Users/asloane/Projects/Kiama/repos/kiama-1.3.0</icon>
  </item>
  <item arg="/Users/asloane/Projects/Kiama/repos/kiama-profile" uid="/Users/asloane/Projects/Kiama/repos/kiama-profile">
    <title>kiama-profile</title>
    <subtitle>/Users/asloane/Projects/Kiama/repos/kiama-profile</subtitle>
    <icon type="fileicon">/Users/asloane/Projects/Kiama/repos/kiama-profile</icon>
  </item>
  <item arg="/Users/asloane/Projects/Kiama/repos/kiama-profile.save" uid="/Users/asloane/Projects/Kiama/repos/kiama-profile.save">
    <title>kiama-profile.save</title>
    <subtitle>/Users/asloane/Projects/Kiama/repos/kiama-profile.save</subtitle>
    <icon type="fileicon">/Users/asloane/Projects/Kiama/repos/kiama-profile.save</icon>
  </item>
  <item arg="/Users/asloane/Projects/Kiama/repos/kiama-rwtypes" uid="/Users/asloane/Projects/Kiama/repos/kiama-rwtypes">
    <title>kiama-rwtypes</title>
    <subtitle>/Users/asloane/Projects/Kiama/repos/kiama-rwtypes</subtitle>
    <icon type="fileicon">/Users/asloane/Projects/Kiama/repos/kiama-rwtypes</icon>
  </item>
</items>

 

 

Link to comment

This function currently isn't available in Alfred. The reason for this is, with the default results and other items that you have the ability to action in Alfred, results are available for a known type of data (e.g. a file, a folder, a contact). With script filters, there could be any kind of text that is passed as the argument so the default actions may not apply to the type of data that is passed as the argument of your script. So, the only way that this would work would be for there to be a mechanism in place for your to create custom actions for a workflow and that isn't available.

Link to comment

Thanks for your reply.

 

Custom workflow actions may be useful in the general case, but it would be a smaller step to provide a way to pass script filter results to the standard set of file actions (on the assumption that the results are actually file paths).

 

Anyway, it's a pity since I've been waiting for v2 to get more customisable filtering. E.g., "one level deep filtering" is something I would like to use a lot. It's tantalisingly close now...

 

Is it worth me submitting a feature request for the file-specific case of custom actions?

Link to comment

I'm actually refining a few bits of this XML today, and adding an item type as file is on the plan. If the file exists, Alfred will standardise the arg (expand and standardise the ~/) and treat it like any other file based result in the default results; i.e. Buffer, Actions, Revel In Finder shortcut etc.

 

My original reasoning for needing this in the XML as it should better support if somebody were to create a NAS search type live search filter returning files.

 

The XML will look something like this:

  <item uid="filter.desktop" arg="~/Desktop" valid="YES" autocomplete="Desktop" type="file">
    <title>Desktop</title>
    <subtitle>~/Desktop</subtitle>
    <icon type="fileicon">~/Desktop</icon>
  </item>

The important part is type="file" on the item. Just for completeness, I'm also going to add type="file:skipcheck" which will skip the file exists check, in case it's on a slow NAS or drive, which could get in the way of results showing quickly if you know the files being returned do already exist.

 

This will be in the next build, after b94 :)

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