42 Astounding Scripts

MacOS uses Perl, Python, AppleScript, and Automator and you can write scripts in all of these. Build a talking alarm. Roll dice. Preflight your social media comments. Play music and create ASCII art. Get your retro on and bring your Macintosh into the world of tomorrow with 42 Astoundingly Useful Scripts and Automations for the Macintosh!

Jerry Stratton

In large programs the only unlabeled constants are 0 and 1. — John M. Nevison (The Little Book of BASIC Style)

Simple game menu for the Color Computer 2 with CoCoSDC—Wednesday, September 7th, 2022
CoCo sample menu screens

Two menu screens from MENU.BAS: some of my favorite games from The Rainbow, and some of my favorite text-based games typed in from various books.

For the true retro experience, you should, of course, access files from the command line, typing DIR to see the disk, interpreting the very abbreviated filenames, and then using RUN or LOADM to start the program. For the full retro experience, everything should be on cassette tape!

But your friends may enjoy the retro gaming experience without having any idea how to start up the games. You could, of course, put a coffee-stained sheet with helpful command-line hints next to the computer. Or, you could use this BASIC program, that leverages Darren Atkinson’s CoCo SDC floppy disk emulator to provide a simple interface to your favorite games (Zip file, 8.4 KB) saved on both the SDC’s flash slots and on .DSK disk files.

You can have as many screens as you want. The more screens, the longer it will take to load, and the more screens you (or your friends) will have to cycle through to see everything. I meant this as an easy means of showing off my favorite games; it is not meant as a comprehensive listing of everything. For a more complex file browser, see Guillaume Major’s SDC Explorer.

As written, MENU.BAS requires the SDC, but it should be able to be modified to use other solutions that store programs in ways that they can be accessed from a BASIC program.

The program attempts to respond to whatever the user might do to choose a game. If they pick up one of the joysticks, it will start following that joystick; if they use the up or down arrow keys, it will respond to them; SHIFT-up and SHIFT-down will move to the top and bottom, respectively. If they type the number corresponding to a game, the pointer will jump directly to that game.

Simple .ics iCalendar file creator—Wednesday, August 3rd, 2022
Calendar text file sample

The text that calmaker will convert to an ics file.

Our high school class was very small, and so our high school reunions are small affairs. There were, for example, all of three events this year: a meet-and-greet, a dinner, and a lunch memorial. Even with such a small calendar, people still find a calendar file useful. But it’s not worth it to maintain the events in a calendar app (or, worse, create a calendar app). It’s easier just to keep the events in a simple text file.

So I made a Perl script to convert a simple text file of events into an iCalendar .ics file (Zip file, 10.7 KB). All it needs is a text file like this:

  • ## Lost Castle of the Astronomers
  • July 15
  • 12:00 PM
  • 5 hours
  • **Table 2**
  • The mountains of West Highland are dotted with the ruins of lost scholarly orders. The Astronomers, in the Deep Forest south of the Leather Road, have been silent for a hundred years, unheard from since the goblin wars that so devastated Highland. Only vague references remain to taunt treasure hunters and spell seekers.
  • The Deep Forest is a dangerous place, home to many strange creatures. Only adventurers of stout heart and cunning can hope to penetrate the forest and return alive.

Very simple, and it’s obvious what this text means. In fact, if you open this in pretty much any modern text editor it will be formatted to highlight the important bits and to keep the separate events readable as separate events, because this is very simple Markdown text.

It’s also easy enough for a Perl script to convert to a .ics file.

The script is meant to take files created for human purposes, not computer purposes. Except for the title of the event, which must always come first (and always be preceded by two hash marks—that is, a Markdown level-2 headline), the order of information doesn’t matter. If the script doesn’t recognize a piece of information, it assumes that it’s part of the description. It completely ignores blank lines.

Use the script like this:

  • calmaker Gods\ \&\ Monsters\ MiniCon.txt > minicon.ics

You can, of course, leave off the > minicon.ics to see the calendar file output to your Terminal screen.

The above event will be transformed into this:

Let mortal tongues awake—Wednesday, June 29th, 2022

Samuel Francis Smith’s America is a staple patriotic song at religious gatherings around Independence Day and other patriotic holidays. It’s more commonly known as “My Country, ’Tis of Thee” because “America” appears only obliquely in the lyrics as “Thy name I love” in the second verse. It is short, otherwise direct, and a wonderful combination of looking forward to liberty and looking backward to what that liberty cost.

Smith wrote America in 1831, when some people could still remember the events of the revolution and some were beginning to recognize the likelihood of further bloodshed in the name of liberty. He lived past our Civil War, and wrote hymns to the freedom secured through that great sacrifice, too.

The four verses rise from the birth of liberty, through the physical country, to hope for the spread of liberty, and end on a plea to God as the author of liberty to preserve and protect our country as a free country.

The several verses added later going into more detail about the beauties of our land seem excessively inventorical. The original second verse handles our country’s physical beauty just fine. I see no need to belabor the point. This is a hymn, after all, but not only that, one of the beauties of the hymn is it’s simplicity. Making it really long kills part of what makes it a great and memorable hymn.

The lyrics in my 1925 Hymns of Praise Number Two are:

    • My country, ’tis of thee,
    • Sweet land of liberty,
    • Of thee I sing;
    • Land where my fathers died,
    • Land of the pilgrims’ pride,
    • From every mountain side
    • Let freedom ring!
    • My native country, thee,
    • Land of the noble free,
    • Thy name I love;
    • I love thy rocks and rills,
    • Thy woods and templed hills;
    • My heart with rapture thrills
    • Like that above.
    • Let music swell the breeze,
    • And ring from all the trees
    • Sweet freedom’s song;
    • Let mortal tongues awake;
    • Let all that breathe partake;
    • Let rocks their silence break,
    • The sound prolong.
    • Our fathers’ God to Thee,
    • Author of liberty,
    • To Thee we sing;
    • Long may our land be bright
    • With freedom’s holy light;
    • Protect us by Thy might,
    • Great God our King.
Print to any device—including screen—with no conditionals—Tuesday, June 28th, 2022

Like many old computers, the TRS-80 Color Computer assigned a device number to the screen that most people never used.

Allen Huffman has a great overview of device numbers on the TRS-80 Color Computer. It turns out you can print to the screen just like you print to a printer, to tape, or to disk. This can make for very simple code when you have something that might need to be displayed on a choice of devices.

Older posts