I yearn for the old days of HyperCard, which I started learning back in the glory days of the late 1980s. I’m trying to learn how to use the monster currently maintained by Apple that is AppleScript Studio. It is the flawed scripting language AppleScript, which has some similarities with the scripting language of HyperCard, in the programming environment of XCode. It feels like a marriage between a Nuclear Power-plant and a water wheel that’s missing some of its blades.
I am, however, going through one of my 3-month programming cravings, so I have decided to play with AppleScript Studio and see if I can make an upgrade for one of my favorite old applications (more on that if I ever make any progress). I made a little weblog to chronicle my efforts and leave some tips behind for other beginners who might happen upon it later:
Fool’s Applescript Workshop
I’m happy to announce the results of a few hours of tinkering: The Pinyin Tone Widget. This OS X dashboard widget will take a series of Chinese pinyin words with tone numbers appended at the end of each syllable and will add the tone marks where appropriate (e.g. zhong1guo2 becomes zhōngguó).
Many years ago, before Unicode became dominant, I used a Microsoft Word macro written by a Chinese language scholar, James Dew, as the basis for making an old Mac OS 9 application that translated texts between various pinyin fonts that were floating around online. Later, I made an online script that could convert tone numbers into unicode tone marks. I was surprised to hear from various Chinese language instructors at a conference I presented at a few years later (2003) that many of them used the script regularly when preparing texts for their Chinese language classes.
The online script still works but there is a much more elegantly written online script which does the same thing written by a more skilled programmer in Taiwan named Mark Wilbur hosted on his site Doubting to Shuō. You can find his tool here: Pinyin Tone Tool.
My old PHP script is ugly by comparison to Mark’s compact javascript so I have essentially installed his script to work in an OS X dashboard widget. You can download the widget here:
Pinyin Tone Widget v. 1.02
(more…)