DonationCoder.com Software > Find And Run Robot
FARR alias for choosing program based on file extension
wjamoe:
run simple commands on the file in search window
just add
[Enter] run in DOS window $$5 $$4-file | %systemdir%\cmd.exe /k $$5 "$$1"
usage
c:\path somewhere on your disk\names.txt .sort
will start msdos window which shows the sorted lines from names.txt
c:\path somewhere on your disk\names.txt .notepad
to open file names.txt with notepad
other possible commands :
type, del, remove, cd, c:\path\par2, c:\path\unrar x, ...
wjamoe:
BIG speed optimization for the extension alias,
when using this you can use two spaces between filename and the command (instead of spaces and a dot)
replace
regex ^((.+)\\(.+)\.(\S+))\s+\.(.*)$
by
regex ^((.+)\\(.+)\.(\S\S+))\s\s(\S*)
which reads as
anly line containing a '\' (=this is part of the path of the filename)
some characters
a '.' (=start of the file name extenstion)
at least two characters but not spaces (=file name extension, this helps when browsing for files)
followed by two spaces (=the separator between the file name and the command)
and a number of non-space characters (the command to look for in the extension alias)
For the filemanager shell extension, replace the dot by a space):
so replace
HKEY_CLASSES_ROOT\*\shell\FARR file\command] @="\"c:\\filemngr\\farr portable\\FindAndRunRobot.exe\" -search \"%1 .\""
by
HKEY_CLASSES_ROOT\*\shell\FARR file\command] @="\"c:\\filemngr\\farr portable\\FindAndRunRobot.exe\" -search \"%1 \""
BTW the second alias for items without extensions is optional.
Njoy
Wjamoe
IainB:
Nifty! (Assuming it works - I haven't had time to try it yet.) :Thmbsup:
wiem:
Simpler easier to maintain version with incremental search for program in list.
Use Case
you want to open a file with a specific program (not being the default)
How to
find a file or folder using farr
copy file to searchbox (cursor down, cursor right)
add one or more spaces and -- after the filename or folder
then select one of the programs from the list
or do an incremental search through the list by adding searchstring character after the '--' you just entered.
You need to define the following alias:
alias name: Choose program to load
alias regular expression: (.*)\s+--(.*)$
alias filter field : $$2
Use the following alias results (programpaths on your machine will most likely be different):
[Enter] view VLC| %programfiles%\vlc\vlc.exe "$$1"
[Enter] view IRFANview | %programfiles%\irfanview\i_view32.exe "$$1"
[Enter] edit notepad | c:\windows\notepad.exe "$$1"
[Enter] edit gvim | %programfiles%\vim\gvim.exe "$$1"
[Enter] goto totalcmd |%programfiles%\totalcmd\totalcmd64.exe /o "$$1"
[Enter] browser chrome|%programfiles%\chrome\chrome.exe "$$1"[Enter] copy to CLIPBOARD | copyclip $$1
[Enter] run deafult| shellexe $$1
To open the html file with your default browser
c:\User\Wiem\Documents\test.html --run
then press [Enter]
To open the html file with chrome browser
c:\User\Wiem\Documents\test.html --chrome
then press [Enter]
To open the html file with an editor you would type
c:\User\Wiem\Documents\test.html --edit
then choose the editor you want to use, and then press [Enter]
To open the html file with notepad you would type
c:\User\Wiem\Documents\test.html --pad
then press [Enter]
To open the html file with graphical version of vim (the greatest editor ever ;-) you would type
c:\User\Wiem\Documents\test.txt --gvim
then press [Enter]
A few notes:
Keep the descriptions before the '|' character unique, then the searchstring can also be kept short...
The text [Enter] is just a reminder that you must press the [Enter] key to really execute the command.
Njoy ;)
wjamoe
Nod5:
Nice! Here is a helper hotkey script to more quickly go from a regular FARR search to activating the "choose program" alias for the first search match by using an exclamation character as keyboard shortcut.
--- Code: Autohotkey ---#NoEnvSendMode InputSetWorkingDir %A_ScriptDir%#SingleInstance forceListLines, OffSetBatchLines, -1SetWinDelay, -1SetControlDelay, -1 ; choose program FARR alias helper hotkey script.ahk; 2020-05-23; by Nod5 #IfWinActive, ahk_exe FindAndRunRobot.exe; press ! to expand first FARR match file path and append --!:: ControlGetFocus, vFocusControl, A ; if FARR search box focus and options not open if (vFocusControl = "TEdit1") if !WinExist("ahk_class TOptionsForm") { ; show first result file full path in FARR search box Send {down}{right} ; append -- to trigger "choose program" alias Send -- }Return#IfWinActive
Screenshot of the alias
Gif of how it all works
https://imgur.com/a/YzJlRhx
(Edit: cannot embed .mp4 video in forum posts it seems so I added link to Imgur instead)
Edit2: mouser could uppdate FARR with special variables that represent the full path of a file result, maybe %resultfile1% or similar. Then we could skip the AutoHotkey script and instead make an alias that triggers on "!" anywhere in the searchbox and reacts by doing "restartsearch %resultfile1% --".
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version