MTS ver. 2.0 - Multi-Text Search&browse © 2004-2021 Giuliano Artico

Multiple search of strings
with consultation of the selected files

SUMMARY

1. Introduction

The MTS program, whose name is inspired by TS (Text Search, an important component of the legendary Norton Utilities of the 90s), locates the files that contain one or more given strings. You can search for numerous strings and select files that contain at least one occurrence of each string, obtaining an accurate and fast tally of the occurrences found. The selected files can be examined individually with a rudimentary file viewer integrated into the program or they can be opened with an external editor, going to the position where the various strings are located. It is also possible to carry out a global treatment of the selected files, for example you can collect them into a packed archive.

The search takes place within the files corresponding to a given specification, which can include Windows wildcard characters. While file scanning can be controlled interactively, the program is ideal for use with batch procedures due to the various options available (get the list by typing mts /? or run the help.bat batch file included in the distribution archive). The options allow, for example, to control the files to which the search must be applied (lower and upper limitation of the size, maximum level of the subdirectory to which it belongs, exclusion or not of binary and hidden files, exclusion or forced inclusion of files with particular extensions).

A detailed account of the scan is transcribed in a final report (file mts.dat).

1.1. Installation

MTS works in console mode under any version of Windows XP/Win7/Win10, 32 and 64 bit.

Download the zipped archive [§6], unpack it and copy the executable file mts.exe to a folder of your choice: this folder must not be contained in reserved folders (Windows, programs, documents) and must be enabled for writing so that the program can store the support files and the final report. It is also advisable to include the directory in the system path: in this way the mts.exe executable can be located at startup whatever the location from which it is invoked.

The program consists solely of the mts.exe executable. The other files contained in the distribution, listed below, are documentation or sample files and are not required for operation.

Back to summary.

2. Using the program

MTS basically performs three functions (functions 1 and 3 can also be started with appropriate command line parameters):
  1. the identification of files that meet certain requirements,
  2. their interactive visualization,
  3. their overall treatment.
The interactive interface consists of three main operating environments.
The start menu
It consists of a single line that lists the functions, to be accessed by pressing one of the proposed letters:
S=scan V=view L=list C=colors O=order G=guide I=info E=exit: S
The scan window
It is accessed by pressing the letter S. Use it to operate interactively by entering or modifying the search parameters [§2.1] and starting the file scanning process.
The file view screen
Press the letter V to open the integrated viewer, which allows to examine the files found by the scan [§2.2]. No editing capabilities are supported: you can do this task by assigning an external editor of your choice [§2.10].
The following accessory functions are also available at start menu:
List for the overall treatment of the selected files
The list will be output by pressing L [§2.4].
Colors
By pressing the letter C you can set the color attributes, useful for distinguishing the various types of text [§2.8].
Sort order
By pressing the letter O you can set the order in which the files are presented [§2.9].
Help
By pressing the letter G or the F9 khey, you can open the program manual (this document).
Finally, you can press the letter I for information about the program, the F1 key to read the license, the Esc key to finish.

2.1. Scanning and locating files

Pressing the letter S (scan) or Enter you access a screen containing various fields for interactive data entry: String search is case insensitive (upper and lower case characters are considered equivalent): street, STREET and Street are treated in the same way. For more details on the scan screen see. [§3].

Once you have made the desired settings, press F10 or Ctrl+Enter to start file scanning. During processing, a counter is shown to indicate progress and a concluding summary is shown at the end.

Detailed information is transcribed into the mts.dat file, whose content is needed by the File View screen [§2.2] and by the output list [§2.4].

The settings are automatically stored in the initialization file mts.ini [§4.1] and automatically resubmitted in subsequent processing.

2.2. File view: integrated viewer of selected files

. The File View is a screen that is activated from the initial menu by pressing the letter V. The files that were selected during the last scan are displayed one at a time. If this scan was performed in a previous session, the list is taken from the mts.dat file, if it exists.

the command overview is listed below. In various cases, multiple keys are provided for the same action. For letter keys, unless otherwise specified, uppercase and lowercase are indifferent.

Esc
Return to the initial menu.
F1, ?, H
Summary of the available commands.
Arrows, Home, End
Move the cursor across the text.
Ctrl + Right/Left arrows
Move the cursor by one word.
Alt+Home, T
Move the cursor to the screen top.
Alt+End, B
Move the cursor to the screen bottom.
z (lowercase)
Move the cursor to the zoom position [§2.7].
Z (uppercase)
The text is scrolled until the current line is at the zoom position [§]2.7].
s (lowercase), space bar, +, Alt+Down Arrow
Scroll text forward one line (without moving the cursor).
S (uppercase), -, Alt+Up Arrow
Scroll text back one line (without moving the cursor).
PgUp/PgDn
Scroll a screen back/forward.
Ctrl+Home/End;
Moving to the beginning/end of the text.
f (lowercase), Enter, /
Next file.
F (uppercase), BackSpace, \
Previous file.
d (lowercase), Ctrl+Enter
Next file in a different directory.
D (uppercase), Ctrl+BackSpace
Previous file in a different directory.
Ctrl+PgUp, ^
First file. You can also type the number 1 followed by Enter.
Ctrl+PgDn, $
Last file. You can also type a number greater than the file number followed by Enter.
j (lowercase), Tab, >
Jump to the next occurrence of one of the specified strings.
J (uppercase), Shift+Tab, <
Jump to the previous occurrence of one of the specified strings.
E, F2
Open the current file with an external editor.
F3, N
Enter a new search string; it is then possible to use the vertical arrows and Ctrl+Home/End to choose the string among those currently set.
R, F4
Reassign the external editor. For some editors (PSPad, Notepad++, UltraEdit) MTS automatically assigns parameters in such a way that the file will be opened at the search string or near the cursor position.
A, F5
Switch to apply the highlighted color attributes to the current string only or to all strings (the latter is the default condition).
F6
Toggle acoustic signals on/off.
m (lowercase)
Increase the volume of the acoustic signals.
M (uppercase)
Decrease the volume of the acoustic signals.
C, F7
Change the color attributes [§2.8].
W, F8
Toggle character encoding on/off [§2.5].
G, F9
Open the program guide: if the mts-en.htm file is missing, the online help will be accessed.
. (period), F10
Highlight the word pointed to by the cursor: this word will be used as a search string;
Shift+F1 ... Shift+F10
copy part of the displayed text [§2.6].
Note. If a line of text exceeds 80 characters in length, a colored up arrow is placed at the beginning of the next line to highlight the link with the previous line (see the Continue line attribute [§2.8]).

