Jump to content

Is there a way for me from a workflow to forcefully reload its own configuration


Recommended Posts

I am trying to make a fuzzy search within folders, kind of how http://www.alfredforum.com/topic/4042-fuzzy-folders/ does it, but in a more flexible and standard way.

 

Basically I am using a file filter, whose selection is sent to a script that modifies the workflow configuration to edit a secondary file filter keyword which is populated with the directory selected previously, and this can be done recursively without any issue.

 

It works, however, it takes a little bit of time for alfred to pick up the new configuration for the modified filter, so you lose the responsiveness I am looking for.

 

Anyone interested in giving it a try, I uploaded it to https://github.com/hanoii/alfred-directory-search.

 

And the exported workflow to https://dl.dropboxusercontent.com/u/51604079/Dynamic%20folder%20file%20action.alfredworkflow

 

It's pretty simple, and it has one bit that's not complete, but the search and the logic works if you give it a while to reload the config. I have yet one more step to ask for guidance, but until I sort this part, it's not very useful.

 

 

Link to comment

I am trying to make a fuzzy search within folders, kind of how http://www.alfredforum.com/topic/4042-fuzzy-folders/ does it, but in a more flexible and standard way.

 

Basically I am using a file filter, whose selection is sent to a script that modifies the workflow configuration to edit a secondary file filter keyword which is populated with the directory selected previously, and this can be done recursively without any issue.

 

It works, however, it takes a little bit of time for alfred to pick up the new configuration for the modified filter, so you lose the responsiveness I am looking for.

 

Anyone interested in giving it a try, I uploaded it to https://github.com/hanoii/alfred-directory-search.

 

And the exported workflow to https://dl.dropboxusercontent.com/u/51604079/Dynamic%20folder%20file%20action.alfredworkflow

 

It's pretty simple, and it has one bit that's not complete, but the search and the logic works if you give it a while to reload the config. I have yet one more step to ask for guidance, but until I sort this part, it's not very useful.

 

I think it's just triggering the next step before it's done writing the config. Try adding a delay to your script. Doesn't have to be long. In my testing, after the perl command and before the osascript.. I added another line that was

osascript -e 'delay .5'

Adding the half second delay made it work for me.

Link to comment

Hi David,

 

Thanks. Yes, 0.5 did work for me too, and although not a huge delay, it's not as snappier as it could be. I can think of a number of very small improvements to the workflows that could be used here, like maybe using an ENVIRONMENT variable (or internal workflow variable) to feed the file filter. Or maybe just a way that from the script to reload the workflow. I do have to say that with the delay, it's at least very useful.

 

I have one more question, if you saw the workflow, there's a Default ff action tied to a file action. My idea with that, regardless of what it's currently doing, is that while you browse through the folders, when you get to a file (instead of a directory) and hit enter, that default file action should be executed on the script. Doing that can make this workflow be easily extended or configured by others.

 

Is there a way for me from the script to tell alfred to "Lunch the default ff action (the one defined) on a specific file (the one selected)? How that make sense.

 

Like: tell app alfred 2 (run "Default ff action" on xxx).

 

Thanks,

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