You can do this thing now, with this set of aliases
-skajfes
Thanks skajfes! I forgot about
alias action keywords when I wrote the previous posts
I also now realize that I wasn't clearly separating two distinct goals
Goal 1. customization of how the results look while we type and FARR narrows down the search for files and folders
Goal 2. custom actions for search results once we press Enter (or another keyboard shortcut), e.g. show results as HTML in FARR.
My first post mixed goals 1 and 2 and my second post shifted only to only cover goal 2.
Your suggestion with alias action keywords is great for goal 2. Simpler and faster than my AutoHotkey script workarounds.
Here is my variant of the two alias method you describe to make Enter perform the action
show result as HTML in FARR.
alias1: html_alias
regex: <nothing>
result: showfilehtml $$1
alias2: tldr
regex: ^tl (.*)
result: dosearch +html_modifier $$1 +html_alias -alias
In FARR options create a search folder with the location of the .html files and the keyword "html_modifier".
I added -alias in the regex above since otherwise the search also matched other aliases at the top of the results list.
I put the +html_modifier before the $$1 variable because otherwise dosearch triggered another alias I had whose regex reacts to a space at the start of a FARR search.
So far goal 1. Now let us talk about goal 2Do you know any way for alias action keywords to customize how the search results list looks while we search for files in a folder? I can right now only think of this possibility: If we change the helper alias (my alias1 above) result to
regex: HTML: $$1 | showfilehtml $$1 /icon=C:\folder\icon.ico
then once we trigger alias2 and type enough characters to get
a single unique match FARR will automatically (without Enter press) transform that single result line to show "HTML: C:\folder\uniquefile.html" and the custom icon.
But there are two limitations here:
- The custom search result format shows only when we have typed enough to filter in a single result. Before that the results looks like in a regular FARR file search
- We can only use the full file path variable $$1 in the custom format. There is no variable for e.g. filename, filename without extension or other filepath fragments we might want to use.
Compare with my animation from the first post:
https://i.imgur.com/6LEOsFM.mp4 . There the live search results lines have the format
<filename without extension> | showfilehtml <full file path>
I could also have added custom icon(s), for example one that would signal that the action has switched to show the HTML file in FARR. I like that simpler look and think it would be nice to have that possibility built into FARR.
So, I think my now hopefully more clearly stated goal 2 is still something that FARR cannot currently do by itself. Or?
edit: As a sidenote the FARR help page on
Using Alias Action Keywords is a bit unclear (just like me then!
) in this sentence.
When an alias name is specified in this way, anywhere on the search string, it does not effect search, but it will cause the alias results to be displayed AFTER the result file is selected, with the selected file name as argument $$1 in the alias.
Does this rewrite more accurately describe FARR's current behaviour?
When an alias name is specified in this way, anywhere on the search string, it does not affect which file results are shown nor how each result line looks. With one exception: When the search string matches only one unique file then the action keyword alias determines how that result line looks.
However once you press Enter the action keyword alias comes into effect: FARR passes the selected result file path as variable $$1 to the action alias. The action you have set up in the action alias is then performed by FARR.