ashtml - Another tool to convert AppleScript source code to HTML

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 :smiley:

Awesome awesome awesome! Really nice share! Thanks :slight_smile:

Very nice Martin, thanks a lot. I’ll use this.

Note: I have made a few modifications to your code. The mods are as follows:

  1. added a checking routine to check for a help flag (i.e. -h) such that a the basic usage of the tool is written to stdOut
  2. added support for “scptd” files. Previously they were seen as directories and thus would not process.

You can see the modded code here and also download a compiled version of ashtml version 0.2.
http://www.hamsoftengineering.com/codeSharing/ashtml/ashtml.html

Hi regulus6633,

Thanks so much for your efforts to make this tool even better and more useful! I also thought about supporting scptd files, but as you know yourself: So much to do, so little time :smiley:

Once again: Thanks!

P.S.: And keep up the excellent work on your apps. ScriptLight is amazing!