Macro Programming Demos and Tests
This extension continuously reports the color name of the character at the cursor.
It is intended for testing, because it is not always possible to visually distinguish colors.
This tool lets us visually test whether or how well TSE supports RGB colors.
It was created when Linux TSE 4.50 rc 11 alledgedly became RGB compatible.
The tool does work in the Windows GUI version of TSE.
For Linux TSE 4.50 rc 11 the tool or TSE does not work on my main Linux systems.
v1.0.1 Fixed: The shown color mixes did not match two of the button names.
This tool matches a set of 16 input colors to TSE's 16 standard color(name)s.
Suppose you found 16 colors you like and want to assign them to TSE's 16 standard color(name)s as documented in SetColorTableValue(). This tool will try to find the closest match of your new colors to TSE's named colors.
However, for the tool, which uses two main algorithms, the second algorithm does not work perfectly.
The first algorithm determines how well each input color matches with each standard color. For this the tool treats each RGB color as a 3-dimensional coordinate and calculates the visual similarity of two colors as the distance between their coordinates. Tests confirm that this works well.
The second algorithm tries to find the best match for a whole set of input colors with a whole set of standard colors. The current approach does not work perfectly. The algorithm simplistically matches closest colors first. This results in problems at the end, where because of the lack of remaining unmatched colors it has to make bad matches.
The problem has similarities to searching a route to a target destination, where simplisticly selecting each next road that most reduces the straight distance to the target can result in a longer route.
Preliminary exploratory tests suggest, that a better result can be achieved by searching for the set of input colors for which the sum of all its individual color distances to their matched standard colors is the smallest. This requires an algorithm that smartly searches a solution space of 21 trillion color set combinations.
Given that my technical interest was raised by the first algorithm, and given that nobody has expressed an unequivocal need for the complete tool, I am going to postpone its further development indefinitely.
This tool demonstrates, that while TSE's Color() function accepts 288 possible descriptions, they result in only 255 colors.
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.
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 Fixed: Apparently only February can have a leap day.
v1.0.2 Fixed: Apparently November 2019 has no 31st day for 1 second.
This include-file provides macro programmers with the get_drive_type() function, which returns a drive's or a file's drive type, like whether it is on a removable disk, local disk, network drive, compact disk or RAM disk.
Because it uses a Windows function it has the same limits as Windows in recognizing drive types. My personal pet peeve is that Windows sees my harddisks and USB drives (not sticks) as the same drive type.
A get_drive_type_test macro is provided to test and demonstrate get_drive_type()'s use. It lists all your drives and their type.
This tool implements and tests the included function GetLongPath(), which implements the opposite of TSE v4.41.35's GetShortPath() function.
v1.0.1 Fixed: GetLongPath() now returns the input file specification if it refers to a file that no longer exists.
This tool shows how many Hook()s are currently free, and, assuming the maximum available amount of Hook()s is 158, how many Hook()s TSE is currently using.
When running this tool in Windows GUI TSE 4.48 with all macros purged, it says that 158 Hook()s are free.
This tool asks for a file or files, and gets their last-written dates and times to the millisecond.
Context: As opposed to TSE and its macro language, which show and return file times rounded up to the next even second.
This tool demonstrates, that when you save a file and immediately spawn a second TSE instance to process it, the spawned process appears to have an earlier start time than the saved file's time.
This can be up to two seconds earlier.
This is caused by TSE's macro language returning the actual system time, but returning a file's time rounded up to the next even second.
This tool demonstrates how to write Unicode characters to TSE's screen, and explores and documents its capabilities and limitations.
v1.1 Documented additional things I learned. Speculated some more about possible usages.
v1.2 Documented that I learned that "Arial Unicode MS" is not a standard Windows font, so a tool cannot rely on its presence.
This is a tool for macro programmers, that checks the Hlp2txt tool's hidden raw Help file for link errors, warnings and notes.
Summarized answer for TSE 4.42:
It reports no errors or warnings.
It notes 337 subtopics that are never addressed, with the technical reason why. The latter is technically interesting, because of the Help's multiple implicit rules for addressing a subtopic.
For an extreme example; there are 3 subtopics for which there is a link to their address, but they are not addressed with their specific topic, and while their address does not overlap with a topic address, their address is the same as that of an earlier occurring subtopic.
The never-addressed subtopics are technically an error, but in practice they cause nothing to malfunction and only hamper Semware's maintenance of the Help, so they only get a note instead.
Here is a look at its report.
This is a tool for macro programmers, that helps to examine what extra topics TSE's Help contains, that are not shown from its its index.
Summarized answer: Menu-help topics, indirectly linked-to topics, obsolete topics, and InfoBoxes.
Here is a look at its report.
This test macro reveals the correct parameter formats for TSE Beta v4.41.42's new and incorrectly documented CompareLines() function.
Linux TSE Beta probably any version
This is an include-file for macro programmers, that provides the functions repeatable_lFind() and repeatable_lRepeatFind(), that unlike their TSE counterparts do not loop infinitely for a search with the "a" search option.
A demo/test macro is included too.
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 and experimental TSE macros, in various states
This tool was created for one specific user at their request. I generalized their request a bit, but I doubt this tool is useful to others.
From a file with search-recognizable keywords, generate keyword-named files, each containing the lines with their keywords.
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.