🏠

The Semware Editor

Macro Programming Demos and Tests

v1
26 Apr 2024
Linux TSE

This tool demonstrates a Linux terminal capability to TSE macro programmers.

An application running in a Linux terminal can call terminal functions by sending certain character strings to STDOUT. Some of those functions send result strings back to STDIN.

This tool demonstrates how to call such a function and how to process its result.

It uses "getting the terminal's cursor position" as a simple example.

The exciting part is, that advanced terminals can execute advanced functions.

This theoretically opens the way to new Linux TSE functionality.

The drawback is, that less advanced terminals will not be compatible with this.

v1
24 Apr 2024
TSE v4 upwards

This tool tests GetMarkedText() after MarkStream().

It shows no changes between TSE versions from v4 onwards.

It does show that GetMarkedText() ignores marked "characters" after the end of a line.

v1
24 Apr 2024
TSE v4 upwards

This tool tests TSE's copy commands when used after MarkStream():

  • Copy()/Paste()
  • CopyBlock()
  • CopyToWinClip()/PasteFromWinClip()

v1.0.1
10 Apr 2024
Untested compatibility

This extension gives every edit buffer its own ViewFinds buffer.

Details:

  • TSE's "Search" menu has a "Redisplay View PickList" function.
    • Without this extension it shows the results of the last search with the "v" option.
    • With this extension it shows the results of the last search with the "v" option that was done in the current buffer.
  • In other words, the extension provides a ViewFinds list per edit buffer.
  • This new functionality has advantages and disadvantages that depend on user preferences. The extension is simple to install and deinstall, so trying it out is easy.

Credits:
This extension is based on the idea and code provided by Eliyahu Trigoub.

v1.0.1 Documented that the "a" search option is ignored if combined with the "v" search option.

v1.0.1
27 Mar 2024
TSE v4 upwards, all variants

This tool tests TSE's SearchPath() statement.

Its code is written so that its relevant part is includable in sanity1.

It automatically adapts to test SearchPath() with both values of SearchCurrentDirectory for TSE versions from v4.50rc20 upwards, and to working with older TSE versions.

It has a really cool debug option that shows off which files are searched in which order.

v1.0.1
Bug fixed: Was not compatible with Semware's Sanity1 tool as claimed.
Two commented meta-tests added to intentionally produce an error in two different forms.

v1
31 Jan 2024
Windows GUI TSE 4.50 rc 17 !downwards!

This tool is obsolete for TSE v4.50rc18 upwards, because the time difference has been fixed in TSE v4.50rc18.

This tool helps make DirList output comparable between Linux and Windows by diminishing all " h:mm:ss" and "hh:mm:ss" times it finds by 2 seconds.

The tool works on the whole file. It does not diminish the date if the old time is 0:00:00 or 00:00:00.

REASON
If you run DirList from Windows TSE and Linux TSE on the same directory of a Linux system in WSL, then the times usually differ by 2 seconds, because currently Windows TSE rounds up and Linux TSE rounds down to even seconds. This makes it hard to compare results.

v1.1
13 Jan 2024
TSE 4.50 rc 17 upwards, all variants

This tool lets us visually test whether Linux TSE supports RGB colors in a specific Linux terminal or command line.

In Windows GUI TSE the tool is always capable of showing the pretty RGB colors we hope to see in Linux.

v1.1
Made TSE 4.50 rc 17 the minimum requirement.
Made it independent of TSE settings.
Added resetting the terminal/command line screen afterwards.
Perfected its existing functionality.

v1.3.1
5 Jan 2024
TSE v4.50 rc 17 upwards, all 3 variants

This tool tests TSE's sort macro and TSE's internal and external sort.

v1.3.1 - 5 Jan 2024
Updated the documentation.
Updated the version requirement to needing at least TSE v4.50 rc 17.

v0.1
28 Dec 2023
Windows GUI TSE 4.??, font Courier New, not-maximized screen

This extension tests drawing around text.

It tests it by drawing blocks of pixels around all text.

CAVEAT: It only works for Windows GUI TSE with the Courier New font in a not-maximized screen.

v1
17 Oct 2023
Tested with Windows 10

The "make_dir_file_test.cmd" file creates a set of long and deep directories and file names. And a few directories and files with a non-TSE character in their name. They all have a root that starts with "D:\Long_" to be easily recognizable. You can change the drive letter.

v0.1
11 Oct 2023
Windows TSE v4.41.37a upwards

This extension/tool demos how a not-yet-existing _BEFORE_FILE_OPEN_ hook could enable an extension to open remote files for protocols like HTTP and SSH, seemingly from TSE's own Edit(This)File prompts.

v1
21 Sep 2023
Tested with TSE GUI 4.50 rc 11 (2023 Sep 2)

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.

v1
26 Jul 2023
Windows TSE 4.4 upwards

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.

v1.0.1
27 jun 2023
Tested with GUI TSE v4.50 rc5

This tool demonstrates, that while TSE's Color() function accepts 288 possible descriptions, they result in only 255 colors.

5 jun 2008
5 jun 2008
Not tested, but at least TSE Pro v4.0 (GUI) upwards
This is not a stand-alone macro.

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.

v1
22 Dec 2021
Windows TSE PRo v4.0 upwards
Linux TSE Beta ? - v4.41.46 upwards

