Jump to content

Allow to relaunch the last file quickly & reliably


ipo
 Share

Recommended Posts

Hello,

I've automated my work around Ruby (.rb) files, and I use Alfred to type the first letters of any such file in order to execute it. Sometimes, I would execute the same file 30 times in 1-2 minutes, because of a repetitive task. Luckily, the Alfred option "Advanced > History > Show latest query" helps me to easily relaunch the last item I've executed. I simply toggle the Alfred window, and press Enter. Everything works perfectly, except that this method is unreliable when used quickly and repeatedly.

The unreliability seems to come from the fact the Alfred is using the Spotlight engine. Two particular behaviours are driving me crazing, and I can reproduce them both with Spotlight and Alfred:

• Sometimes, let's say 1 time out of 15, the particular file I want to launch takes a delay of 1 or 2 seconds in order to appear in the Alfred results. Even if "Advanced > History > Show latest query" is activated, Alfred saves only the query, not the results. When the delay happens, another item is selected, and I launch by mistake an unwanted file.

• Less often, let's say 1 time out of 30, after executing a file very quickly many times in a row, it would suddenly disappear from the results. Not only in Alfred, but in Spotlight. I can't figure out why this happens. Obviously, I tried the option "Advanced > Rebuild macOS Metadata", and the files are on my main drive. The only solution I've found is to copy the file, to delete the original, and to rename the copy as the original. Then, the file reappears.

Sorry for the long post! I guess ultimately my wish is that the Alfred option "Advanced > History > Show latest query" becomes "SAVE last query & RESULTS". This would skip unnecessary Spotlight searches when relaunching the last item, and would make Alfred reliable for me.
 

Edited by ipo
Making it clear that it's not about Alfred workflows
Link to comment
Share on other sites

1 hour ago, ipo said:

Show latest query" becomes "SAVE last query & RESULTS"

 

I don't think that's a good solution. It might work for some workflows, but with others, the results are effectively invalid as soon as a result is actioned or Alfred closed (e.g. a workflow that shows and/or does something with Safari tabs).

 

As such, it would have to be a Script Filter-level option. Even then, it still might lead to unexpected behaviour, as Alfred doesn't have the context your script has to know whether the old results are still valid (e.g. the user has edited whichever data the workflow is using).

 

IMO, your script is a better place for the result-caching to be performed. In a language like Ruby, it's pretty simple to implement a wrapper function that caches data for X seconds.

 

Link to comment
Share on other sites

Hi @deanishe

 

I think my original post wasn't clear enough, and I will redact it, but the Ruby scripts I mention in my original post are not Alfred workflows. They are .rb files that I simply launch, by typing their file names in Alfred. My feature suggestion is about relaunching quickly & reliably the last launched file. This file could be .jpg, .txt or any other extension really; I was mentionning .rb just because it's my own use case.

Edited by ipo
Correcting a typo
Link to comment
Share on other sites

Right, sorry. I figured you were talking about results from running as script, as Alfred always re-populates its own results instantly for me.

 

That said, I don't use it as heavily as you, so perhaps I'm just not noticing the odd delay.

 

I'd agree that caching the results along with the last query would be a good idea. Alfred should still perform the query again, imo, and update the results if something has changed. Same as happens with rerun in a Script Filter.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...