2.3. Startup syntax and command line scan

The startup command line of MTS has the following syntax:
mts.exe [SpecFile] ["string1" ["string2" [...]]] [options]
The terms enclosed in square brackets are all optional and have the meaning indicated in the following table.
SpecFile
Specification of the files to be scanned: it includes all characters from the beginning up to the first among quotation marks (", ASCII 34) or forward slash (/, ASCII 47). Any spaces that occur at the beginning or end of this portion of the command will be ignored. From this rule it follows that the file specification must not contain quotes, even if it contains blank spaces. It can include a drive letter, a path, and the Windows wildcard characters * and ?. If you want to examine the files of the current directory and its subdirectories, just specify a single period as a specification, for example
mts.exe .
When the file specification is absent in the start command, MTS loads the file data from the most recent scan (stored in the mts.dat file).
"string1" "string2" ...
One or more search strings enclosed in gouble quotes. These strings can include special characters [§3.2.1].
Options
The options consist of a slash (character /) followed by a letter (uppercase or lowercase don't matter) and by specific parameters [§4].
If at least one string is specified, the program immediately starts the scan and then presents the menu to continue with the subsequent actions. In some cases, noted below, control is returned to Windows without presenting the menu.
  1. The command includes the /M option, which produces the list of selected files [§2.4].
  2. The command includes the /F option, which forces the scan to start immediately, even if no string is specified at command line. The /F option makes sense when paired with the /M option [§2.4.1].
  3. Options, instead of being specified at the command line, are supplied via input redirection [§3.6].

2.4. List for the global treatment of the selected files

After selecting a group of files with the scan function, it is possible to generate a list for their overall treatment. The list is a text file that is generated based on a preassigned output template. The output pattern is a string that must contain at least one of the variables representing a file name, namely $F, $N, $X (capital letters). The default output file is mts-lst.txt in the directory of the mts.exe file and can be changed with the /K option.

For each file, among those of the selected group, the program puts the template in the list after replacing variables with the respective value, for example $F with the full name of the file. Therefore, using the default pattern $F, the resulting list will simply contain the list of selected files, one per line.

The list can be generated by specifying the /M option in the start command or interactively, as described in the next section.

2.4.1. Command line list generation: /M option

To the right of the /M option you can indicate a string to replace the current template (taken from the initialization file or, failing that, the default $F). Remember that the model is valid only if it contains at least one of the variables representing a file name, otherwise the pre-existing model remains in effect). Any special characters in the pattern must be preceded by a backslash \ [§3.2.1]. For example, double quotes should be indicated with \".

If the command line contains one or more strings enclosed in double quotes, MTS performs the scan, generates the list, and exits. The same is true if the command, in addition to the /M option, also contains the /F option.

If no search string is specified in the command line and the /F option is absent, the strings present in the initialization file mts.ini are used (these strings have been entered in a previous session).

Note. If the command line does not include a file specification, the set of selected files is rebuilt from the mts.dat file, if it exists, which results from having used the scan function in previous sessions. The output is based on all the files present in mts.dat, even if detected during various scans (both interactively and by queuing with the /A option) and not only those identified during the most recent scan. Therefore, to take advantage of data accumulated in different scans, it is best to manually delete the mts.dat file to start from a clean situation.

Examples.

  1. In the next example the /L3 option restricts the scan to subdirectories of depth 3, while the /N250K option asks to scan only files no larger than 250000 bytes; the resulting files are listed in the mts-lst.txt file (option /M):
    mts.exe d:\my texts\*.txt "Antonio Vivaldi" "Venice" /l3 /n250k /m
    
    If the /M option is missing in the previous command, you can immediately run a second command to get the same list:
    mts.exe /m
    
  2. You can use the list produced by MTS to collect the files of the selected group in a compressed archive. For example, with the rar.exe program, run the commands:
    mts.exe /m
    rar.exe a archive.rar @mts-lst.txt
    
  3. Another interesting application is producing a list modeled with a particular style, with the possibility of including some properties of the files by means of suitable variables (the name of variables begins with the symbol $). For example, suppose you want to produce a date-sorted list of all *.txt files in a directory and its subdirectories. Use the following pattern, reordering the output with the Windows sort program used as a filter (in fact MTS allows stdout redirection when the /M option is present):
    mts.exe d:\my texts\*.txt /0 /l99 /m$Y-$M-$D $S $F|sort.exe>mylist.lst
    
The original distribution of MTS includes the batch programs mts-arc.bat and mts-sort.bat, which exemplify the operations described above [§2.4.4].

In some cases it may be convenient to set the output template with the +M command in the initialization file and, at the command line, use the /M option without parameters (for example, when the output template has some complexity or if it has to be used many times).

For a multi-line template, you can take advantage of input redirection [§3.6], but it is also possible to include the carriage return sequence at command line by indicating it with \0D\0A.

2.4.2. Generating the list interactively

When you press the letter L (list) at the initial menu, you will be prompted for the output template. After entering the pattern, you can add an optional second string that will appear in the list after each item on a separate line. You can press Enter to leave this extra string blank and in that case the list items will be based on the template only.

For example, the following pattern produces a list of batch commands to copy all selected files to the directory d:\temp:

copy $F d:\temp
To complete the previous command you could add pause as an extra string to insert a pause after each copy. Naturally, in this application, it will then be necessary to make the resulting list executable by renaming it with the extension .bat.

2.4.3. Identifier symbol for variables

If necessary, the $ symbol (first character in variable names) can be replaced with a string of your choice, set in the initialization file (command +V) or with the /V option. For example, the following command sets * as a replacement string for $:
mts.exe /v*
Backslashes (\, ASCII 92), double quotes " (ASCII 34) and blank spaces are not allowed in the replacement string.

If you make the above change, you need to adjust the names of all variables used in the template, so that $F, $D, $T, $S become *F, *D, *T, *S respectively, and so on. If desired, you can use a replacement string consisting of multiple characters, such as /V{}.

The modification also acts on the symbols used to insert any variable data in the command that defines the call of the editor program [§2.10].

2.4.4. Sample batch programs mts-arc.bat and mts-sort.bat

The batch programs mts-arc.bat and mts-sort.bat, included in the distribution, are examples of using the list of selected files generated by MTS with the /m option. Both programs, if run without parameters, displays some instructions for use.

2.4.5. Variables that can be used in the output template and associated text format

The output file produced with the /M option contains information, relating to the selected files, to be set by means of suitable variables in the output template. The variables in the template are assigned the values of the corresponding file properties according to a format that can be customized with the /K option [§4] or with the +K command in the initialization file. The default setting is given by the following string, consisting of a comma-separated list of formats, one for each of the properties:
T=0,W=0,Y=0,M=0z,D=0z,h=0z,m=0z,s=0z,S=0,A=0,F=0,P=0,N=0,E=0,X=0
Each format consists of the following elements. Note that in most cases the default values should be the most convenient.
Variable $T, format T=n[LRC][SAF], default 0
Date of the file in extended form, for example January 1, 2021.
Formatting rules.
If n=0 the string has variable length. Otherwise the length is n with a maximum value of 31 and you can add one of the modifiers L (default) to align left, R to align right, C to center the string in a field of length n.
Also you can add one of the modifiers S (small, default) for the lowercase literal part, A (all capitalized) for the uppercase literal part, F (first capitalized) for the capital initial only.
For example, T=22ca yields the date centered in a 22-character field with the month entirely capitalized.
Other formats for the date are possible by specifying the year, month and day separately using their respective variables.
Variable $t, fixed format with length 10
Date of the file in numerical form with a fixed length of 10 characters (format not configurable).
Example: 01/01/2021.
Variable $W, format W=n[N][LRC][SAF], default 0
Timestamp of the file, component day of the week.
Formatting rules.
  • If you specify the N (name) modifier, you have the following options.
    If n=0 the result is the name of the day in lowercase with variable length.
    If n is between 1 and 31, a string of length n is produced. In this case you can add one of the modifiers L, R, C for left, right or center alignment.
    Also you can add one of the modifiers S, A, F for the string that is all lowercase, all uppercase or with only initial capitalized.
  • If the modifier N is not specified, the number of the day is produced, 0 for Sunday, 1 for Monday, ... 6 for Saturday. In this case the value of n is indifferent and the other modifiers are ignored.
For example, with W=0nf you would get Monday, Tuesday, Wednesday, ... while with W=2na the result would be MO, TU, WE ...
Variable $Y, format Y=n, default 0
Timestamp of the file, component year.
Formatting rules.
If n=2, the year is indicated with two digits, otherwise with four.
Variable $M, format M=n[N][ZB][LRC][SAF], default 0Z
Timestamp of the file, component month.
Formatting rules.
  • If you specify the N (name) modifier, you have the following options.
    If n=0 the result is the name of the month in lowercase with variable length.
    If n is between 1 and 31, a string of length n is produced. As with the variables $T and $W, you can add one of the modifiers L, R, C for left, right or center alignment. Also you can add one of the modifiers S, A, F for the string that is all lowercase, all uppercase or with only initial capital.
  • If the modifier N is absent, the month is expressed with the corresponding number from 1 to 12.
    If you add the modifier Z (zero-padded) you always get a two-digit number, possibly completed with a leading 0. On the other hand, if you add the modifier B (blank-padded) you always get a two-character string, possibly completed with a space
For example, you would get 04 or 11 with M=0Z, Apr or Nov with M=3NF, APR or NOV with M=3NA.
Variable $D, format D=n[ZB], default 0Z
Timestamp of the file, component day, number from 1 to the number of days in the month.
Formatting rules.
(These rules also apply to the next three variables.)
The number n is not used and is present only for syntactic consistency. The following cases are possible.
  • With the modifier Z you always get a two-digit number, possibly completed with a leading 0.
  • With the modifier B you always get a two-character string, possibly completed with a leading space.
  • Without any modifier you get a one or two digit number, depending on the month.
Variable $h, format h=n[ZB], default 0Z
Timestamp of the file, component hours, from 0 to 23.
Formatting rules.
As with the variable $D, the number n is not used and you can optionally add one of the modifiers Z or B.
Variable $m, format m=0[ZB], default 0Z
Timestamp of the file, component minutes, from 0 to 59.
Formatting rules.
As with the variable $D, the number n is not used and you can optionally add one of the modifiers Z or B.
Variable $s, format s=0[ZB], default 0Z
Timestamp of the file, component seconds, from 0 to 59.
Formatting rules.
As with the variable $D, the number n is not used and you can optionally add one of the modifiers Z or B.
Variable $S, format S=n[LRC][XY], default 0
File size, usually in bytes.
Formatting rules.
If n=0 you obtain the number of bytes expressed as a string of variable length.
Otherwise, you get a -string of length n, which can be left-aligned, right-aligned or centered by adding one of the L, R or C modifiers. In addition, two other modifiers are available for this variable.
  • X, to express the size, as appropriate, in bytes, kB, MB, GB with one of the suffixes B, K, M, G.
  • Y, similar to X but using the suffixes byte, kB, MB, GB.
Variable $A, format A=n[N][LRC], default 0
File attributes.
Formatting rules.
  • If the modifier N is specified, the attribute is expressed with one or more of the letters R for read-only, H for hidden, S for system, A for archive, N for normal.
  • If the N modifier is absent, the attribute is expressed in numerical form.
If the number n is 0, the string is used with the length determined by the previous rules. On the other hand, if n is between 1 and 31, you get a -string of length n that can be left-aligned (default), right-aligned or centered using one of the L, R or C modifiers.
Variable $F, format F=n[LRC], default 0
File name, complete path.
Note. At least one of the variables $F, $N, $X must be present in the output template (beginning of [¶2.4]). Formatting rules.
If n=0 the string has variable length.
Otherwise the string length is n and its alignment is determined by the usual modifiers L, R or C, as seen above.
These formatting rules also apply to the next variables $P, $N, $E and $X.
Variable $P, format P=n[LRC], default 0
File path.
Formatting rules.
Same as the $F variable.
Variable $N, format N=n[LRC], default 0
File name (without extension).
Formatting rules.
Same as the $F variable.
Variable $E, format E=n[LRC], default 0
File extension.
Formatting rules.
Same as the $F variable.
Variable $X, format X=n[LRC], default 0
File name and extension.
Formatting rules.
Same as the $F variable.
Note. The string length, if specified, must be sufficient to contain the text that will be generated (excess characters are lost). For example, with /kW=6L you would get a truncated text 1 janu instead of 1 january 2021.

2.5. Character encoding in File View screen

While viewing a text file (choice V from the initial menu) it may happen that the characters are not displayed correctly because the file was produced with a program that adopts an ASCII code table different from the one used by the console. Press F8 to apply the character conversion: it will remain active, even in subsequent sessions, until you press F8 again to return to the ordinary view. The letter W at the beginning of the bottom line indicates that character conversion is active. Note that when conversion is enabled, it affects all files, even those to which it would not make sense to apply it.

The built-in conversion in MTS transforms the characters of the CP850 set into the corresponding ISO-8859-1 characters. Its conversion table is exemplified in the mts.tbl file, provided in the original distribution of the program. Adapt this file appropriately to make a custom conversion other than the default one. The file is not required to apply the default conversion and can be deleted.

Note. Strings are searched for using actual characters. For example, to search in files produced in MS-DOS environment, lowercase vowels with grave accent must be specified in the search strings with the ASCII characters 133, 138, 141, 149, 151 of the CP850 table and, by activating the conversion, they will be displayed correctly.

2.6. Saving text snippets

In the File view screen (choice V of the initial menu) it is possible to copy the text present on the screen, all or in part. Use the keys from Shift+F1 to Shift+F10 to copy a piece of text with the following rules. The destination of the text can be: The latter is the default condition. To restrict the copy to only one of the first two destinations, use the /R1 or /R2 options.

Although snippet copying is a function especially suited to text files, it can also be used with binary files. Any control characters will be transcribed in the form ^@, ^A, ^B, etc.

If the clipboard file mts-copy.txt does not exist, it is generated and the identification label [MTS-COPY.TXT] is placed on the first line. Subsequent data is appended. If the file exists but its first line does not contain the exact identification label, the file is not recognized and snippets cannot be transcribed.

2.7. Strings highlighting

While viewing files, MTS highlights the search strings using two different color attributes, a color for the current string, the one on which the cursor is positioned by pressing Tab/Shift+Tab or the equivalent commands j/J, and another color for any other strings. With F5 you can choose whether to highlight all strings (default condition) or only the current one.

When a file is opened, the first occurrence found is highlighted with the cursor placed in the so-called zoom line, usually at one third of the screen. You can press Z (capital) to scroll the text so that the current line is placed in the zoom line. Instead, pressing z (lowercase) moves the cursor to the zoom line without changing the displayed text. The position of the zoom line can be changed with the /Z option followed by the desired line number or by indicating this number next to the +Z command in the initialization file mts.ini.

The word pointed to by the cursor can be highlighted by pressing the period key or F10: in this case it is added to search string, possibly modifiable with F3 , and the program automatically restricts the highlighting to this one string (you can always press F5 to redisplay all the strings).

By word is meant a sequence of characters delimited by suitable characters (punctuation and the like). The set of delimiter characters can be changed with the command +D in the initialization file or with the /D option. The space character is always considered a word delimiter.

2.8. Setting Color Attributes

MTS distinguishes various types of shown text by displaying them with different color attributes. A special function, which can be called up with C from the initial menu or with the F7 key in the scan screen and in File view screen, allows you to modify all attributes for adapt them to your preferences.

In the screen dedicated to this function, each line shows a brief description indicating one of the 12 types, numbered from 0 to 11, and the context in which the writings of that type are used, as summarized in the following table.

Text [0]
General text (file, help, report, etc.).
Bars [1]
Information bars when viewing files.
Current string [2]
Occurrence of the string currently pointed to.
Other strings [3]
All remaining occurrences of the search strings.
Memo string [4]
String in the bottom bar or all strings.
Snippet [5]
Highlighted text ready to be copied.
Directory [6]
Current file directory shown at the top of the screen.
Directory search [7]
Directories shown during the scan phase.
Continue line [8]
Symbol to indicate the continuation of a long line.
Help keys [9]
Key names highlighted in the tips.
Input [10]
Text typed at keyboard.
Logo [11]
Program logo
The corresponding color, described and displayed in the same line, can be changed with the horizontal arrows, which change the foreground color and with PgUp/PgDn , which change the background color. You can also set an attribute directly by typing a number of up to three digits, which does not appear on the screen, followed by Enter.

There is a basic setting (the one active when the program is first started) and an alternative setting (with brighter colors). These settings can be recalled in the color setting screen by pressing the F1 and F2 keys respectively.

Color attributes can also be assigned with the /C option or with the +C command in the initialization file mts.ini [§4.1]. The default setting can be restored at startup using the /C- option.

2.9. Sorting order for selected files

The selected files are sorted in an order that can be chosen by the user. Sorting is based on some file properties, each identified with a character as specified below. arrange the letters D, E, N, S in the desired order to build the overall sorting criterion. these letters will be given decreasing priority going from left to right in the string. For example, the ED combination will sorts files by extension and sorts them by date when they have the same extension.

You can add a hyphen (- character) to get the reverse sorting (newest, largest files first, etc.).
Note. the reverse order applies to the whole criterion and not to individual elements.

To preserve the order given by the system, indicate only the character 0 as a criterion.

The sorting criterion can be specified in three ways:

Note that the sorting is done within the files that are in the same directory and that the directories are always sorted by name.

2.10. Editing with an external program

In the File View screen you can press F3 or the letter E to process the displayed file with an editor ,, which must be able to accept as a parameter the name of the file to open. MTS automatically searches your system for one of the following editors:
PSPad, Notepad++, Notepad, GMEditor, TextPad, Uedit32, Notepad2, Biblos, Winword, Write, Balabolka
To change your choice press F4 or the letter R in the File View screen. If the editor you want is one of those listed above, it should be sufficient to briefly write the name as indicated. In case of difficulty, type the full path of the program's executable file. For example, the PSPad editor might have been installed as portable: in this case it will be detected if its folder is contained in a folder on the root of a drive any with a name starting with ut, for example C:\ut\PSPad\, D:\util\PSPad, etc.

It is possible to add some parameters to the name of the editor, according to the syntax expected by the editor in question. In these parameters you can include some symbols to specify the properties of the file to be opened (letters must be uppercase and characters other than those listed are accepted exactly as typed).

The symbol $ is the same one used to represent the template variables [§2.4.3] and can be changed with the /V option.

First example. For the PSPad, Notepad++, and Uedit32 programs, the following parameters are automatically adopted, suitable for opening the file approximately at the position displayed in the File View screen.

pspad.exe $F -$R
notepad++.exe $F -n $R
uedit32.exe -l $R $F
Second example Let's suppose that a hypothetical program named MyEditor.exe has the option /S to indicate in quotation marks a string on which to position the cursor at startup or the option /B to open the file at the location indicated with the number of bytes. Then the string to assign the editor could be one of the following:
MyEditor.exe $F /S "$W"
MyEditor.exe $F /B $B

2.11. Acoustic signals and sound marker

Various events are accompanied by the emission of acoustic signals. One of them is the so-called sound marker which works in the File View screen. Precisely, when using the keyboard to move the cursor, a short beep is heard when the color attribute changes in the passage from the old to the new position. The beep may have two different frequencies, depending on whether the numeric attribute of the color in the new position is greater or less than that in the starting position. Thanks to this device, the presence of search strings is easily recognized when the cursor passes over one of them.

You can adjust the intensity of the sounds and the frequencies of the sound marker using the /S option [§4].

Back to summary.

3. Entering data

This chapter contains detailed information on entering data, both from the search window and from the prompt.

3.1. File Specification (File Spec field)

File specification obeys Windows rules, allowing the use of the wildcard characters * and ?. It must be indicated in the SpecFile field of the scan screen or as the first parameter at the command line. To ensure that a certain name is that of a directory, end it on the right with a backslash \.

In the scan window, once you have entered a specification, you can go to a subdirectory by pressing Tab and choosing subdirectories with the arrows, Home and End. To go back to the previous level directory press BackSpace. To adopt the folder as a specification for scanning, press Ctrl+Enter.

The normal movement and delete keys work in the data entry fields. You can press the Ins key to change the writing mode (insert or replace); the change is acoustically highlighted by an ascending or descending ladder, depending on the case.

3.2. Rules for entering strings

This section describes the rules governing the assignment of the strings to search for.

Strings can be entered in the appropriate fields of the scan screen or as parameters at the command line.

If the same string is repeated several times, it is considered only once, considering the same strings that differ only in upper / lower case characters.

MTS provides the possibility of indicating up to 250 search strings. In the scan screen you can switch between banks, each of which contains ten strings, with the PgDn and PgUp keys. You can swap a string with the previous or the next one by pressing F1 or F2 respectively. The combinations Ctrl+PgDn and Ctrl+PgUp bring respectively to the last bank used and to the first bank, suppressing any duplicates and empty fields.

Strings can contain arbitrary characters. Reserved characters (those not allowed at the command line) and control characters are also allowed by representing them with their two-digit hexadecimal code preceded by a backslash \ [§3.2.1]. Also, at the command line, any double quotes marks (ASCII 34) that are part of a search string must be indicated as \".

The following applies to strings entered in the scan screen.

Examples valid for strings entered both in the search window and at the command prompt)

