The SemWare Editor (TSE) is a general purpose plain text editor.
What is brilliant about TSE compared to other editors, is that its makers first 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 referred to as its macro language. It is well documented and easily accessible through TSE's internal Help system. It 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 the 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.
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 differences are:
- TSE runs in a window instead of full-screen. The window is resizable, 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 beta Linux version of TSE. Lots of things do not work! My macros are not intended to be compatible with Linux TSE unless stated otherwise. Only a few macros are.
Undocumented TSE Pro v4.4 features
This plain text file (UTF-8) describes some features of TSE Pro v4.4 that are not documented in the built-in Help system.
All topics are constantly being tweaked when possible. Only topics that were new in the last 31 days are listed below.
Added HookDisplay() and UnhookDisplay().
Added UnloadBuffer() and UnloadAllBuffers().
Added EditThisFile(), FileExists(), and fOpen.
Current TSE macros
Linux TSE Pro v4.41.24 upwards
This tool searches for a list of search terms in a list of files or in all open files.
In the default output "HELP"-like display mode, duplicate lines are now merged, displaying multiple hilited search results per line.
The "out=<outputfile>" parameter now works.
If the "in" and "for" file were not opened before BulkFind, then they are no longer open after BulkFind.
Implemented the "fmt=finds" parameter.
Fixed some very minor bugs.
Improved the documentation.
Reduced memory usage and increased search capability by only temporarily loading unloaded files.
Fixed the message line flashing.
Fixed duplicate result lines.
Made BulkFind compatible with Linux TSE v4.41.20 upwards.
No more known bugs, no more features planned: Out of beta.
Semware fixed a Linux bug. I fixed BulkFind to no longer work around it. For Linux BulkFind now requires TSE Pro v4.41.24 upwards.
Tested with TSE Pro for Linux v4.41.20.
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 has a leap day.
v1.0.2 Bug fix: Apparently November 2019 has no 31st day for 1 second.
This tool tries to lock access to Windows until a password is re-entered.
It has a screensaver!
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.
Grouped 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.
Given a marked column block of integers of at most 255 characters, 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.
Included is a test 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 one file or all files in a folder read-only, or 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 spaces, then we would at the same time have to determine the tab size too. The combination of those two is not 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.
And 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 make them stand out from regular text. This TSE extension shows all control characters and always makes them stand out.
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.
This extension makes the TSE history lists a lot easier to use.
Just start typing what you search for to reduce a history list to all its matches.
This TSE extension finally mitigates the problem, that a TSE upgrade overwrites most of our TSE settings.
This macro logs changes in TSE settings. It can restore those settings and some other stuff when it detects a TSE upgrade.
At any time you can execute the macro for a report of the history of changes in your settings.
When you upgrade TSE, ideally with setup.exe,
it automatically restores many TSE settings:
- 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 (*) (**).
It automatically logs changes of your TSE settings.
- When executed it creates a nice report of the history of those changes.
(*) If they have non-SemWare names.
(**) If your old version is at least TSE Pro v4.4.
Compensates for a TSE bug in TSE v4.41.16 - v4.41.17.
The TSE bug in TSE menu terminology: "Write settings to ASCII file" writes a "Max History Entries" above 32767 as a negative number. Internally this setting is called "MaxHistorySize". When this macro is used to restore TSE settings, then it now replaces a negative MaxHistorySize with 32767.
v1.2 Documented the Settings macro's dependency on using setup.exe for TSE upgrades, if you want Settings to also restore Potpourri descriptions.
This TSE extension will be included in TSE versions released after 30 April 2019. For older TSE versions back to v4.0 you can download it here.
- When a Find or Replace hilites one of its matches, then all other matches on the screen are hilited too.
- It does so as a side effect to existing Find and Replace keys without interfering with their functionality.
- It can hilite once, or 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.0.1 - Fixed a documentation error.
v1.0.2 - Made its recognition of TSE versions a tiny bit more robust.
Extends TSE with the ability to edit all major Unicode formats; UTF-8, UTF-16, UTF-32, and variants thereof; big endian (BE), little endian (LE), and 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 block) 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.
- Previewing a non-ANSI character is possible but default disabled because it works imperfectly.
- A file's character code format (ASCII, ANSI, UTF-8/16/32[BE/LE][+BOM]) is shown as a status.
- You can explicitly change a file's character code format by right-clicking or pressing [Shift] F10 on the status. Note that this allows you to convert any of the known formats to any (other) Unicode format.
- Conversions of well-formed character encodings are lossless!
- ASCII or ANSI files are semi-automatically upgraded to another character code format when you start using non-ASCII or non-ANSI characters.
Key lacking features:
- It does not display non-ANSI characters graphically. ANSI 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.0.2 - Major bug fixed for reading and writing UTF-8 files, introduced 20 days earlier in version v1.5.
v2.0.3 and v2.0.4 - Minor bug fixes.
v2.0.5 - Updated the supplemental files from Unicode 11 to Unicode 12.1.
v2.0.6 - Major bug fixed for reading UTF-16BE and UTF-32BE files
larger than 8 kB.
The bug became likelier for each multiple of 8 kB of a file's size.
Luckily Windows and most applications that use UTF16 use UTF-16LE, not UTF-16BE. UTF-32 is uncommon in both forms. This probably explains why nobody found and reported this bug.
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 Pro 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 Pro 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.
Linux TSE Pro Beta v4.41.12 upwards
This tool recompiles all macros in TSE's "mac" folder.
With the exception of macros with an ampersand in their name. SemWare has one such macro: "find&do".
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 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.5 - Added wurn(), which does not have Warn()'s compatibility
issue across TSE's GUI and console versions.
Wurn() displays the same nice multi-line overflow-wrapped pop-up window in both TSE versions as Warn() only does in the GUI version.
- Added compare_versions() which e.g. can be used on VersionStr() results. This allows for a more detailed version determination than with the compiler directives, but in run-time.
- Added setting the WIN32 compiler directive for the Linux TSE beta, because despite its name this directive actually indicates a "32-bits" TSE version, which all Linux TSE betas are.
v1.3 - Added backwards compatible names for the component bits of the return value of QueryEditState().
v1.2 - StartPgm() added; RmDir() compiler directive fixed.
v1.1 - StrFind5() added.
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.
A minor update to SemWare's standard Potpourr macro that implements TSE's Potpourri menu.
This version of the macro will be included in TSE releases occurring after 9 May 2019. For older versions of TSE back to v4.0 you can download it here.
This version of the macro 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.
And after that you can 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:
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.
When opening a file again this TSE extension remembers the cursor position from previously viewing the file. It does this both for temporary and regular files.
A regular file is remembered based on its full path and file name.
A temporary file is remembered just based on its file name. The latter is to address that tools often recreate what is actually the same file each subsequent time under a different temporary folder.
The macro is an expanded version of the former TmpState macro, that only remembered cursor positions for temporary files. If you use the TmpState macro, then you are advised to uninstall it in favour of this macro.
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.
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.
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.
1.0.1: Bug fixed: An infrequently updated status would start flickering after a minute.
1.1: The macro now broadcasts its version, so that calling macros can check it.
1.1.1: Tiny bug fix: Even when the calling macro did not supply the callback parameter, it was still called back when the user clicked or typed a callback key on the status.
This TSE exttension 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.
1.0.2: Bug fixed: Stopped infinite warnings if the Status macro is not installed.
1.0.3 and 1.0.4: Optimized it a bit for old TSE versions.
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.
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.
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.
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.
A.k.a. an experiment in programmed fine-textured drawing with TSE.
v1.0.1 (28 dec 2007)
- Solved a rarely occurring "divide by zero" bug when stopping.
- Optimized the "reduce font size" statements.
- Added an "Are you sure?" -like question when stopping.
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
Linux TSE Pro 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, logically, 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
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.
This macro enables TSE to open Alternate Data Streams from the commandline.
The odd zip filename is to keep advertisement blockers from blocking this perfectly non-commercial file. I spent a very frustrating hour not understanding why my browser would not show me a hyperlink to ads.zip .
v1.0 - 15 mar 2008 - Initial version.
v1.0.1 - 17 mar 2008 - Removes an inappropriate error message when opening a new ADS, and ensures a correct filechanged-indicator after opening a new or existing ADS.
v1.0.2 - 17 mar 2008 - Optimized the macro with Sam Mitchell's find, that the InsertFile() command can be used to load ADSs: now the macro can avoid a Dos() command and a second temporary file per ADS.
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.