There is a forum post in the Russian part of the forum regarding the possibility to use external programs to convert files into TXT to view them in FAR.
You can find the post HERE.
So, I've decided to write a tutorial using that post as a base. The tutorial is about using external programs to convert the files so they can be viewed in FAR.
First of all, thanx to SlashNet for the original thread.
You can use the converters to convert the file to Text and the use FAR's internal editor or viewer to see the converted file, or you can use the converters to convert to HTML (those that support it) and preview them with a HTML viewer. For options on HTML viewing in FAR you should check out THIS post.
For each filetype (in the 2nd post) I'll post how to call the converter program from FAR's File Associations.
Converter programs are listed in the 3rd post, if one of them needs a script/batch file you'll find it in the 4th post.
Here's what each one does or requires : view:<cmd> - uses FAR's internal viewer edit:<cmd> - uses FAR's internal editor hv:<cmd> - uses the Hyperview plugin rtfv:<cmd> - uses the RTF Viewer plugin dvv:<cmd> - uses the Docview plugin
eLinks_cnv.cmd <cmd> - uses eLinks to display the converted file
Note : this has been tested with FAR3, but in theory it should work with Far 1.75 and Far 2, I just didn't test it.
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators.
"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA
AbiWord | In : Abw, Awt, Zabw, Doc, Dot, Docx, Dotx, Wp, Wps, Wpd, Odt, Ods, Ott, Rtf | Out : Text, Html, Doc, ...
Homepage :http://www.boxoft.com/pdf-to-html/ Latest version : 1.0 Portable : ??? Description :
Boxoft PDF to HTML Freeware is a standalone converter for you to batch transform PDF files into HTML pages Pros : simple to use Cons : cannot disable image generation (not needed for FAR), quite slow Downloads :http://www.boxoft.com/pdf-to-html/ Note : You can use the Universal Extractor to extract the files from the installer, only the pdftohtmlcmd.exe and English.lng files are needed.
Boxoft PDF to HTML converter | In : PDF | Out : HTML
Note : for the conversion it needs the egrep tool.
Egrep is needed in order to find out which of the generated HTML files is the starting file and should be displayed by default.
Homepage :http://www.7-zip.org Latest version : 9.20 (9.30 alpha) Description :
7-Zip is a file archiver with a high compression ratio. Downloads : http://www.7-zip.org/download.html (choose the "7-Zip Command Line Version" download)
set home=%FARHOME%\..\.Internet\.Browser\eLinks.pn
set temp=%FARHOME%\temp
set filename=converted.html
if not exist %temp% mkdir %temp%
del /Q /S %temp%\*.*
:: do the conversion
call%*
set filepath="%temp%\%filename%"
:: remove the ":"
set filepath=%filepath::=%
:: replace the "\" with "/"
set filepath=%filepath:\=/%
:: add the prefix
set filepath=file:///cygdrive/%filepath%
%home%\elinks.exe %filepath%
:: delete all the temporary files
del /S /Q /F %temp%\*.*>nul
:: delete the folders from %temp% (leave the %temp% in place)
FOR/D /R %temp%%%X IN(*) DO RD /S /Q "%%X"
:: clear the variables
set home=
This script should be placed in the eLinks folder, it will call another converter script/batch command and display the result in eLinks.
It expects the script to modify the FILENAME variable if the output is different from "converted.html"
For example something like :
Note : this scripts creates the files in the elinks\Temp folder, it also removes ALL files from there, so make sure you don't have anything you don't want deleted.
set home=%FARHOME%\..\.Internet\.Browser\eLinks.pn
set temp=%home%\temp
if not exist %temp% mkdir %temp%
:: do the conversion
call%*>%temp%\converted.html
set filepath=%temp%\converted.html
:: remove the ":"
set filepath=%filepath::=%
:: replace the "\" with "/"
set filepath=%filepath:\=/%
:: add the prefix
set filepath=file:///cygdrive/%filepath%
%home%\elinks.exe %filepath%
:: delete the temporary file
del %temp%\converted.html
:: clear the variables
set home=
It is similar to eLinks_cnv.cmd, the only difference is that the converter that's called will put the converted data into ConsoleOutput so the script redirects tha console output to the converted.html file.
set abiword="%FARHOME%\..\.Office\AbiWord.pa\AbiWordPortable.exe"
if not exist %temp% mkdir %temp%
set filename=%~ns1.htm
:: do the conversion
%abiword%--to-name=%temp%\%filename%--to=html %*
This script will call AbiWord and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
set boxoftpdftohtml=%FARHOME%\..\.Console\.Converter\BoxoftPdfToHtml\pdftohtmlcmd.exe
if not exist %temp% mkdir %temp%
:: do the conversion
%boxoftpdftohtml%-i %~fs1 %temp%\%~ns1.htm
set filename=%~ns1.htm
This script will call Boxoft PDF To Html and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
set calibrecnv="%FARHOME%\..\.Office\Calibre.pa\Calibre\ebook-convert.exe"
set sevenzip="%FARHOME%\..\.Console\7za.exe"
if not exist %temp% mkdir %temp%
:: do the conversion
%calibrecnv%"%~fnx1""%temp%\%~ns1.htmlz"
:: extract the file
%sevenzip% e "%temp%\%~ns1.htmlz"-o%temp%
set filename=index.html
This script will call Calibre's converter and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
Note : this requires the 7Zip program, make sure you have that one too.
set chmdecoder=%FARHOME%\..\.Console\.Converter\GridinsoftChmDecoder\chmdecoder.exe
set egrep=%FARHOME%\..\.Console\egrep.exe
if not exist %temp% mkdir %temp%
:: do the conversion
%chmdecoder%%*%temp%
:: extract from the generated #SYSTEM the HTM/HTML file that is the starting page
%egrep%-o -a "[a-zA-Z0-9_]+.html?""%temp%\%~n1\#SYSTEM">%temp%\egrep.tmp
set /p startfile= <%temp%\egrep.tmp
del %temp%\egrep.tmp
set filename=%~ns1\%startfile%
This script will call Gridinsoft's ChmDecoder and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
Note : this requires the egrep program, make sure you have that one too.
set helpdeco=%FARHOME%\..\.Console\.Converter\HelpDeco\HelpDeco.exe
set unrtf=%FARHOME%\.Convert\2htm_UnRTF.cmd
if not exist %temp% mkdir %temp%
:: do the conversion
start /D"%TEMP%"/b /wait%helpdeco%/r /y %~fs1
:: call UnRTF to convert the generated RTF file to HTML
call%unrtf%%temp%\%~ns1.rtf
This script will call Helpdeco and generate an RTF file and then call the unRTF.cmd file (listed lower on this page) and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
set mobi2html="%FARHOME%\..\.Console\.Converter\mobi2html\mobi2html.exe"
if not exist %temp% mkdir %temp%
::copy the file to the temp folder
copy "%~fs1""%temp%\\">nul
:: do the conversion
%mobi2html%"%temp%\%~nsx1"
set filename=%~ns1.htm
This script will call Mobi2HTML and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
This script will call OpenOffice or LibreOffice and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
set pdftohtml=%FARHOME%\..\.Console\.Converter\PdfToHtml\pdftohtml.exe
if not exist %temp% mkdir %temp%
:: do the conversion
%pdftohtml%-i %~fs1 %temp%\%~ns1.htm
set filename=%~ns1.htm
This script will call PdfToHtml and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
set unrtf=%FARHOME%\..\.Console\.Converter\UnRTF\unrtf.exe
if not exist %temp% mkdir %temp%
set filename=%~ns1.htm
:: do the conversion
%unrtf%%~fs1 -t html >%temp%\%filename%
This script will call UnRTF and do a conversion to HTML in the TEMP folder. It will set the FILENAME variable to the generated filename.
Should be called by eLinks_cnv.cmd
I'll keep adding more filetypes and programs as my time permits.
If you have any questions feel free to ask, also, any suggestions are welcomed.
If you know any useful converters please let me know and I'll add them to the list.
Do you guys know any other file type worth converting into HTML/RTF or simple text ?
Please let me know what filetype you'd like converted (also give a sample too) and I'll try to find the tools for it and write the proper script/batch file.
History of edits : 14.05.2013
+ added PDF format and conversion tools/scripts
+ added HyperView and Docview plugins
= sorted the lists alphabetically (easier to find items)
15.05.2013
+ added CHM and HLP formats
+ added UnRTF for RTF conversion
- removed Abiword and Libreoffice from RTF conversion, they don't seem to finish the conversion (Libreoffice hangs and Abiword doesn't generate any file)
+ added a new category : "Useful tools" and added eGrep to it
29.05.2013
= modified the scripts to handle filenames that contain spaces in their names
+ added MAN format
+ added MOBI format
+ added EPUB format
+ added an archive with all the scripts, do not forget to modify them to reflect the paths to the conversion programs
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators.
"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA