Jump to content

File Filter and Run Script if no results are found


Recommended Posts

Hi everyone, I am trying to create a workflow that has a File Filter which shows list of files in the specific directory and opens it in a specific app (VS Code in this case). If the file is not found, I should be able to:

 

- Open VS Code, or

- Create a file and open it in VS Code. 

 

However with File Filter, I am not able to figure out a path forward once no file is found. I somehow need to be able to connect that to Run Script so I can do the above actions. Any suggestions please?

Link to comment

A File Filter’s purpose is to find paths, it must pass something along. Passing nothing would be unpredictable without prior setup. A simple way to do what you want is to add a Keyword Input and have its keyword be the same as the File Filter’s. That way when the File Filter has no results, the Keyword will still now. Note that for It to work you have to type the full File Filter Keyword, you can’t type part of it then ↩ to autocomplete, because that will tell Alfred that’s specifically what you want and won’t show the Keyword Input.


Another option is a Fallback Search Trigger.

Link to comment

Thanks for the keyword suggestion. But then it shows up like this (1st one is file filter, second is keyword):

 

851995750_ScreenShot2022-08-04at13_56_08.png.ef4f8e5b582d229174b8dc7aa1cb95db.png

 

 

Anyway I can just have keyword and pass in the args from keyword search to the file filter, and then file filter's functionality starts working?

 

 

Link to comment
On 8/4/2022 at 9:57 PM, andy4222 said:

But then it shows up like this (1st one is file filter, second is keyword)

 

Isn’t that the ideal scenario?

 

On 8/4/2022 at 9:57 PM, andy4222 said:

Anyway I can just have keyword and pass in the args from keyword search to the file filter, and then file filter's functionality starts working?

 

Connect one directly to the other.

Link to comment
1 hour ago, vitor said:

Connect one directly to the other.

Then I need to press enter before before the File Filter kicks and starts showing suggestions. I was looking for something where as soon as I start typing, all files/folder start showing up, if nothing exists, it offers me to create a file for me. I can think of Script Filter that can do this, but I don't wanna build a File Filter functionality within Script Filter

Edited by andy4222
Link to comment
11 minutes ago, andy4222 said:

was looking for something where as soon as I start typing, all files/folder start showing up

 

That’s the File Filter.

 

11 minutes ago, andy4222 said:

if nothing exists

 

You will only see the Keyword Input.

 

Why isn’t that workable?

Link to comment

This is what I did. When I type "code", it shows only one options which is fine, but doesn't show any suggestions (picture 2). So I have to press enter, then it takes me to a File Filter where it starts showing suggestions (pic 3). I want it to start showing suggestion in box 2, but if anything isn't available, it should provide me ability to create a file via Run Script

 

 

image.thumb.jpeg.8350c1c973445a3fadcde02f51587240.jpegimage.thumb.jpeg.c03c06f685f32ae884e0be6f3eff771f.jpeg

 

 

image.thumb.jpeg.4d7c7402d0d76f73e239620a8f289df4.jpeg

 

 

 

 

 

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