Typed string Interpretation
\0C Form feed
\\0C \0C
\1A EOF, ASCII 26
\1B ESC, ASCII 27
\0D\0A CR+LF
\21 \21
c:\windows c:\windows
\\ \
\\\\ \\

Examples of strings entered at the command line

On the left column the delimiting double quotes are included, while on the right the spaces are indicated with the underscore (character _):
Typed string Interpretation
"Venice" Venice
"\"Venice\"" "Venice"
"via Venezia, " via_Venezia,_
"\3Cvia Venezia\3E" <via_Venezia>

3.2.1. Special characters

The control characters (ASCII code from 0 to 31 or hexadecimal code from 00 to 1F) are indicated by their two-digit hexadecimal code preceded by the backslash \ as shown in the following table (the letters A, B, ..., F must be capitalized):
ASCII SYMBOL ASCII SYMBOL ASCII SYMBOL ASCII SYMBOL
0 \00 8 \08 16 \10 24 \18
1 \01 9 \09 17 \11 25 \19
2 \02 10 \0A 18 \12 26 \1A
3 \03 11 \0B 19 \13 27 \1B
4 \04 12 \0C 20 \14 28 \1C
5 \05 13 \0D 21 \15 29 \1D
6 \06 14 \0E 22 \16 30 \1E
7 \07 15 \0F 23 \17 31 \1F

