Why I wrote this script set
These last days, I was writing a paper in English. It was the first time I wrote a paper of this length (20-30 pages...) in English, and I could experience myself how the DDB (Charles Muller's Online Digital Dictionary of Buddhism) is useful and indispensable for quickly looking up Buddhist terms.
The new "search page" (http://www.acmuller.net/ddb/search-ddb3.html) in this site is a very advanced search tool, using Unicode data. These is a good page describing the tips for the search (http://www.acmuller.net/ddb/ddb-search-help.html).
Unfortunately, for Mac users like me, it is not easy to search terms in this dictionary, because there is, as far as I know, no input method able to output Unicode data for the MacOS (perhaps with the newer OS, it is possible, but I don't know...).
By the way, although the pages of DDB are written in Unicode, Netscape Communicator 4.7 or Internet Explorer 4.5 can display almost all the text, if your system has JLK, CLK and KLK; the long vowels can be displayed (although the shape of the glyphs is very ugly!) -- the only characters that cannot be displayed are the diacritical characters such as "s" with acute accent, "r" with a dot below, etc. (I use OS 7.6.1J).
This is why, I tried to make a scripting system that enables me to quickly looking up a term.
How it works
This system consists of the following steps:
- I type the term to search in my Word-processor (Nisus Writer in my case) in Shift-JIS encoding;
- my looking up system grabs this term, converts it to Big5 with the conversion table made by Kitahara-san for his utility Kctrans (it converts simplified kanji to the appropriate Big5 characters);
- it converts the Big5 string to Unicode;
- it converts it to a hexadecimal string;
- it generates the needed URL for the search, launches the web browser, and opens that URL.
The generated URL is, for example:
http://www.acmuller.net/cgi-bin/xpr-ddb.pl?89.xml+id('b89c0-4e16-97f3')
for "Kanzeon" in the simplified form of Shift-JIS characters.
The version released here; and requirements
The system that I release here uses the editor named Style as "interface" application (it has a better integration with AppleScript than Nisus Writer); it uses AppleScript and MacJPerl as scripting systems, and TEC OSAX and the table of convertion from Shift-JIS to Big5 that comes with MacKctrans made by Kitahara-san.I use AppleScript
-to grab the term to search in Style,And I use MacJPerl
-to pass it to MacJPerl for the conversion to Big5,
-to convert the result to Unicode using TEC OSAX,
-to pass the result to MacJPerl for conversion to hexadecimal string, and generating the needed URL,
-to open the URL with Netscape.-to convert the term to search in Shift-JIS to Big5 using Kitahara-san's conversion table (named "JIS2BIG.TBL"),
-to generate the needed URL.
So, you will have to download (if you don't have them):
and
- my script set (58K to download) (folder named "MullerDicLookUp Folder")
This folder contains:
- generateDDB_URL.pl MacJPerl script (text)
- sjis2Big5Kctrans.pl MacJPerl script (text)
- MullerDicLookUp AppleScript script (application)
- JIS2BIG.TBL Conversion table from JIS to Big5 made by KITAHARA Motohiko-san (Copyright (c) KITAHARA Motohiko, 99-06-27), who kindly allowed me to include it in this package. If you want to download the conversion program between Chinese (Traditional Chinese and Simplified Chinese) and Japanese written by Kitahara-san, Mac Kctrans, the URL is: http://www2u.biglobe.ne.jp/~kitabo/. (text)
- ReadMe.html Same text as this HTML (text)
How to install
- Put TEC OSAX in the Scripting Additions Folder, inside the System Folder (or, for Systems earlier than OS 8.5, in the Scripting Additions Folder, which is inside the Extensions Folder, inside the System Folder).
- Put Style folder wherever you want.
- Put the AppleScript script "MullerDicLookUp" in the folder named "Style Scripts" inside the Style folder.
- Put the folder "MullerDicLookUp Folder" wherever you want.
- Open the AppleScript script "MullerDicLookUp" (that you have put inside the Style Scripts folder) with Script Editor (which you should find in your AppleScript folder...)
- locate the lines:
-- Change in the next line the path for "sjis2Big5Kctrans.pl"!! set scriptPath to "Macintosh HD:Desktop Folder:Perl scripts:SJIS2Big5:sjis2Big5Kctrans.pl"-- requires MacKctrans' "JIS2BIG.TBL"
and change the path name in red characters to the path name of the file "sjis2Big5Kctrans.pl" in your hard disk;
- locate the lines:
-- Change in the next line the path for "generateDDB_URL.pl"!!
set thescript to {"Macintosh HD:Desktop Folder:Perl scripts:SJIS2Big5:generateDDB_URL.pl", res}and change the path name in red characters to the path name of the file "generateDDB_URL.pl" in your hard disk;
- If your system is later than OS 8.5 (?), locate the lines:
--If the system is ealier than OS 8.5 (?), and if you use another web browser than Netscape, please change the name --of the application below. BUT...
--If the system is newer than OS 8.5 (?), you can use the command --open location theURL --instead of the four next lines!
tell application "Netscape Communicator (tm)" activate OpenURL theURL end tell
and change the four lines in red characters to:
open location theURL
- If the system is ealier than OS 8.5 (?), and if you use another web browser than Netscape, locate the line:
tell application " Netscape Communicator (tm)"
and change the application name in red characters to the application name of your browser (for example "Internet Explorer 4.5", etc.).
- If you write your search word in Big5, then you will have to not convert your word in Big5; in that case, locate all the following lines:
-- Change in the next line the path for "sjis2Big5Kctrans.pl"!! set scriptPath to "Macintosh HD:Desktop Folder:Perl scripts:SJIS2Big5:sjis2Big5Kctrans.pl" -- requires MacKctrans' "JIS2BIG.TBL"
set thescript to readScript(scriptPath)
if thescript does not end with ("__END__" & return) then set thescript to thescript & ("__END__" & return) end if
set thescript to thescript & theText
set res to ""
tell application "MacJPerl" try Do Script thescript mode Batch set res to result on error errorMsg display dialog errorMsg return end try end tell
delete all these lines, and write instead the following line:
set res to theText
- Save the changed script.
The installation is complete.
How to use it...
- launch your Style
- launch your MacJPerl (this can be omitted)
- launch your web browser (this can be omitted)
- make Internet connection (this can be omitted)
- type in your Style document the word to search in Japanese (you may write it in Big5 as well if you have changed the AppleScript script as I indicated above...)
- select that word, and choose the menu item "MullerDicLookUp" in the Scripts menu, in Style.
- after a while, the browser will be brought at the front, and the dictionary entry will be displayed (if that entry exists...). -- Sometimes, the browser complains that the page has no content; in such cases, please try to re-load the page.
I would be grateful if you could write me your comments, bug reports or suggestions for these scripts.
Thank you in advance!
Go to Research tools Home Page
Go to NI Home Page
Mail to Nobumi Iyanaga
This page was last built with Frontier on a Macintosh on Sun, Oct 14, 2001 at 13:33:57. Thanks for checking it out! Nobumi Iyanaga