The SemWare Editor (TSE) is a general purpose plain text editor.
It was created and is maintained by Semware. I am just an active user.
A key feature is, that its makers created a user-accessible programming language of text editing commands, and then wrote the editor in that language. This makes TSE extremely adaptable (within the limits of that language).
The programming language is grandly called the Semware Application Language (SAL), and is referred to as its macro language. Its production version is well documented in TSE's internal Help system, which is a delight to use. The language is compiled into intermediate code that is interpreted by the editor's core. It comes with a good interactive debugger.
Alas, while TSE is still being maintained, the latest production release was TSE Pro v4.4 in 2005. It missed out on Unicode, and has some other old limits in its language and therefore its functionality.
Using its macro programming language users have written both extensions for its standard functionality (including a Unicode extension), as well as tools to perform both small and major editing tasks.
Old versions of my and other people's macros and can be found on
SemWare's macro download page.
Be warned that old macros on that page might be for ancient versions of TSE Pro. Old TSE Pro macros are usually very upwards compatible, but some ancient macros may not compile in newer TSE Pro versions because of now obsolete statements.
So when browsing those old macros it might be good to know:
- TSE Pro v2.5 and below were 16-bit editor versions. Macros written for it might contain 16-bit-specific code that will not run on 32-bit and 64-bit computers.
- TSE Pro v2.6 and above were 32-bit editor versions.
- TSE Pro v2.8 was the first stable 32-bit editor version. Macros written for TSE Pro v2.8 and above are likely to be compatible with current TSE versions.
- TSE Pro v3.0 and below were Console versions of the editor, meaning they only ran full-screen without any window borders.
TSE Pro v4.0 and above have a GUI and a Console version of the
The GUI version adds better Windows integration. The main GUI-specific features are:
- TSE runs in a window with borders instead of full-screen without borders. The window is resizable (including to a bordered full-screen), and supports drag and drop and a more user-friendly Close button.
- ANSI support for ANSI compatible fonts. ANSI is a set of Windows-compatible characters that is also compatible with non-English (originally) Western-European languages. For example, with an ANSI compatible font the character "é" will remain the same between TSE and most Windows applications.
- Loss of line drawing support when using an ANSI compatible font.
- A vertical bar cursor between characters (optional).
Current versions of my macros are provided below.
Nowadays when I create or maintain macros I default make them compatible with TSE Pro v4.0 upwards for both the GUI and Console versions of TSE unless stated otherwise. I do not support my macros for lower versions of TSE.
There is a Linux Beta version of TSE.
As of Linux Beta TSE v4.41.35 it supports ANSI and the Unicode and Keys extensions, which in my humble opinion makes it work well. That said, there are still some minor things that do not work.
Linux Beta TSE does not work in WSL (informally known as WSL1), because TSE is a 32-bit program.
The latest versions of Linux Beta TSE do work in WSL2 except for one known problem: TSE can open a Windows file using the file's fully qualified name, but it cannot not browse a Windows folder. For example opening a folder like /mnt/c to see what files it has does not work from TSE.
Default my macros are not intended to be compatible with Linux Beta TSE unless stated otherwise. Only some macros are, though those include some of the important ones.
Undocumented TSE Pro v4.4 features
This document describes some of the features of TSE Pro v4.4 that are not documented in the built-in Help system.
All its existing information is subject to updates and tweaks without notice. Only substantially new information is listed below.
v0.29: Added EditBuffer(), InsertFile() and LoadBuffer().
v0.30: Added the "menu" statement. Added new info to PushKey() and PushKeyStr().
v0.31: Added InsertData().
v0.32: Added the "case" statement.
v0.33: Added "config … endconfig". Added "Debugging Macros".
v0.34: Added #include.
v0.35: Added an HTML version of this document.
v0.36: Expanded Sort(), added MakeTempName().
Current TSE macros
This tool asks for a directory and generates a TSE buffer with "rmdir" commands for those directories there that contain no files. Directories containing only empty directories are listed too.
You can examine and edit the resulting TSE buffer, and rename it to a .cmd file to execute it to remove the listed directories.
Linux TSE Beta v4.41.35 upwards
This extension enables TSE to recognize and edit files for all major Unicode encodings: UTF-8, UTF-16, UTF-32, including their variants; big endian (BE), little endian (LE), with or without a byte order mark (BOM),
The Unicode macro requires the Status macro to be installed.
IF you are a user of the EolType macro, then you need to upgrade it to EolType v7. The older EolType versions do not understand the newline characters in the UTF-16 and UTF-32 files we can now edit.
For Unicode characters that have an ANSI equivalent the ANSI
character is shown.
Typically this already covers the most frequently used Unicode
characters that are not ASCII characters:
€ ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
- Other Unicode characters are shown as quoted hexadecimal Unicode codepoints, using the DELETE character (shown as a square-like character) as quotes.
You do not have to remember these hexadecimal codes:
- The character's Unicode description is shown as a status.
- You can insert any character into your text by typing part of its Unicode name or description in a shrink-as-you-type list of characters.
- Viewing the current character in its real Unicode form is possible but default disabled because it works imperfectly.
- A file's character encoding (ASCII, ANSI, UTF-8/16/32[BE/LE][+BOM]) is shown as a status.
- You can explicitly change a file's character encoding by right-clicking or pressing [Shift] F10 on the status. Note that this allows you to convert any ASCII, ANSI or Unicode character encoding to any (other) Unicode character encoding.
- Conversions of character encodings are lossless!
- ASCII or ANSI files are semi-automatically upgraded to another character encoding when you type a non-ASCII or non-ANSI character.
Key lacking features:
- It does not display non-ANSI characters graphically. ANSI only covers (originally) Western-European languages.
- It only supports Unicode for the content of files, not for folder or file names.
- Copying and pasting of non-ANSI characters is not supported.
v2.1 - Added compatibility with the Linux TSE beta. Updated the data files to Unicode standard 13.0.0. More direct access to status colour configuration. Three minor bug fixes. Various tweaks.
v2.2 - Allows disabling its incompatibility warning for TSE's Console version. This is handy when the GUI and Console versions of TSE are installed in the same folder and are both used.
v2.3 - Loading a UTF-16 or UTF-32 file is now 3 times faster and saving one is now 4½ times faster. Loading and saving a Unicode file now shows the filename; the conversion progress indicator is shown at a new location. Fixed: Opening a UTF-16 or UTF-32 file added an empty line at the end.
v2.3.1 - Fixed: The progress percentage was only partially displayed when loading and saving a Unicode file containing a byte order mark (BOM).
v2.3.2 - Fixed: Opening a "Unicode" file not ending with a newline caused TSE to hang. "Unicode" between quotes, because in practice this typically happened when a binary file was (without the "-b" prefix) opened as a text file AND was misidentified as a Unicode file. For me this sometimes caused TSE to hang if (with the "-a -s" options) I opened all files in a folder that also contained binary files.
This tool lists TSE's internal editor version number for one file or for files in a folder.
Fair warning: Even for uber-TSE-nerds it would take an exceptional situation for this tool to be of any practical use.
Context: For different but close TSE releases, the editor and compiler executables and .mac files might be compatible with each other. This means that macros do not always need to be recompiled for a new release, as is currently sometimes skipped for .si macros. Whether this is the case is administratively determined by the "internal editor version number" of these executables and .mac files. This tool can list the internal editor version numbers of these files.
This extension makes TSE history lists a lot more effective.
Just start typing a part what you search for to reduce a history list to matches to what you typed.
v1.0.1 fixes the bug, that if you deleted a history entry and without leaving the list immediately tried picking an entry below that, then you got the wrong entry.
This tool shows a list of all files in memory including hidden and system buffers.
You can select a normal file to view it directly, and select a hidden or system buffer to view a copy of its content.
v1.3 recognizes more Semware system buffers and shows a better name for the copy of a selected system and hidden buffer.
This extension will be included in TSE versions released after 23 May 2020. For older TSE versions down to TSE Pro v4.0 you can download it here.
When reopening a file this TSE extension restores the file's previous cursor position.
A regular file is remembered based on its full path and file name.
A temporary file is remembered just based on its file name. This makes it work with tools, that give access to a file outside the local file system by copying the file to an each time differently named temporary subfolder and then call the editor.
The macro is an expanded version of the former TmpState macro, that only remembered cursor positions for temporary files. If you previously installed the TmpState macro, then you are advised to uninstall it in favour of this macro.
v1.4.1 fixes a bug: Cursor positions should not be remembered for TSE's "<unnamed-n>" files.
This macro logs changes in TSE settings.
At any time you can execute the macro for a report of the history of changes in your settings.
It also had the now obsolete functionality, that it could automatically restore our TSE settings after a TSE upgrade. As of Settings v1.3 this obsolete functionality is configurable and default turned off.
As of TSE Pro v4.41.41 TSE releases will themselves retain the same user settings as the Settings macro formerly did.
If enabled again, then this gets automatically restored after a TSE upgrade:
- The configuration settings.
- The window and font position and sizes.
- The descriptions of your own Potpourri macros (*).
- Your own user interface if you had one (* and **).
(*) If they have non-SemWare names.
(**) If your old version is at least TSE Pro v4.4.
v1.2 Documented the Settings macro's dependency on using setup.exe for TSE upgrades, if you want Settings to also restore Potpourri descriptions.
v1.3 Default no longer automatically restore TSE settings after a TSE upgrade, because new TSE releases will do that themselves.
This TSE extension allows you to temporarily zoom in and out by using Ctrl MouseWheel up and down, and to go back to the original size by clicking Ctrl MouseWheel.
While zooming, the screen size is kept as much the same as possible.
To make a screen zoom size permanent, use the TSE menu "Options -> Save Current Settings".
Zooming out is limited to where letters (have) become to small to read.
Zooming in is limited to where a screensize of 80 x 25 characters would no longer fit, because that might stop TSE's menus from working.
v1.3 - Allows disabling its incompatibility warning for TSE's Console version.
An implementation of Conway's "Game of Life".
v1.2.1 has no new features. It makes Life compatible with TSE Pro v4.41.38 upwards.
This tool tries to lock access to Windows until a password is re-entered.
It has a screensaver!
v1.0.1 has no new features. It makes ScreenLocker compatible with TSE Pro v4.41.38 upwards.
When executed it draws a Christmassy picture.
A.k.a. an experiment in programmed fine-textured drawing with TSE.
Based on a user's input I have extended its claimed compatibility to also include the Console version of TSE, but be aware that unless you yourself pre-set a large screen size and a small font size, the generated picture will have a too low resolution in the Console version of TSE.
v1.0.2 has no new features. It makes Xmas compatible with TSE Pro v4.41.38 upwards.
Linux TSE Beta v4.41.35 upwards
This TSE extension enhances TSE by enabling other macros to display extra statuses on the right hand side of the screen, and by enabling them to handle typing and clicking on such a displayed status.
The colour for these statuses, which defaults to the menu colour, can be configured.
The "other macros" should explicitly inform you, that for them to work they require you to install the Status macro first.
v1.2 Added Linux compatibility and some minor improvements, bug fixes and tweaks.
Linux TSE Beta v4.41.35 upwards
This TSE extension enhances TSE by displaying the lengths of the current line, string and word on the right hand side of the screen.
Which of these lengths you want to see can be configured.
The Lengths macro requires the Status macro to be installed.
v1.1 - Added Linux compatibility. Added direct access to the status colour in the configuration menu.
Linux TSE Beta v4.41.35 upwards
This extension will be included in TSE versions released after 30 April 2019. For older TSE versions down to TSE Pro v4.0 you can download it here.
- When a Find or Replace hilites one of its matches, then all other matches currently on the screen are hilited too.
- It does so as a side effect to using existing Find and Replace keys without interfering with their functionality.
- It can hilite once, or it can keep hiliting the last search while you continue editing, and stop hiliting when a configured "stop key" is pressed.
- It also hilites during a Replace's (Yes/No/...) prompts.
- You can configure different hiliting colours for the extra matches.
- It hilites a Replace with the Replace search options.
- It only hilites for commands started with a configured key.
v1.1 - Added Linux TSE compatibility. Increased the existing backwards compatibility with TSE 4.0 upwards.
Linux TSE Beta v4.41.12 upwards
This tool recompiles all macros in TSE's "mac" folder.
With the exception of macros with an ampersand or parentheses in their name. SemWare has one such macro: "find&do".
v1.0.1 Solves a Linux bug.
v1.0.2 Solves a Linux bug in solving the Linux bug :-(.
Linux TSE Beta v4.41.31 upwards
This TSE extension allows you to assign an editing action to a quickly typed sequence of defined keys or mouseclicks.
It uses a Keys.ui interface definition file in TSE's "mac" folder. Its syntax is like a standard TSE .ui file with some minor restrictions. It does not compile with Macro Compile, but is compiled when you save the file.
For example, I use it in the Windows GUI version of TSE to assign a triple tap of the <.> key to the "…" (ellipsis) character, a triple tap of the <e> key to the "€" (euro) character, a triple tap of the <?> key to the "¿" character, and tapping <1><1><2><2> to the "½" character.
Likewise you could for example assign different actions to a double, triple and quadruple tap of the <Home> key.
In Linux TSE it is ideal for adding diacritical marks to characters the same way Windows does for keyboards defined as "international". For example, you can enter an "é" by quickly typing the <'> and <e> keys.
More such examples are given in the example Keys.ui file that is included with the macro.
v1.0.1: Solves compile error for the <'> key.
v1.0.2: Adds lots of key definitions in the example file: Especially the diacritics (accented characters) should be a useful addition for Linux TSE Beta v4.41.31 upwards.
This is an "include file" for macro programmers that contains compiler directives and procedures that help us to create "TSE v4.2 and above"-specific macros that are backwards compatible down to TSE v4.0.
It does so by implementing some of the new TSE v4.2 and TSE v4.4 macro COMMANDS as macro PROCEDURES, and by using compiler directives to only use those macro procedures for the TSE versions that do not support the new macro commands yet, and to use the faster macro commands for the TSE versions that do support them.
Additionally this file contains a group of compiler directives that make the compiler give a clear and specific message if someone compiles the macro with a TSE version before TSE v4.0.
Also it adds backwards compatible names for the component bits of the return value of QueryEditState().
TSE commands implemented as procedures: - Their procedure versions:
- integer proc isAutoLoaded() - 1.0
- integer proc MkDir (string dir) - 1.0
- integer proc RmDir (string dir) - 1.0
- integer proc StartPgm (string pgm_name, string args, string start_dir, integer startup_flags) - 1.0
- integer proc StrCount (string needle, string haystack) - 1.0
- integer proc StrFind (string needle, string haystack, string options) - 1.0
- integer proc StrFind5 (string needle, string haystack, string options, integer occurrence, var integer found_length) - 1.0
- string proc StrReplace (string needle, string haystack, string replacer, string options) - 1.0
- string proc VersionStr () - 1.1
Support procedures - Their procedure versions:
- integer proc compare_versions(string version1, string version2) - 2.0
- integer proc wurn(string text) - 1.0
v1.7: Added StrCount().
For a folder or for a space separated list of folders this tool creates a list of groups of those files, the names of which only differ by a version suffix in the name.
This tool was requested by one user. I created it in the hope that it might have general benefits, but my conclusion is that it does not.
In v2.0 the recognition of versions was rewritten. This was much improved, and is expected to function much better for its requested purpose and type of folders. That said, for general usage it functions slightly better but still poorly.
Linux TSE Beta v4.41.24 upwards
This power tool searches for a list of search terms in a list of files or in all open files.
No more known bugs, no new features planned: Out of beta.
Semware fixed a TSE Linux bug. I fixed BulkFind to no longer work around it. For Linux BulkFind now requires TSE Beta v4.41.24 upwards.
Linux TSE Beta v4.41.20 upwards
This tool is an TEST and EXAMPLE macro for the epoch_to_datetime() procedure, that given a time zone in hours can convert unix's epoch seconds (seconds since 1 Jan 1970 0:00:00) to a year, day, month, hours, minutes and seconds.
v1.0.1 Bug fix: Apparently only February can have a leap day.
v1.0.2 Bug fix: Apparently November 2019 has no 31st day for 1 second.
This tool asks for a space separated list of folder paths, and creates a new file inside TSE containing a list of the full paths and names of all files in those folders and their subfolders.
Explicitly annotates those top folders and files as "inacessible", that it cannot access because of TSE's 255 character path limit or because a folder or file name is not ANSI compatible. As this implies, the contents of inaccessible folders remain unlisted.
Groups the digits of file sizes.
Now shows the correct size for files larger than 2,147,483,647 bytes for TSE versions from v4.40.95 upwards.
This tool is included in TSE Pro v4.41.37a upwards. For older TSE versions down to TSE Pro v4.0 you can download it here.
Given a marked column block of integers of at most 255 characters wide, this tool will add a line below the block with the sum of the integers.
v1.1 Ignores lines where the column block marks nothing.
This tool can be used as a simple calculator for signed integers of up to 255 characters.
It supports addition, subtraction, multiplication, division, and comparison.
It also contains a separate file for macro programmers, the content of which can be copied as a whole into our own macros to do calculations on big integers.
v1.3 is a finished version.
This extension lets macros receive parameters from the command line, without TSE trying to load them as files.
Also included is a macro to test and demonstrate this functionality.
This tool assumes that you want to subtract the lines in the current file case-insensitively from the lines in the previous file, putting the result in a new file.
This tool makes ("mak") one file or all files in a folder read-only ("ro"), or it does the opposite.
Note that the read-only attribute is a very light protection in Windows: It is often and easily ignored. Occasionally it is honoured, which makes it slightly better than no protection at all.
v1.0.1 fixed the bug of the tool stopping on the meta-folders "." and ".." being system or hidden folders.
This tool changes a file's indentation primarily by changing its tab size.
Note that the program name has become 1 letter shorter from version 1.
This macro refuses to work for a file with tab characters. If a file has them, then first use any of the many other solutions to get rid of those pesky things.
Some indentation theory I made up:
Indentation can be tab-size-based or alignment-based.
In natural text tab-size-based indentation is typically used for lists of points or to make a block of text stand out as a block.
In programming tab-size-based indentation is typically used to visually group a sequence of statements as the subject of a condition or iteration by indenting lines one single extra tab-size unit.
Alignment-based indentation however can have any size, including not conforming to any multiple of the current tab-size. Alignment-based indentation is generally used to align the first character of a line with a character on a previous line to visually indicate a semantic similarity between the content at those two positions. A rule of alignment-based indentation is, that between the alignment-indented line and the line of the content it aligns with there can be no lines with a lesser indentation.
Based on this theory this tool (and we) can reasonnably recognize these two types of indentation and differentiate between them.
However, if a text uses tab characters instead of space characters, then we would at the same time have to recognize both alignment types and the tab size. That would be non-trivial.
Luckily the days that computer memory was so expensive that the tab character's disadvantages were acceptable have passed. Modern plain text editors default to inserting the appropriate amount of space characters when we use the tab key.
Therefore I chose for this tool not to cater to tab characters and their users.
v2.0 adds, that (typically in program source code) aligned lines are correctly reindented too.
v2.1 changes no functionality. It adjusts the source file extension from .si back to the standard .s. Also its array implementation was completely rewritten to, while more verbose, to be usable in normal macros.
With this TSE extension you can better see control characters, like null, bell, backspace, tab, line feed, form feed, carriage return, and others.
Better: Default the GUI version of TSE with an ANSI compatible font "hides" control characters by showing them as spaces. The Console version of TSE and e.g. the Terminal font show most control characters as regular characters, which is better but does not differentiate them from those regular characters. This TSE extension always shows all control characters and always makes them recognizable and distinguishable.
Note, that in normal/non-binary mode TSE has stripped carriage returns and line feeds from lines, and what is not there will not be shown. Open a file in binary mode -3 (prefix opening a file with " -b-3 ") to see any carriage returns and line feeds too.
In the TSE menu "ASCII Chart" you see control characters 0, 1, 2, 3 ... 31 also as the column "^@", "^A", "^B", "^C", ..., "^Z", ..., "^_". This TSE extension consistently shows a control character as the second character from that last column in the inverted text colour. This way you can always reference the ASCII Chart for the now visible control characters.
v1.0.1: Improved the documentation.
Hlp2txt generates a readable help file from TSE's built-in Help system.
The help file can be generated in 4 text formats:
- PLAIN - Plain text, without any formatting or special codes. It can be viewed with TSE.
- HTML - This format is great for viewing the resulting document in a browser. The text is thoroughly hyperlinked: Wherever a topic is referenced in the text, selecting the reference will take you to the topic.
- WORD - This format is HTML without hyperlinks, and with Word-specific things added: a .doc extension, extra headers for subtopics from which Word can create an index, Word-specific embellishment-tips. A document generated in this text format can be embellished with Word into a very professional looking printable manual.
- GENERIC - This format is HTML without hyperlinks and without Word additions. It is intended for other applications that can print HTML documents.
The help file can now be generated in 3 character code formats:
- UTF-8 - The default for the HTML, Word and Generic text formats.
- ASCII - The default for plain text when you use an ANSI font like Courier New.
- OEM - The default for plain text when you use an OEM font like Terminal.
Generating UTF-8 does NOT require the Unicode macro. Hlp2txt adapts to its presence and absence: If the Unicode macro is active, then Hlp2txt generates quoted Unicode codepoints for non-ANSI characters, otherwise it generates UTF-8 character bytes.
Changes in v2.5:
Fixed: If the user had their own <Grey +> key definition instead of SemWare's default one, then a mostly empty document was generated.
Reindented the source code from tabsize 3 to 2.
Reduced backwards compatibility to TSE Pro v4.0.
Added automatically determining TSE Pro's version for v4.0 and v4.2 too.
Added a selection screen to select the character code format to generate.
Added capability to generate the file in the UTF-8 character code format.
Fixed: Determining the TSE version did not work for the console version of TSE Pro v4.0.
Removed the underlining from HTML links.
Added compatibility with the beta version of Linux TSE.
Linux TSE Beta v4.41.12 upwards
This TSE extension makes TSE more user-friendly with regard to the case of a file's folder and name.
For Windows it makes TSE show a file's path as it is cased on disk. For example, in Windows TSE has no problem opening "tse\MAC\adjust.s", but by itself it would keep showing "MAC" in upper case.
Its first Linux feature allows you to case-insensitively open a specific folder or file.
Its second Linux feature adds, that if you renamed only a file's case in the editor, then upon saving it to disk the disk file is renamed too, just like in Windows.
Linux TSE Beta v4.41.12 upwards
I have written and downloaded lots of macros for Windows with upper case letters in their names. My user interface file has lots of ExecMacro commands that reference them. And lots of those macros reference each other with ExecMacro commands. Whether these references were in the same case did not matter, because Windows is case-insensitive.
Now there is a case-sensitive Linux TSE beta. Oops! Porting problem!
This tool repairs ExecMacro commands in all opened files that contain an ExecMacro with a differently cased macro name than its disk filename.
In a UI or macro file the command ExecMacro('Adjust') does not work if the macro's disk name is tse/mac/adjust.s .
With this macro you can repair one or all ui and macro files in one go, check its report and unsaved changed files first, and if you are satisfied with the result, then you can save them all and e.g. use the Recompile macro to recompile them all.
ReplaceUnCom emulates TSE's Replace command but only replaces in uncommented text.
v0.2 == v1.0:
- Optimized the comment colour check with a regular expression.
- Added the three ToEOL attributes as comment attributes too.
- Added the check that comment colours must differ from other editing colours.
This tool will be included in TSE versions released after 9 May 2019. For older versions down to TSE Pro v4.0 you can download it here.
This tool is a minor update to SemWare's standard Potpourr macro that implements TSE's Potpourri menu.
This version of the tool only differs in that it accepts macro names of up to 12 characters instead of 8.
This is a TSE extension that enhances TSE's end of line type handling when editing non-Windows files with TSE.
The EolType macro requires the Status macro to be installed.
TSE itself already does a reasonable job of handling end of lines for those non-Windows files that:
- AND exist on disc,
- AND are not empty,
- AND have a correct end of line type.
This macro fills the gaps:
- It also lets you CREATE non-Windows files,
- it adds the correct end of line type to files that were empty,
- it can be configured to repair files with the wrong end of line type,
- it lets you change a file's end of line type.
You might edit non-Windows files for instance:
- on a network drive that is mapped to a Unix, Linux or Mac machine.
- by using a remote-machine-browsing-tool like WinSCP or Total Commander, which you have configured to use TSE as its editor.
- when editing a file you downloaded from the internet.
- It was completely rewritten, and has many optimizations and new features, so here are only the major ones.
- It can display a file's (previous and next) end of line type as a status.
- The strings that identify a file's end of line type are now rules, that have search options, may now contain spaces, may now be regular expressions, and may now be provided for all end of line types, including the "As Loaded" pseudo-type.
- Any old configuration from version 5.1 is automatically converted.
v6.0.1: Textual tweaks.
v6.0.2: Small bug fix: Did not supply the callback parameter when calling the Status macro, which went unnoticed because of a bug in the Status macro. This was fixed the Status macro's 1.1.1 version.
v7: Added understanding the newline characters in UTF-16 and UTF-32 files.
This tool creates a new file from the current file, where every line containing a supplied regular expression is put before itself and before every next line that does not contain that regular expression.
Afterwards you can use existing TSE functionality to search all lines in combination with their tag lines, or to sort the now ubiquitous tag lines on their columns.
When you are done you have the option to remove the inserted tag lines with a column block to get the original file format back.
For example, given the file content:
It can create the new file content:
id=1 street="Main street"
id=2 street="Station street"
This tool is included in TSE Pro v4.41.37a upwards. For older TSE versions down to TSE Pro v4.0 you can download it here.
This tool is an alternative to TSE's built-in List() and lList() commands.
As you type the list shrinks to those lines matching what you typed.
It also works as a stand-alone macro or command to dynamically search the current file.
In my humble opinion it is a more useful alternative to TSE's own incremental search functionality.
What you type is interpreted as a TSE regular expression.
v1.0.1 solves the problem of how to supply a list title when using the macro as an include file.
This TSE extension logs all your TSE keystrokes and which file you did them in, default to a Log\Tse\KeyboardLogger folder in your personal folder.
Each TSE session creates a unique logfile YYYYMMDD_HHMMSS_WWWWW.txt based on the start-time of the session.
v1.1.1: Documented that and why KeyboardLogger needs to be installed below CuaMark in TSE's Macro AutoLoad List.
This TSE extension is a near-perfect solution to the problem, that if you access many files at once, and many or all of them have longer lines than TSE's limit, then you are forced to press "OK" on a separatete warning for each such file.
With this macro installed you only get a warning for the first such file, after which ALL warnings are disabled, but only for the duration of the current user command.
For instance, if you open a 100 files using the "-a" option and a wildcard character, and you then search them all at once using the "a" search option; then this macro ensures that that you have to press OK at most once on a "Long lines split: ..." warning, even if all 100 files have them.
Out of the box this TSE extension enhances the editing of TSE macro source code as you type by setting the keywords of the TSE macro language to their default UPPER, lower, and CamelCase.
This is a major version change, making the installation for its main purpose very simple, but no longer supporting TSE versions before TSE Pro 4.0.
Keywords are not cased when they occur in comments or quotes.
It cases keywords for the current line as you type, and optionally for the whole file when you execute the macro.
A nice addition to this new macro version is, that the default for how keywords are cased is for about 75% determined either by how they are cased in the Help topics of your specific TSE version or by which keywords are defined as constants in the syntax hiliting configuration of your specific TSE version. And you can generate this default again if you ever change to another or even a future TSE version.
Optionally you can reconfigure a lot of details, and you can configure other languages as well.
This TSE extension does the following:
When you double tap the F1 key when editing a TSE program, then TSE's Help is called for the word at the cursor, otherwise the F1 key works as usual.
1.0.1: Bug fix: It did not work in .ui files.
Windows has convoluted rules about when you should and shouldn't quote an entire DOS command line.
This is a problem for TSE macro programmers using the Dos() command.
The included QuoteDos(<command line>) procedure knows these convoluted rules, and returns a quoted command line, or not, as appropriate.
By using the QuoteDos() procedure from an include file, it can idependently be upgraded if that ever turns out to be necessary.
An example macro QuoteDosTest.s is included.
QuickSort.inc include file
TSE itself is "only" capable of sorting lines by sorting them alphabetically on a marked block of text.
With the help of this include file it is relatively easy to create or modify your own macro to sort lines on any criteria.
All you need to do, is to write a "quicksort_compare" function that accepts two line numbers, and returns -1, 0, or 1 whether you want the first line to be before, whereever or after the second line.
The include file contains a "quicksort(line_from, line_to)" function that by calling your function sorts ALL requested lines.
An example macro QuickSortTest.s is included.
Note: Later usage showed that TSE runs into irregularly occurring memory problems when quick-sorting large files.
If two consecutive lines have case-insensitive the same word overlapping the above column-position, then the second line is deleted, from the current line onwards.
If there is no word on the column-position, then no line is deleted.
Version 1.3 adds hiliting the search-results and some minor improvements.
Version 1.2 meets the additional request for a default search-string and for showing totals of finds. Additionally it colors the 'Find:' lines for Windows-versions of TSE, it solves the bug of not being able to select a line outside the current file, and it solves the bug of clashing with the optional Nolines macro.
Version 1.1.1 solved a bug: an infinite loop when searching across files.
Version 1.1 adds searching across files, editing the result-list, and separating the search-results if there are context-lines.
It could be used by other macros to browse directories and select one.
Its source is useful as an example of what a macro can achive with mouse clicks.
Here whitespace-insensitive means that any non-empty string of consecutive whitespace-characters matches any other such string.
Here the whitespace characters are space, horizontal tab, and formfeed.
FndDubLn ignores characters past column 255.
v1.0.0 - 2 apr 2008 - Initial version.
v1.0.1 - 6 apr 2008 - Bug fix: The macro could not handle empty lines, resulting in erroneous reports. The macro now ignores empty lines and lines containing only whitespaces.
It was originally written to make the files on a LAN server an hour older (by adding -1 hour) to solve a synchronization problem when the outside world was about to switch from summertime to wintertime.
When the outside world switched from summertime to wintertime, and clocks went an hour back, then file-times on Windows pcs also went an hour back (*), but file-times on a LAN did not. So if files on Windows pcs were synchronized from a LAN-directory based on date/time, then the switch to wintertime suddenly made files on Windows pcs appear one hour older than the same files on a LAN, which inadvertenly triggered synchronization.
(*) There are also advantages to this: A running Windows process doesn't see a just created file suddenly becoming an hour older or newer. Which for instance also means that a process cannot create files "in the future" :-)
The macro prompts for:
- The directory.
- The type of time-unit: years, months, days, hours, minutes, seconds.
- The positive or negative number of time-units to add.
- Whether to Simulate or Make the changes.
Use this macro at your own risk. It is not perfect.
Always do a simulation first, and especially search the resulting report for "overflow", which means that a certain date/time will not be changed.
Especially when you use TSE's -a and -s options and wildcards you can and want to open whole direcories or directory trees of files, but without those pesky exceptions.
This macro notices it when you try to open such files, and asks your confirmation to NOT open them.
You get one question for each File Open command that results in opening such files, and your answer applies to all files opened by that specific File Open command.
You are asked the question only when the editor is otherwise idle, so that the macro doesn't interfere with other macros.
For the same reason the macro internally works by letting TSE open the files, and then closing the unwanted ones.
The macro works by matching the names of opened files against a TSE regular expression, and asks the user a question to confirm to not open the matching files.
You can configure your own regular expression and question by executing the macro. The default configuration is for .bak and Subversion metafiles.
Solves a nasty bug which sometimes caused AbanName to incorrectly load one file as if it were an empty file.
Improves the warning if too many files were opened.
TSE lets you open files without loading them, thus avoiding a memory limit. Contrary to TSE's own Find command, this macro can search across files only temporarily loading one file at a time, thus also avoiding a memory limit.
The macro can also "Find and Do" to Keep or Abandon files containing a certain string: You can do this multiple times, thus step by step zeroing in on a smaller and smaller selection of opened files.
Improves the warning if too many files were opened.
Removed the dependency on global.zip and macpar3.zip.
Added a pre-emptive check (including for regular expressions) to warn the user, that there is no use in searching for an empty string.
This tool lets you run TSE commands from the Macro Execute menu. From TSE v4.40.25 onwards you can alse run Execute as a macro to apply from from the corresponding Find&Do submenu.
Used from the Macro Execute menu it is great for testing
a TSE command, or short sequences thereof.
Macro Execute: Execute Warn('Hello world at'; GetTimeStr())
You can not download Execute.zip here.
I chose not to duplicate it here, because it has not changed since it was uploaded to SemWare's TSE Pro macro files page.
Beta versions of TSE macros
This TSE extension allows us to open URLs that occur in the text.
This is a very early beta with known imperfections and lots of missing features.
Planned features include: Opening URLs that do not start with "http", opening files, highlighting openable URLs and files in the text, some backwards compatibility, some Linux compatibility.
Linux TSE Beta v4.41.12 upwards
This TSE extension can log TSE events visually and/or to a file.
This occurs in the window's title bar, where it does not interfere with what happens in the editor. It is very slow, because it has to pause for you slow user, but it lets you see everything simultaneously as it happens.
In Linux for me using Putty the visual logging appears in the Putty title bar, but it works very badly. Perhaps Linux needs a Message() instead of SetWindowTitle(), but that would interfere with the screen.
This is fast, but reviewing the log afterwards requires more interpretation.
The macro can be configured by adjusting "Configuration Constants" at the start of the source code before compiling and loading the macro.
Demo TSE macros
Linux TSE Beta probably any version
This tool lists what keys TSE can send to itself, when it is not interfered by an operating system or other software, and without the limitations of a keyboard.
It gives some insight into TSE's internal key capabilities and limitations, but otherwise has no practical use.
This is a quick&dirty adaptation of Semware's "match" macro dd 6 Apr 2020.
Like the Match macro, for the bracket under the cursor it jumps to its counterpart, but as requested by a user it ignores any in between commented brackets. So it "matches uncommented" brackets. [Is that even English?]
I do NOT recommend substituting Match by MatchUnCom. MatchUncom has known flaws:
- It blindly assumes that comment colours are always delimiter colours, which for some configurations might be false.
- It is badly tested. The user's example test case worked on the first try, and I didn't test any further.
This example macro asks for a regular expression, and calculates the minimum length it can match.
The usefulness of this macro lies primarily in that it contains a procedure which can be copied into your own macros.
Often regular expressions that can match an empty string are not useful. Worse, they can also be dangerous when used for searching inside a loop, which can then become infinite because the empty string always matches without advancing the cursor. This macro [procedure] returns zero for such regular expressions, and thus helps you and your macro recognize and avoid useless and dangerous searches.
Not maintained TSE macros, in various states
This is neither a finished nor a well-working macro.
I do not see a way forward, so I am abandoning this one.
The intention was to show "best matches first" for a search string applied to the current file, BUT:
- Intentions turned out to be hard to catch in programming logic. I experimented with applying a weight to results, but this did not work satisfactory.
- Implementing intentions turned unavoidably into implementing my own biases, and worse, my current biases based on my current purposes. That made it impossible to make this a generic tool.
- For larger files it worked too slowly. I reduced the searched number of results, but that reduced the results. Sadness and pun intended.
Shows not only the current date/time of the current file on disk, but also the date/time the current file had on disk at the time it was loaded.
If TSE warns a user "Disk file has been changed by another program. Save Anyway?", then this macro lets a user verify that warning.
This macro lets you view long lines window-wrapped while still editing the original unwrapped lines.
Disclaimer: No it doesn't. This macro works imperfectly.
v1.1 29 March 2009
A tilde indicator in the statusline shows if the file is in WinWrap mode. That only means that the file contains wrapped lines somewhere, not necessarily in the visible window.
v1.0.2 26 March 2009
Solved: Auto-wrapping wasn't delayed when the macro was autoloaded and TSE was started with a file.
v1.0.1 26 March 2009
Solved: The macro didn't compile for TSE Pro 4.0: the isAutoloaded() function doesn't exist yet in that version of TSE.
This macro changes the color of the cursor position: if the background color equals the one configured for TSE's cursorline, and: either only when the cursor is not on a visible character, or always.
The occasion for this macro was a user who uses a TSE color "intense ... ... on black" (which means a dark grey background): for this background color TSE doesn't show the cursor if the cursor position is a whitespace.
This macro remedies three potential Cobol issues:
- All TSE Pro versions are not capable of coloring columns, neither column 1 thru 6, nor column 73 to the end of line.
- Cobol versions up to and including Cobol-85 indicate comments by putting an asterisk or a slash on column 7. Since version 3.0 TSE Pro supports this with to-end-of-line syntax hiliting if a configurable character is present at a configurable column. TSE Pro 2.8 users need this macro to do the same.
- For old versions of TSE (but >= 2.8), which don't have a Cobol syntax hiliting file yet, you can install one.
I consider this macro OBSOLETE. It was written because TortoiseSVN versions prior to 1.8 needed minutes to open a folder with thousands of files in it. This macro could do it immediately.
In TortoiseSVN 1.8 this problem was solved, so I saw and see no reason to finish or maintain this macro.
For Subversion repositories I recommend TortoiseSVN instead of this macro.
The idea was to create a menu with both fillable fields and normal menu lines, but I cannot get it to work correctly. Usually I like the challenge of taking a tool past its intended use, but this has by now wasted way too much of my time, so I'm dropping it indefinitely.
It isn't even a real beta: it is just a half-built version 1.4.
You could also look upon it as a progress report.
v5.1 (beta) of the EolType macro. Compatibility: TSE Pro 2.5e upwards.
This OLD macro version is kept for OLD TSE versions.
I downgraded this macro to beta status, because the 5.0 to 5.1 changes were not tested yet. Please report any reproducible errors you might find.
Save files with a unix/microsoft end-of-file-type based on configurable substrings that do/don't occur in the files' full filenames.
Possibly handy when working with a Samba drive, Total Commander, WinSCP and other such tools.
Since the previously to SemWare's website released version was 1.0, the "new" features are:
- The substrings no longer have to start with a drive letter.
- Configuration file tse32\eoltype.dat became tse32\mac\eoltype.cfg.
- You can now configure what end-of-line-type warnings and questions you want when saving a file whose end-of-line-type is as configured being changed by the EolType macro.
This macro synchronizes (by ftp) directories from a pc to a server and/or back.
I use it after changing my offline website to update my identical online website. I have a syncdir.bat file that simply contains:
@call \tse32\g32.exe -eSyncDir
The macro needs macpar3.zip from SemWare's website to be installed first.
Like the version number indicates, the macro was and is a bit of a hack for my personal use, and is provided as is, with no garanty whatsoever.
Purpose: Search for a string which might span lines.
This is not a working macro! It is only half built. I am just sharing what I have been working on.
This macro's theory is, that you can search for a string which spans lines by putting a "slide" of lines under a "microscope", and moving the slide from the beginning to the end of the file in such a way, that the macro can use TSE's own Find command search each slide as if it was one line!
Well, the slide part is largely implemented, the search part not at all. When implementing the search part, it will have impact on the slide part, which probably needs a little extending then.
Given Tidy as an alternative, I won't proceed with building this macro.
This version is for historical purposes while the new version is being developed.
V0.5 (a buggy beta) of the WinWrap macro, formerly known as the ScrnWrap and LongLine macro. This is a windowwrapper, as opposed to a filewrapper. It wraps lines that are longer than the current window is wide, but it only wraps them on-screen, not in the editing buffer or the disk-file. It therefore does not interfere with most editor functions. However, it therefore does interfere with syntax hiliting, block marking, find marking, the "[End of File]" indicator, and the WhtSpc macro.
New in Version 0.5: Made the macro deactivate itself when there is blockmarking in the current window, and reactivate itself as soon as there isn't any more. If the WhtSpc macro is loaded, then it is deactivated during wrapping, and reactivated as soon as there is no more wrapping. Executing the macro now toggles it on and off. Alas, turning it on again is subject to a known bug.
I will not not develop this macro any further, because I have concluded that the current approch is not fully compatible with TSE's implementation. TSE has a (for this macro's purpose) nasty habit. "Normal" screen updates can immediately be corrected and overwritten by hooks, but screen updates as the result of scrolling can only be corrected with the _idle_ hook, which happens so much later that it causes the screen to flicker. Besides that there is a "no screen updating" bug. I have concluded that the current approach of creating a reformatted screen over the image of the original file will never work satisfactory. Another approach might be temporarily formatting the file itself, and (e.g. before saving) being able to reformat it back. A second alternative might be to show a formatted shadow-file to the user. That said, this macro's functionality is so low on my list of priorities, that its development is hereby stopped.