3.2.2. Reserved symbols at the command line

Symbols are also provided to specify those characters that cannot be used at the command line because they are reserved for redirection. Also in this case the symbol consists of a backslash \ followed by the hexadecimal code of the character. Also remember that, at the command line, double quotes that are not used as search string delimiters must be indicated as \".

The following table lists the symbols to be used on the command line only, in search strings and in the text alongside the /D, /M and /V options.

CHARACTER SYMBOL WHERE TO USE
" \" strings and options
/ \/ options
/ \2F options
< \3C strings and options
= \3D strings and options
> \3E strings and options
| \7C strings and options
Notes.
  1. The symbols in the previous table do not apply in the scan screen and in the initialization file, where normal characters are used explicitly. Instead, the symbols representing the control characters are valid everywhere.
  2. Due to its role as an escape symbol, the backslash should be indicated as \\. Strictly speaking, such splitting is only necessary if it immediately precedes one of the special symbols listed above or the backslash character itself. In the remaining cases, backslashes are allowed and interpreted normally (see the examples at the end of the previous paragraph).

3.3. File size (File size field and /N option)

you can restrict the size range of the files to be scanned. the minimum and maximum size values can be specified in the field File size or with the /N option at the command line. If the size of a certain file falls outside the indicated range, that file is ignored.

