MTS ver. 2.0 - Multi-Text Search&browse © 2004-2021 Giuliano Artico
2. Using the program
MTS basically performs three functions (functions 1 and 3 can also be started with appropriate command line parameters):
- the identification of files that meet certain requirements,
- their interactive visualization,
- 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:
- a file specification, which may include a path and the wildcard characters * and ?.
- ten search strings in as many fields (change bank with PgDn/PgUp).
- two numbers separated by a hyphen (-) to delimit the file size.
- a number indicating the depth of the subdirectories to consider.
- an option to include or ignore hidden and system files.
- an option to include or ignore files that are not pure text, called binary files (eg executables, audio files, images, etc.).
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.
- The command includes the /M option, which produces the list of selected files
[§2.4].
-
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].
- 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.
-
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
-
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
-
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.
- A case sensitive letter followed by an equal sign.
- A number of one or more digits, denoted by n, which generally represents the length of the string.
- One or more optional letters, called modifiers, which determine various characteristics of the text produced.
Modifiers are specific to individual properties and it doesn't matter if you use upper or lower case.
They are grouped into the following categories (no more than one modifier is allowed for each category in the same format string):
- Alignment: L, R, C.
- Case: S, A, F.
- Literal expression (name): N.
- Completion: B, Z.
- Suffixes: X, Y.
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.
- Shift+F1 to Shift+F4:
respectively 3, 5, 7, 9 lines from the cursor to the bottom.
- Shift+F5 to Shift+F8:
respectively 3, 5, 7, 9 lines centered on the cursor line.
- Shift+F9:
block delimited by the blank line before the cursor and by the blank line following it, if they do not exist, up to the edge.
- Shift+F10:
all part of the file shown on the screen.
The destination of the text can be:
- the clipboard file mts-copy.txt,
- the Windows clipboard,
- both of the above destinations.
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.
- D: sort by date.
- E: sort by extension.
- N: sort by name.
- S: sort by size.
- -: reverse ordering.
- 0: no sorting (order established by the system).
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:
- by choosing O from the initial menu,
- using the /O option followed by the string described above,
- by editing the +O command in the initialization file.
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).
- $B:
indicates the current number of bytes (first byte of the text displayed in the screen).
- $F:
indicates the name of the file, it is added if not explicitly specified.
- $P:
indicates the current position as a percentage.
- $R:
indicates the current line number (at cursor position).
- $1, $2, $3, ...:
indicate the search strings in the order they have been specified.
- $S:
indicates the current search string.
- $W:
indicates the word pointed to by the cursor.
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.
-
Any spaces at the beginning and at the end of the string are eliminated: if you want them to be kept, their presence must be highlighted by bounding the string (left or right) with double quotes (ASCII 34).
-
When you want the double quotes to be part of the string as the first or last character, you need to add another double quote character to the border in question.
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.
-
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.
-
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.