MLTE Demo is a very simple text editor based on MLTE, the text engine from Apple (also known as Textension) that made its debut in Mac OS 9. MLTE is Unicode-savvy from the ground up because it's based on ATSUI. Version 1.0a3 adds support for reading styled Unicode files containing WASTE 2.0 formatting information. Full source code included and freely reusable in other projects. Version 1.0a4 was updated for CodeWarrior Pro 7 and Universal Headers 3.4, and fixes a compatibility problem with CarbonLib 1.5.

AppleScript Formatting

This is a scripting addition (aka "osax") that allows you to get and set the styles used by AppleScript to format its own source code. These are the same styles that can be changed using the "AppleScript Formatting..." menu item in the Script Editor.

Unicode OSAX

Another simple scripting addition, modeled after the standard "ASCII character" and "ASCII number" additions, but with "Unicode" instead of "ASCII". The Unicode osax allows you to get the Unicode numeric value of any character and back, subject to the restrictions explained in the enclosed documentation. I use this osax internally in scripts that massage the character entities often found in XML and HTML files.

This osax is distributed as freeware. Full C++ source code included in the archive.


AEInfo is a so-called dcmd, or debugger command, i.e., an extension module for MacsBug, the low-level debugger that every mac programmer knows and loves. AEInfo lists various Apple Event Manager data structures, including the Apple event handler table, the coercion handler table and the object accessor table for the current process or for the entire system.

Style XTND Translator

Style XTND Translator is a plug-in that allows XTND-savvy applications like ClarisWorks or Nisus to read documents created by Style. This translator can read documents created by all versions of Style from 1.1b3 to 1.7b1. Writing Style documents, on the other hand, is not supported. Full C++ source code included and freely reusable in other projects.

Directory Popup

This snippet shows how to display a navigation pop-up menu just like the one displayed by the Finder when you command-click a window title.

A navigation pop-up menu

Directory Popup includes just two calls:

  MenuHandle BuildDirectoryMenu ( const FSSpec * inFileSpec ) ;

  Boolean TrackDirectoryPopup ( FSSpec * ioFileSpec, WindowPtr inWindow, Point inHitPt ) ;

BuildDirectoryMenu takes a file system specification referring to some document and creates a new menu ready to be displayed in a window title bar or somewhere else. The first item in the menu corresponds to the document itself; additional items refer to the enclosing folders and/or disk. Each menu item has a small icon associated with it, just like the Finder. If the menu cannot be created for some reason, BuildDirectoryPopup returns nil.

Call TrackDirectoryPopup when you detect a command-click in the title bar of the frontmost window. Pass in the window reference, the specification of the file associated with the window and the hit point (in global coordinates): TrackDirectoryPopup will check to see if the title area was clicked, create a directory menu, display the menu and do all the necessary mouse tracking. If a selection is made, TrackDirectoryPopup will return true and set ioFileSpec to the specification of the selected folder.

Joakim Brown wrote a PowerPlant version of this code, which is available from his web site.


In many text editors and word processors, triple clicking selects a whole line, and triple clicking and dragging selects a range of lines. Unfortunately, this handy shortcut isn't recognized by TextEdit, the simple text engine built in the Macintosh ROMs. As a result, in many TextEdit-using applications triple clicks don't work the way you'd expect. TE3Click is a tiny extension that patches TextEdit so it handles triple clicks by selecting whole lines.

SimpleText Pro

"SimpleText Pro" is the code name of an aborted project by Marco Piovanelli and Alessandro Levi Montalcini aimed at delivering a WASTE-based version of SimpleText with some added features borrowed from Alessandro's popular SimpleText Color Menu patch. After almost a full year of inactivity, it became obvious that this project was going nowhere, so we decided to release the half-baked source code to the public, just in case someone is interested. We are no longer interested in any further development.

IMPORTANT NOTICE: Apple wants us to make it very clear that the source code in SimpleText Pro, although derived from Apple Sample Code (and precisely from SC.025 aka SimpleText 1.4d16), has been modified and may no longer be redistributed as "DSC Sample Code".

Language Mapping Tables

These are some simple tables and functions I use in the RTF I/O module of WASTE to convert between two ways of representing human languages: Windows LANGID's (used in RTF files) and Macintosh locale strings, which are essentially based on ISO-639 language codes and ISO-3166 country codes.