Normally only the maximum value is specified, but if you also want to set a lower bound, the two numbers (minimum and maximum size) must be separated with a hyphen (character -). Both numbers must be non-negative (the value 0 is allowed) and the first number must not exceed the second one.

Each value may be followed by one of the suffixes B, K, M, and G to indicate the measurement in bytes, kB, MB and GB. If either number is not suffixed, it is understood that it is expressed in bytes. A single value followed by the minus sign is adopted as the minimum value. When only one value is specified, the other remains unchanged. The default values are one byte and 5 MB respectively.

Note. The suffixes kB, MB, GB denote kilobytes, megabytes, gigabytes expressed with powers of 10, i.e. one thousand, one million and one billion of bytes respectively.

Some examples.

SPECIFICATION CONSEQUENT DELIMITATIONS
10m maximum 10 MB, minimum unchanged
500-2000k 500 bytes to 2MB
10k-1.5g 10 kB to 1.5 GB
10k- minimum 10kB, maximum unchanged

3.4. Subdirectory scan (Subdir Level field and /L option)

By default MTS scans the entire subdirectory tree starting from the specified one. You can restrict access to subdirectories indicating with a number in the range 0 to 999 the maximum relative depth to which you want to extend the scan. This number can be entered in the Liv subdir field of the interactive screen or with the /L option. For example, you can ask not to consider any subdirectories (level 0) or to go down to the first level subdirectories (level 1).

