ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Find And Run Robot

FARR alias for choosing program based on file extension

<< < (2/4) > >>

wjamoe:
1) I think my misunderstanding was caused when I used files with multiple dots, take a look at these


--- Code: Text ---(.+\.(.{3,4}))\s?(.*)$file.ex                NO MATCH =>okay extension to shortfile.extension         $$1=file.exte | $$2=exte | $$3=nsion => MATCH, but not what I expectedfilename.extension.mp  $$1=filename.exte | $$2=exte | $$3=nsion.mp => $$2 has value we cannot usefile.ex.ED             $$1=file.ex.E | $$2=ex.E | $$3=D  => $$2 has value we cannot use (I assume that's why you use $$2$$3  as a filter )
I now use

--- Code: Text ---regex    ((.+)\.(\S+))\s?(.*)$filter      $$3 $$4The trailing text($$4) can be used to shorten the list of available programs e.g. add debug or -note or -)) file.sub.ext.mp4 debug   To select the debug from the alias:debug ext menu  1full=$$1 2wo_ext=$$2 3ext=$$3 4filter=$$4  |  Where $$1=file.sub.ext.mp4 | $$2=file.sub.ext | $$3=mp4 | $$4=debug Which displays asdebug ext menu  1full=file.sub.ext.mp4 2wo_ext=file.sub.ext 3ext=mp4 4filter=debug
2) I stand corrected  :-[, Let me rephrase. You need to know the name of the alias, and have to type +hexedit, instead of selecting a program from a short list.

3) Still working on the file tagging functionality ;)

4) I have updated the first post so readers don't have to puzzle as much.

wjamoe:
Update: 2 extended aliases!

Alias to add a farr "context menu" to a file in the farr search field
Alias to add a farr "context menu" to any string in the farr search field not containing a file extension

Each context menu is shown when you append a <space> and a dot and an optional menu match string.

example
farr search fieldc:\user\wim\my documents\test.txt .shows the complete list of menu lines matching extension txt to handle the file test.txt
example:
farr search fieldc:\user\wim\my documents\test.txt .noteshows a list of menu lines matching string 'note' to handle the file test.txt
descriptionalias for file names with extension like .doc, .txt, .ahkusagefull path and file name including extension<space>.<result menu filter>please notefull path and file name may contain spaces and dots,
easiest to copy result from farr search results (or directory traversing) by pressing Cursor-Right-keyaliasfile extension menuregex ^((.+)\\(.+)\.(\S+))\s+\.(.*)$filter$$5 $$4
usage within result(s)value$$1<path>\<file name>.<file extension>$$2<path excluding backslash at end>$$3<file name excluding path and excluding extension>$$4<file extension excluding preceding dot>$$5<result menu filter>
usagedescriptionfarr result entry (copy only this part)file_name .start default windows assocation[Enter] run default prog for -file.$$4 | shellexe $$1file_name .vlc open  mkv avi and mp4 files with vlc[Enter]  VLC (mkv;avi;mp4) | %programfiles%\vlc\vlc.exe "$$1"file_name .viewopen file with any extension in irfanview (image viewer)[Enter] / IRFANview -file.$$4 | %programfiles%\irfanview\i_view32.exe "$$1"file_name .nppopen any file in notepad must include $$4 to match any file extension[Enter] notepad npp -file.$$4 | c:\windows\notepad.exe "$$1"file_name .chroopen file in chrome browser use $$4  to match all file extensions[Enter] chrome -file.$$4 | %myAppData%\Google\Chrome\googlechrome.exe "$$1"file_name .clcopy file name to clipboard[Enter]  FARR copy $$1 to CLIPBOARD  | copyclip $$1file_name .stringshow lines within txt files (current folder and down) containing string using findstr in msdos box[Enter] find string '$$5' in *.txt /s | %systemdir%\cmd.exe /k findstr /S /I /P $$2 "$$2*.txt"file_name.py .stringshow lines within files with same extension e.g. .py (current folder and down) containing string using findstr in msdos box[Enter] find string '$$5' in *.$$3 /s | %systemdir%\cmd.exe /k findstr /S /I /P "$$5" "$$2*.$$3"file_name.doc .make subfolder file_name and move file_name.doc to subfolder, select this option from the result list[Enter] mv $$4-file to subFolder $$3 | %systemdir%\cmd.exe /c mkdir "$$2\$$3";;; %systemdir%\cmd.exe /c move /-Y "$$2\$$3.$$4" "$$2\$$3"
tip:
To always show a certain menu line when adding a dot in the search field, you should use the file extension ($$4) before the '|'.

tip:
The descriptive part before the '|' shouldn't be too long, otherwise the menu line gets cut up weirdly in the farr search results. Therefore use file_extension ($$4) instead of the full pathname ($$1)


