ShowTX 2.11, © 2009-2020, Horst Schaeffer

Plain text viewer with window size auto adjusting, editing functions


ShowTx is a plain text viewer that also supports editing and saving the text. Standard editing functions including copy, insert, drag&drop are available.

The behavior of ShowTX can be controlled by command parameters and by the default settings in the INI file.

ShowTX handles ANSI encoding, as well as UTF-8 and UTF-16 LE, with or without BOM (byte order mark).

Special features:
  • Auto-adjust window size (limits configurable in INI file)
  • Window position: center, x/y (command options) or auto
  • Menu and/or status bar can be hidden
  • Drag&drop a file on window to open
  • Web links supported
  • Secondary font (menu, shortcut key), background color
  • Launch function allows passing current file to another editor
  • Start ShowTX with text from clipboard (command option)
  • Profiles (INI file) as a sequence of command parameters

AutoSize, WordWrap

When AutoSize is active, the program will try to adjust the window width according to the longest text line, however, not beyond MaxWidth in the [Auto] section. If lines are longer, and WordWrap is active, the window will be adjusted to WrapWidth and WrapHeight in the [Auto] section (otherwise you will get a horizontal scroll bar).

If AutoSize is not active, the window size is taken from the [Window] section (last used). If lines are to long, WordWrap may be applied (within the given Window width). Note that AutoSize is deactivated when width and height are given as command options.

By default AutoSize and WordWrap are both active.


Syntax

ShowTx filespec [options]

Filespec:
Full path or relative path based on "current directory" (CMD scripts) or on "Run in.." folder (shortcuts).

Options:
separated by blank space, case ignored; colon and equal sign are equivalent


Command options (* see notes below)

/ro  /rw read only, read and write (*1,*2)
/wrap  /nowrap word wrap mode (*1,*2)
/auto /noauto auto size window at start (*1,*2)
/paste paste from clipboard, if no file given
/onTop keep window on top (*1)
/center center window on desktop
/XY=x,y window position (pixel coordinates x,y)
/WH=w,h window size (pixels: width, height)
/block menus disabled and text is read-only
/line=n select line #n 1.. (see status bar note)
/find=string find string; (double) quote marks supported
/font=2 Start with secondary font
/bgcolor=#rrggbb background color (HTML format), not saved
/QuickClose on exit: close (save) file without prompt (*1)
/QuickQuit on exit: quit (don't save!) without prompt (*1)
/closeAll close all open ShowTx instances (quits if no file to open is given)
/closePrev close previous (most recent) instance

(*1) see also: INI file settings
(*2) only applies to the file specified as command parameter

INI file

The INI file is expected and saved in the same directory with ShowTx.exe. The file is created with "Factory settings" the first time ShowTx is used. Changes to the INI file can be made while an instance of ShowTX is running, and will be effective for the next instance launched.

These settings may be edited (sections in square brackets and items):
Default values are marked red.

[File]
TextExt = (file name patterns separated by semicolon)

Extensions for files that are offered in Open/Save file dialog as "text files".
Example: TextExt=*.txt;*.ini;*.lst

ASCII7bitAs = (0|8) - File with 7 bit characters only: counts as ANSI | UTF-8
NewFileUTF = (0|8|16) - Encoding for new(!) files: Ansi | UTF-8 | UTF-16 LE
NewFileBOM = (0|1) - New files without or with BOM

The last two items may be changed in the menu: File / Encoding

[View]
MainMenu = (0|1) - hide|show
StatusBar = (0|1) - hide|show
AutoSize = (0|1) - no|yes
OnTop = (0|1) - no|yes

[Text]
WordWrap = (0|1) - off|on
ReadOnly = (0|1) - off|on
TabWidth = (characters, default:8) - for TAB used as input key
TabToSpace = (0|1) - no|yes, fill spaces, see Menu:Text

[Auto]
width and height (pixels) for auto size mode:

WrapWidth, WrapHeight - fixed dimensions if word wrap is active
MinWidth, MinHeight - minimum size
MaxWidth, MaxHeight - if MaxWidth exceeded: WordWrap = ?

[Program]
items may have to be added

QuickClose=(0|1) - on exit*: close (save) file without prompt
QuickQuit=(0|1) - on exit*: quit (don't save!) without prompt

* Exit function: menu:Program/Exit, ESC key, or [x] button

Launch=(Menu item;program path;parameters;folder)

Examples:
Launch=NotePad;Notepad.exe;"$"
Launch=PopSel;C:\some\where\Popsel.exe;"my editors.lst" "$"

This will add an extra item under "Program" in the main menu to launch anything you want. Only one item is supported. A dollar sign in parameters will be replaced with the current file; a hash sign (#) is replaced with the current line number. (Parameters and application folder are optional.)

Note: any file name/path in parameters (only) should be enclosed in double quote marks, in case there are spaces in names.

Help=(Menu item;help file)

If you want to display your own help information. Example:

Help=Help;ShowTX.txt   (Actually, same syntax as "Launch" item)

[Profiles]
section and items may have to be added

name = (command options)

Defines a new command parameter as a sequence of parameters. Example:
test=/font=2 /QuickQuit /bgcolor=#eeddff

This allows using /test as a new command parameter

ShowTx menu

The main menu can be hidden (toggle with Ctrl+M or menu:View). Status and mode switches (View, Text) are not saved in the INI file. However, Font and Background will be saved instantly. Find (Find next, F3) always starts at input position or end of marked string.

Status bar info

(1)   ro (readonly), ** (modified)
(2)   w (wordwrap)
(3)   line and column for input cursor position
(4)   characters: if marked within a single line; lines: if fully marked

Note: in "word wrap" mode the line numbers represent the count of visible lines in the window. Switch wrap mode to see the difference. If you want to select a logical (CR+LF terminated) line by command parameter, word wrap should be switched off.

Unicode

Text files beginning with a "BOM" (byte order mark) are read as UTF-8 or UTF-16(LE) accordingly.
Files without BOM:
If there are any zero bytes, the file is displayed as UTF-16 LE
If no invalid UTF-8 characters are found, the file is displayed as UTF-8
All other files are displayed as ANSI (single byte characters).
Unsupported encodings or binary files may cause unreadable ASCII or Unicode output.
Note that a plain 7 bit ASCII file is regarded as UTF-8 without BOM by default.
To make it regarded as ANSI: INI file [File] ASCII7bitAs=0

Files are saved with the same format as read, unless the format is changed in the Menu:File/Encoding. Internally all files are handled as Unicode text.

A BOM will be written as read, unless changed (Menu: File/Encoding/BOM?)
New files are saved as UTF-8 with BOM by default. This can be changed in the INI file, section [File], items NewFileUTF=0 and NewFileBOM=0.

Notes

Non-text:
ShowTx was designed to handle plain text files. The output for other data formats is not handled appropriately. Files containing zero bytes are displayed as UTF-16LE.

To use ShowTx in batch files or in "Send To" context menu, see ReadMe.txt.

ShowTX (c) 2009-2020, Horst Schaeffer is freeware - no warranty, no liability.

http://www.horstmuc.de
mailto:horst.schaeffer@gmail.com
07 Mar 2020