3.5. Hid/Sys files and Binary files fields, options /H, /B, /T, /X

Normally MTS excludes hidden / system files and binary files from the scan (for the sake of brevity, files that are not plain text are called binaries). The last two fields of the scan screen, labelled Hid/Sys files and Binary files, allow you to specify whether you want to examine these files. To change the condition just place the cursor in one of these fields and press Enter or the spacebar.

The /H and /B options at command line enable the scan of hidden/system and binary files respectively, while /H- and /B- restore the default condition in which files of either type are ignored.

Files with some particular extensions are considered binary solely on the basis of the extension itself (this speeds up the scan because it avoids analyzing the contents of the files). By default, all files with the following extensions are considered binary:

 .com .exe .dll .jpg .gif .bmp .xls .mp3 .wav .ogg .ape .wma .flac .zip .rar .7z .arj .avi .mp4 .mpeg .pdf .rtf .doc .docx .azw .azw3 .chm .djv .djvu .epub .fb2 .fbz .lit .mht .mobi .odp .ods .odt .pdb .ppt .pptx .prc .tcr .wpd .wri
To add more extensions to the above list use the /X option. For example:
mts.exe /x pcx zoo jar
It is also possible to specify a list of file extensions to be forcibly considered text files (although files with such extensions may not really be). To do this, use the /T option. For example:
mts.exe /t bas doc eml
Each of the two lists can contain a maximum number of 1024 extensions. When using the /T and /X options, the indicated extensions are added to the respective list, which can thus be enriched with entries over the course of the various sessions. By adding an extension to a list, that extension is automatically removed from the other list, if present.