TSE's menu options have a static helpline.

This is a demo for macro programmers, that shows how to program a TSE menu option with a variable helpline.

On the bright side, it is well documented and helper procedures are provided.

On the dark side, it uses a dirty trick to work around TSE's static menu option helplines, and might not be future-proof.

v1.0.2
16 Jan 2020
Windows TSE Pro v4.0 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 Fixed: Apparently only February can have a leap day.

v1.0.2 Fixed: Apparently November 2019 has no 31st day for 1 second.

v1.0.1
28 Jan 2023
Tool compatibility: TSE v4.41.35 upwards
GetLongPath() compatibility: TSE v2.6 upwards
All TSE variants, but short names not tested in Linux.

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.

v1
16 Dec 2022
TSE v4 upwards (intended, not tested)

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.

v1
11 Nov 2022
Windows TSE GUI v4 upwards

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.

v1
11 Nov 2022
Windows TSE GUI v4 upwards

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.

v1
14 Sep 2022
Windows TSE v4 upwards

This tool demonstrates downloading web pages and the downloadable files on them using two Semware download pages as an example:

Latest TSE macro sources from Semware

Old Semware page with user uploads

Note that downloading 112 + 378 files might take about 9 minutes.

v1.2.1
30 Mar 2022
Windows GUI TSE v4.2 upwards

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.

4 Mar 2022
Windows TSE v4.4 upwards; tests OK with Linux TSE 4.42

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.

28 Dec 2021
Windows TSE Beta v4.41.42 (probably)

This test macro reveals the correct parameter formats for TSE Beta v4.41.42's new and incorrectly documented CompareLines() function.

26 Feb 2021
Windows TSE Pro v4.4 upwards
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.

v1.0 - 20 May 2020
Windows TSE Pro v4.0 upwards
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.

v0.1 - 6 Apr 2020
TSE Pro v4.4 upwards

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.

v1.0
29 Dec 2019
GUI version of TSE PRo v4.4 upwards

This TSE extension allows you to use the ampersand ("&") as a menu quick-key.

Included is a test macro to test and demonstrate this functionality.

This is a very niche extension for a very, very specific "problem".

Version: Unknown
4 may 2006
Compatibility: Unknown

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

v1.0
23 Jul 2021
TSE PRo v4.0 upwards

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.

v0.1
13 Sep 2019
TSE PRo v4.0 upwards

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.

6 jan 2008
The LoadTime macro.       Compatibility:   TSE Pro 4.0 upwards.

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.

29 mar 2009
v1.1 of the WinWrap macro.       Compatibility:   TSE Pro 4.0 upwards.

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.



History:

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.

16 mar 2009
The CurColr macro.       Compatibility:   TSE Pro 4.0 upwards.

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.

10 mar 2009
Version 1.1 of the CblComnt macro.       Compatibility:   TSE Pro 2.8 upwards.

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.
Note: the macro can also be configured for syntax-hiliting Fortran comments.

25 Feb 2013
An incomplete but fast Subversion browser.       Compatibility:   TSE Pro 4.0 upwards.

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.

13 dec 2009
v1.3.9.1 (not-working failure) of the eVwFinds macro.       Compatibility:   None.

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.
26 nov 2009
v1.3.9 (working beta) of the eVwFinds macro.       Compatibility:   TSE Pro 2.5e upwards.

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.
1 apr 2007
NOTE THAT THERE IS A NEWER VERSION OF THIS MACRO ON THIS SAME PAGE!

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.

Purpose:
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.

Version 5.1:
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.
7 dec 2006
v0.1.0 of the SyncDir macro.       Compatibility:   TSE Pro 2.8b upwards (probably).

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.
12 nov 2006
v0.0.1 of the sFind macro.

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.
9 nov 2006
v0.10 of the MLformat macro.   Actually, this is a not implemented macro!   It is just a documented plan of attack for a first version of an HTML and XML formatter.

Given Tidy as an alternative, I won't proceed with building this macro.
13 sep 2005
Database v0.01 for TSE Pro 4.0 upwards.   Specific purpose: allows TSE to be configured as an external tool of PL/SQL Developer .   For starters for the viewing or editing of a package (body) that is active in the browser-pane of PL/SQL Developer.   Requirement: the macro needs an Oracle MsDos SqlPlus client.
5 sep 2005
NOTE THAT THERE IS A NEWER VERSION OF THIS MACRO ON THIS SAME PAGE!

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.
7 jun 2005
ReadReg macro.   This is not a practical macro, just a demo for macro programmers.   It demonstrates how to read the values of a Windows registry key from TSE.
18 apr 2005
Just an exchange of ideas, this macro has no permanent value.   This zipfile contains new2.ui, based on Sammy's new.ui from his test2.zip.   New2.ui does not have fixed menus for menu_styles and key_bindings, but those menus are generated based on the existence of *.menus.s and *-keys.s files.   All a user has to do is copy a *-menus.s or *-keys.s file to another *-menus.s or *-keys.s file (with a new name of course), and TSE will instantly offer it as a new menu choice.
14 jan 2003
Example of User Interface adjustment outside .ui file.
30 mar 2001
Convert EBCD to ASCII, or back.
16 nov 1998
Sorts an ASCII file in EBCD order.

These webpages are created and maintained with The SemWare Editor Professional