In order to document my work projects in the internal Wiki of my current employer I recently needed a tool to quickly convert the source code of AppleScript files to HTML documents.
Finally I came up with a small foundation tool written in Obj-C, which combines NSAppleScript’s richTextSource method with the built-in textutil command line utility.
It works like a charm, I use it all day and so I decided to share it. Maybe someone else can make good use of it.
The foundation tool - named ashtml - requires at least Mac OS X 10.4 and runs on both Intel and PowerPC based Macs. If you do not specify an output path for the HTML document, it will save it in the same directory as the original AppleScript file.
Usage on the command line is as follows, the output argument is optional (as explained above):
ashtml -input /path/to/applescript/file -output /path/to/html/file
You can download it right here:
ashtml - Convert AppleScript source code to an HTML document (v0.1, ca. 46.4 KB)
The download above also contains a convenient AppleScript droplet, which converts the source code of dropped AppleScript files to HTML documents using the ashtml command line utility.
Here is a sample HTML document showing the source code of the above mentioned droplet.
Please note that ashtml compiles the given AppleScript files, so it might open programs addressed by the AppleScripts.
If you are interested in the most simple source code of ashtml, I kindly invite you to study it.
Happy Scripting