The update of the two extension lists can also be done by editing the commands +T and +X in the initialization file. The two lists can be completely emptied using the /T- and /X- options respectively. However, note that if you purge the list of forcibly binary files, the next session will restore it to its default condition.

In any case, the program performs some checks to avoid the presence of duplicate extensions in the two lists, assigning higher priority, if needed, to the list of binary files.

3.6. Input redirection (stdin)

all permissible command line parameters can be supplied to the program via standard input (stdin). This allows you to enter a complex command and easily include special characters in explicit form (carriage returns, etc.). Prepare a text file, say param.lst, containing the desired parameters. Then you can run MTS in one of the following ways:
mts.exe<param.lst
type param.lst|mts.exe
Input redirection is subject to the following restrictions.

3.7. Output redirection (stdout)

Output redirection is allowed when the /M option is present: in this case the data that would normally be written to the list file mts-lst.txt ends up in standard output and can therefore be redirected to a file with any name.

3.8. MTS_OPT environment variable

All options can be assigned using the MTS_OPT environment variable with the same rules as those in effect for parameters at command line. In it neither the file specification nor search strings are allowed, in practice the contents of the variable must necessarily begin with the forward slash (character /).

A value assigned on the command line overrides that of the same option that may be present in the environment variable, and a value assigned to the environment variable overrides the default or that acquired from the initialization file. For this reason, the options generally provide for the possibility of restoring the default conditions.

Back to summary.

4. Command line Options

For MTS boot syntax see [§2.3]. If started with the /? option, the program displays the syntax and the list of available options (this text can be redirected to a file via stdout redirection). All options can also be assigned with the MTS_OPT environment variable [§3.8]. Below is the list of options with some clarifications.
/A[-]
Normally the report mts.dat is overwritten. With /A the new data is added at the end of the existing file.
The /A- option restores the default overwrite condition.
This option has no equivalent command in mts.ini.
/B[-]
The /B option also includes binary files (executables, multimedia, etc.) in the scan, files that are ignored by default.
The /B- option restores the default condition.
/Ccolors
colors is a list that specifies one or more comma-separated color attributes, each with format COn=aaa. The parameter aaa indicates a combined foreground/background attribute by means of a number between 1 and 254, while n is a value between 0 and 11 indicating the type of string to which the attribute is applied (see the numbering of the types in square brackets, table [§2.8]). For example, valid values are CO0=15 and CO1=126. The default values correspond to the following command, that can be abbreviated to /C-:
/C CO0=7 CO1=48 CO2=116 CO3=71 CO4=59 CO5=121 CO6=55 CO7=11 CO8=103 CO9=11 CO10=14 CO11=6
/Dlist
list is a string containing the word delimiter characters.
/E[-]
With /E all strings are highlighted (default condition), while with /E- only the main one.
/F[-]
Force scan and finish. With /F- all strings in mts.ini] are ignored.
/G[-]
The output model uses Italian for the names of the months and days of the week. The /G- option restores English, which is the default language.
/H[-]
The /H option also includes hidden and system files in the scan, files that are ignored by default.
The /H- option restores the default condition.
/I[-]
The insert mode is used in input fields. The /I- option restores the default condition (replace mode).
/K[list|-][:filename|:-]
Formatting of variables and name of the output file [§2.4.5].
  • list is a comma-separated list of values, each of which having the format letter=number, that determines the type and length of the text produced by variables.
    If a single hyphen (character -) is specified instead of the list, all variables are reset to their default values.
  • filename indicates the name of the output file, including path.
    If you specify a single hyphen (character -) in place of the file name, the default file mts-lst.txt in the program folder is restored.
/L[nn]
Subdirectories down to level nn are scanned. If the number is omitted, all subdirectories are considered (default condition).
/M[template]
generates the list of selected files [§2.4]. By default the pattern is $F.
/N[x-]y
accepts files whose size is in the range between x and y.
The values x and y can be expressed as integers or, more generally, with the format nnn[.ddd][[B]|K|M|G], an integer or decimal number followed by a suffix indicating the unit of measure bytes|kB|MB|GB, respectively. Some examples of valid values (see [§3.3]):
234567
234.567K
0.234567M
/O... [[]]
The sort order [§2.9] is a string composed of one or more of the characters D (date), E (extension), N (name), S (size). The characters must be arranged in the desired order and you can add a hyphen (- character) to get the reverse sorting. Use the character 0 alone to not assign any order, ie accepting the arrangement given by the system.
/P[prog]
prog indicates an editor program [§2.10].
You can specify the full path to the executable or just the plain name if it is comprised in the default editors. Suitable parameters can be added to the right of prog. An automatic choice is made if the prog string is omitted. If prog is specified but MTS fails to associate an editor with it, the existing editor remains in effect.
/Q[n]
Reduction of program messages. The number n, between 0 and 7, is obtained by adding the values listed below.
  • 1 to terminate the program when the scan had been started from the command line and no match was found.
  • 2 to reduce the messages on the screen, for example the detailed report on the result of the scan is omitted.
  • 4 to disable report writing on disk (not recommended).
The value 0 is equivalent to restoring ordinary settings. The /Q option without parameters is the same as /Q1.
This option has no equivalent command in mts.ini.
/R[n]
The number n determines the destination to which to store text with Shift-F1 ... Shift+F10 at the File View screen as specified below:
  • 1: on disk, in the file mts-copyef mts.bas .txt (located in the program directory).
  • 2: in the Windows clipboard.
  • 3: in both of the above destinations.
