Kurt McKee (kurtmckee) wrote,
Kurt McKee

Tera Term subroutines

A long time ago I inherited a big monolithic mess of Tera Term macro code. After a few years the code base had grown considerably and become extremely unwieldy. I finally decided that it was time to fix the problem and created some utility code that would allow me to make the code more modular (and make the code more reusable for other projects). The result is subroutine.ttl, licensed under the terms of the MIT license.

This creates something akin to a namespace and function notation for Tera Term macros:

callsub = 'logging:backup_logs'
include 'subroutine.ttl'

For this to work, just create a logging.ttl file, copy some boilerplate/hook code to the top of the file, and add a block of code like this:

    ; The backup code goes here

Thanks to Tera Term's scope-less variables (or, from another point of view, global-only namespace) you can even "pass" arguments and "return" values. Enjoy!

Tags: function, macro, programming, subroutine, tera term, teraterm

  • Twelve days later

    It's been twelve days since my shoulder surgery so I thought I'd post a summary of what I've been up to. In the first 24 hours there was an issue…

  • In the beginning

    My first programming language was some variant of BASIC on a VTech Precomputer 2000. Then one day I discovered that a copy of QBasic was included…

  • The Debris Cathedral

    For a very long time I've been writing code at my job that automates some very tedious tasks. It's not Python code, though! It's a macro language…

Comments for this post were disabled by the author