A similar alias menu for strings / folders without extensions. This requires a different alias and regex. If you want to use both aliases the one matching no extensions should appear after the one matching extensions.

descriptionfor file names without extension usageany string <space>.<result menu filter without spaces>please notefull path and file name may contain spaces and dotsplease noteeasiest to copy result from search results using cursor right key aliasany string context menuregex^(.+)\s+\.(.*)filter$$2
Some examples of  FARR alias result entries
usagedescriptionfarr result entrystring or url .copy $$1 to clipboard[Enter] FARR copy $$1 to CLIPBOARD  | copyclip $$1folder .show lines within files with same extension (current folder and down) containing string using findstr in msdos box[Enter] find string '$$2' in $$1*.* /s | %systemdir%\cmd.exe /k findstr /S /I /P "$$2" "$$1*.*" string . look up string using duckduckgo.com [Enter] duckduckgo.com '$$1' |https://www.duckduckgo.com/?q=$$1 word . look up word using wikipedia [Enter] lookup  $$1 in WIKIPEDIA| https://en.wikipedia.org/w/index.php?search=$$1&title=Special%3ASearch&go=Go
For wikipedia, copy text below, php table formatting removed some essential details of the wikipedia url.
[Enter] lookup  $$1 in WIKIPEDIA| https://en.wikipedia.org/w/index.php?search=$$1&title=Special%3ASearch&go=Go


tip:
Sometimes pressing the cursor-right-key seems the correct action to execute the command from the new farr context menu, but this will give a strange result (the name of the alias will be copied to the search field). Therefore I placed [Enter] at the beginning of each farr alias result entry to make sure you press the [Enter] key. You can also double click the line and of course use the short cuts F1-F9 for the first nine entries.

tip:
If you edit the registry entries in my other post : how to start FARR from within explorer or total commander(TC). You can include a <space> and a <dot> at the end of the registry entry. When you then start FARR from within TC the above farr context menu will automatically appear. See underlined characters in registry :

[HKEY_CLASSES_ROOT\*\shell\FARR file\command]@="\"c:\\filemngr\\farr portable\\FindAndRunRobot.exe\" -search \"%1 .\""

Enjoy!  ;)

wjamoe:
new/update:
file_name .string   
show lines within txt files (current folder and down) containing string using findstr in msdos box   
[Enter] find string '$$5' in *.txt /s | %systemdir%\cmd.exe /k findstr /S /I /P $$2 "$$2*.txt"

file_name.py .string   
show lines within files with same extension e.g. .py (current folder and down) containing string using findstr in msdos box   
[Enter] find string '$$5' in *.$$3 /s | %systemdir%\cmd.exe /k findstr /S /I /P "$$5" "$$2*.$$3"

--- End quote ---

Find lines in files containing a strings, similar to unix grep. Shows the  file names and lines containing the specified string using dos findstr command in an msdos box

Usage to  find search_string in files in current folder (path) and down (subfolders)

farr search fieldpath\filename.ext .search_stringor
farr search fieldpath .search_string
It will open an msdox box in a separate windows with the filenames and lines containing search_string.

BTW : It would be nice to get the result in the FARR results. I tried
[Enter] findstr '$$2' in *.txt | showmemo findstr '$$2' in '$$1*.txt' /s ;;; AppCapAppendMemoNS %systemdir%\findstr.exe /S /I /P $$2 "$$1*.txt"
but in popup it says bad invocation2 of quickdocklauncher.exe and gives an error '-0'

Does anyone know how to solve this problem?

wjamoe:
File to Folder (by skwire) alternative using above FARR extension alias:

[Enter] mv $$4-file to subFolder $$3 | %systemdir%\cmd.exe /c mkdir "$$2\$$3";;; %systemdir%\cmd.exe /c move /-Y "$$2\$$3.$$4" "$$2\$$3";;; %systemdir%\cmd.exe /k dir "$$2\$$3"

make subfolder with name of file without filename extension
move file to file (ask for confirmation if you try to overwrite an existing  file)
shows contents of the subfolder without the extension in separate DOS window

or

[Enter] mv $$4-file to subFolder $$3 | %systemdir%\cmd.exe /c mkdir "$$2\$$3";;; %systemdir%\cmd.exe /c move /-Y "$$2\$$3.$$4" "$$2\$$3"

make subfolder with name of file without filename extension
move file to file (ask for confirmation if you try to overwrite an existing  file)

wjamoe:
Sometimes when editing the search field this alias is triggered (too eraly) when the file name extension contains only one character.

By changing the regex

from
^((.+)\\(.+)\.(S+))\s+\.(.*)$

into

^((.+)\\(.+)\.(\S\S+))\s+\.(.*)$

the extension alias is only triggered when there are at least two characters in the file name extension (after the dot).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version