The default condition is the latter, which can also be obtained with /R without parameters or with / R-.
/S[volume][,freq1[,freq2]]
Sound parameters:
  • volume: number in the range 0-100 which expresses the intensity of the sound as a percentage, default value 25. If you specify 0, all sounds are suppressed.
    Note. The rhythmic ticking emitted when the scan takes place on numerous files has a fixed volume: it is suppressed if the volume is set to the value 0.
  • freq1, freq2: sound marker frequencies in the File View screen, numbers in the range 128-8192. The default frequencies are 1024 and 1367, corresponding to the notes C and F of the fifth octave of the piano.
The default values may be restored by specifying /S without parameters or /S-.
/T list
list is a space- or comma-separated list of extensions for files to be considered text (the starting period is not required). By default this list is empty.
/X list
list is a space- or comma-separated list of extensions for files to be considered binary (the starting period is not required). There is a predefined list of extensions that you don't need to specify [§3.5].
/V[x]
x is a string of one or more characters used to identify variables in the output template and in the editor specification [§2.4], [§2.4.3]. If x is omitted, the default symbol $ is restored.
/W[-]
Activates the conversion table [§2.5], see the comments in the mts.tbl) file.
/Z{nn|-}
Set the nn-th line of the screen as the zoom line. The default value 9 is restored by /Z (without parameters) or by /Z-.
/0
Reset some parameters to their default value, [§4.2], remark 3.

4.1. Initialization file mts.ini

At the end of each session, MTS writes the initialization file mts.ini, storing the current settings (parameters, file specification, search strings, etc.) to be able to retrieve them in the next session. The file, which is located in the directory of the file mts.exe, is a text file whose modification must be carried out respecting its structure and syntax.

In the initialization file, each parameter has an associated command with the form +letter .... Most commands have a corresponding option with the same letter and for the parameters that accompany a command there are rules similar to those of the corresponding option. For example, +C is associated to /C. The only exception is the +F command (file specification), which has a different function than the /F option. The first part of the initialization file contains a summary of the expected commands.

Notes.

4.2. A few remarks about entering data at the command line

  1. As already noted, to specify a search string containing double quotes at the command line, use the symbol \" [§3.2]. The addition of the backslash is necessary because of the role of double quotes in bounding strings.
  2. Various options include the use of the hyphen or minus sign (character -) which, as illustrated above, can play different roles depending on the option in which it is used. For example:
    • in the options /A, /B, /C, /E, /G, /H, /I, /S, /W, /Z, used alone, restores the default values of the respective parameters.
    • in the /F option forces the program to ignore any search strings possibly stored in the initialization file.
    • in the /N option it must be used to separate the minimum from the maximum size.
    • in the /O option indicates that the sort is to be performed in reverse order.
    • in the options /T and /X causes the respective lists to be emptied.
  3. The /0 option starts MTS with the following default conditions:
    • ignore binary, hidden and system files,
    • highlight all search strings,
    • allowed size from 1 byte to 5 MB,
    • search extended to all subdirectories,
    • editing in replace mode,
    • show all messages,
    • editor program automatically selected among the predefined ones,
    • active acoustic signals with predefined values for the volume and frequencies of the sound marker,
    • character conversion disabled,
    • zoom line to one third of the screen.
  4. In the /D and /V options you can specify also special characters with the rules shown in [§3.2.1]. Furthermore, the slash (character /) must be specified as \/ (this is needed to distinguish it from the slash that identifies the options). For convenience the set of word delimiters can be defined in the initialization file (command +D), using ordinary characters without any encoding. The same applies to the variable identification string (command +V).
  5. The pattern assigned with the /M option can contain special characters and control characters. Here the slash must be indicated with \/.
  6. File extensions specified with the /T and /X options must be separated with spaces [§3.5].

Back to summary.

5. Changes

MTS edition 2 is an evolution in the Windows environment of the MS-DOS program of the same name, of which it essentially maintains the plan. Numerous fixes have been made to benefit from Windows features, resulting in various performance improvements. The main changes are summarized below.
  1. File and folder names are complete and no longer abbreviated.
  2. The file scan speed is increased.
  3. New MTS_OPT environment variable.
  4. Added new variables that can be used in the template for the output list.
    The default symbol to identify variables is $ in place of *.
  5. New names for accessory files: mts.dat, mts-lst.txt, mts-copy.txt to replace mts.log, mts_lst.txt, mts_note.txt respectively.
  6. Ability to copy parts of text from File View to the Windows clipboard.
  7. In the initialization file:
    • new commands +G and +R,
    • command +A replaced with +E.
  8. New options /G, /I, /K, /P, /Q, /R.
  9. Added a new sound marker and modified the /S option with the ability to vary the volume.
  10. Changed various keystrokes in the File View screen (see help with F1).

5.1. Possible problems at startup

The MTS program can run on any Windows system without special requirements and does not use the Windows registry.

Here are two known limitations.

In Windows XP environment
A slow start of the internet browser used to open the license occurs. This situation can occur in particular during the first run of the program.
In Windows 10
As with less popular programs, antivirus software may give MTS a low level of reputation and consequently hinder its use. If your antivirus system is Windows Defender, you should add the mts.exe file among the allowed apps. For other cases, consult the documentation of your antivirus program.
Back to summary.

6. License and download

The MTS program can be downloaded, installed and used freely, provided that the terms of the license are strictly observed.

The MTS program is provided through a compressed archive of type ZIP available for free download at the following address:

https://www.artico.name/soft/mts/en/

6.1. References.

Contact the author via e-mail.

Old version of MTS, for MS-DOS and 32-bit Windows.

CTT, Windows utility to compare files or groups of files.

ARTI 2000 package contains other programs by the author (most in Italian).

Author's home page (in Italian).

Curriculum vitae of the author.

Back to summary.