[Tutorial] Convert files to view them in FAR

You want to talk about Far Manager, but don't know where to turn?
Post Reply
cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39

[Tutorial] Convert files to view them in FAR

Post by cyberwolf » Mon 13 May, 2013 13:31

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. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA

cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39

Re: [Tutorial] Convert files to view them in FAR

Post by cyberwolf » Mon 13 May, 2013 13:31

Converter commands by filetypes :

.ABW, .AWT, .ZABW (AbiWord documents)

.CHM

.DOC, .DOT

.DOCX, DOTX, DOCM, DOTM (Office 2007+ documents)

.HLP

.HTM, .HTML

.MAN

.MOBI

.ODT, *.OTT (OpenOffice documents)

.PDF

.PPS, .PPT

.RTF

.WP, *.WPD, *.WPS (WordPerfect)

.XLS, .XLT
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA

cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39

Re: [Tutorial] Convert files to view them in FAR

Post by cyberwolf » Mon 13 May, 2013 13:32

:!: FAR plugins :

DocView | In : RTF, HTM

HyperView | In : HTM, HTML

RTFViewer | In : RTF


:!: Converter programs :

AbiWord | In : Abw, Awt, Zabw, Doc, Dot, Docx, Dotx, Wp, Wps, Wpd, Odt, Ods, Ott, Rtf | Out : Text, Html, Doc, ...

Boxoft PDF to HTML converter | In : PDF | Out : HTML

Calibre | In : CBZ, CBR, CBC, CHM, DJVU, EPUB, FB2, HTML, HTMLZ, LIT, LRF, MOBI, ODT, PDF, PRC, PDB, PML, RB, RTF, SNB, TCR, TXT, TXTZ | Out : AZW3, EPUB, FB2, OEB, LIT, LRF, MOBI, HTMLZ, PDB, PML, RB, PDF, RTF, SNB, TCR, TXT, TXTZ

Gridinsoft ChmDecoder | In : CHM | Out : Html

HelpDeco | In : HLP | Out : RTF

LibreOffice | In : Doc, Dot, Docx, Dotx, Wp, Wps, Wpd, Odt, Ods, Ott, Rtf | Out : Text, Html, Doc, Ddt, ...

Mobi2Html | In : mobi| Out : Htm

OpenOffice | In : Doc, Dot, Docx, Dotx, Wp, Wps, Wpd, Odt, Ods, Ott, Rtf | Out : Text, Html, Doc, ...

PDFToHTML | In : PDF | Out : HTML

Polyglot Man | In : MAN | Out : ASCII, roff, TkMan, Tk, Sections, HTML, XML, MIME, LaTeX, LaTeX2e, RTF, pod

pptHtml | In : .PPS, .PPT | Out : .HTML

unRTF | In : RTF | Out : Html, Txt, Vt, Latex, Ps, Wpml

xlHTML | In : XLS, XLT | Out : HTML


:!: Other useful tools:

7Zip cmd line | Usage : add/extract archives

eGrep | Usage : search in files
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA

cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39

[Tutorial] Convert files to view them in FAR

Post by cyberwolf » Mon 13 May, 2013 13:32

:!: eLinks commands: (batch files)
:arrow:
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 :
  1. eLinks_cnv.cmd 2htm_OOffice.cmd sample_office_document.doc
Of course you can add it to the FAR File Associations, it should look like this :

Code: Select all

%FARHOME%\viewer\eLinks\eLinks_cnv.cmd %FARHOME%\converters\2htm_OOffice.cmd "!\!.!"
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.

:arrow:
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.



:!: Converter commands: (batch files)

:arrow:
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

:arrow:
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

:arrow:
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.

:arrow:
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.

:arrow:
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

:arrow:
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

:arrow:
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

:arrow:
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

:arrow:
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
Attachments
29.05.2013.zip
(4 KiB) Downloaded 216 times
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA

cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39

Re: [Tutorial] Convert files to view them in FAR

Post by cyberwolf » Mon 13 May, 2013 14:02

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.

:smart: 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. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA

Post Reply

Return to “General Discussions”