Home Page

 


EARLIER FEATURES

 


FEATURES CONTENTS

 


LATER FEATURES

 

Features Contents


16th May 2004

ESPERANTO AND PLUGGING THE GAPS IN WINDOWS SCRIPTING HOST

Brian Grainger
and
Michael Newman

email.gif (183 bytes)
brian@grainger1.freeserve.co.uk


 

I mentioned recently, in an update to my article on Windows Scripting Host (WSH), that the present version of WSH is incapable of mimicking the numeric keys on the numeric keypad. This led to a problem when trying to generate specific symbols, for example those needed to write Esperanto. This article introduces a part way solution to this problem.

While your webmaster is writing the text behind this feature, I am indebted to Michael Newman, who works as a Chemical Engineer in the TRC Environmental Corporation of Windsor, (Connecticut USA I think). Michael has done the programming behind the feature introduced.

I was first made aware of the problem by Jonathan Cooley, when the WSH article was first published. He told me that if a way could be found to easily generate the few special symbols needed to write Esperanto I would have a big posse of fans! Although I was not able to provide a solution at the time, it is registered in my databank of problems to solve! Consequently, when Michael e-mailed me in April to say thanks for the WSH article and tell me about the Winkey program, I mentioned the problem to him. We have e-mailed each other a few times and a few ideas have been thrown up as a result.

Mike first told me about a clever little trick that can be used in Microsoft Word. It only works in Word 2000 (and above?) and requires Windows 2000 or later as well.

If you type the character code for the character you want, e.g. 0230, and then type ALT-x, (ALT and x together), Word magically changes the character code into the correct Unicode character. I think one of the reasons this only works in the later versions of Word and Windows is that the correct font has to be available. It has to be a Unicode font and in later versions of Word and Windows there exists such a font that contains just about any character imaginable. One day I might write about it, but since I don't have it on my home machine it is a bit difficult to investigate!

To determine the character code of the character select Insert - Symbol from the menus of Word. Highlight the character and the status bar at the bottom of the Word window will give you the character code. Also, Word sometimes has a shortcut key sequence for the character and this will be shown in the Insert - Symbol dialog box. For example, character 0230 has the shortcut Ctrl-& followed by 'a'. You could use WSH to send this shortcut but the result will only work in Word.

When Michael first told me about the Unicode trick I could not get it to work, because I had the wrong versions of software on my home and work computer. I then did a Google search to try and find out some more and, in passing, came across the following useful links:

http://www4.vc-net.ne.jp/~klivo/sim/simeng.htm
This is a link to a tool called Simredo. This is a Java Unicode editor that supports Esperanto. It will require the Java Runtime Engine to be present on your PC.

http://www.multiline.com.au/~johnm/elwa/keyboard.htm
Extremely useful page about keying Esperanto and other characters in certain programs.

Michael also mentioned that he had spent a couple of days trying to learn about the win32 API. It appeared there was a way to send numpad keystrokes that way. He regretted that it didn't seem possible to call the win32 API from WSH directly, although it could be done in VB and VBA.

It was not long after, that Michael contacted me again. He had created a console program, (chr2.exe), that would print out to a file whatever character you wanted, based on the number value of the numpad key combination. Along with the program he provided a script as an example of its use with Word. The problem is that the program as it stands only works at the command line. The next step is to get something similar that works in a window and then hook it up to WSH, but that problem remains to be solved.

Michael has released his program, which is written in C, under the GPL so I include the zip file here. It includes the program, the source, a copy of the GPL and Michael's original example script, which works on later versions of Windows.

chr2_1.0.0_win32_GPL.zip

Here you will find a version of the script that works on Windows 98. The file for the command line program is different on these two Windows versions.

espanolbg.vbs

Both scripts create a couple of parameter specific to where we have temporary files and the command line program on our machines. These may need to change for individual users.

An earlier article in this series can be found here:
Keyboard Macros with Windows Scripting Host

A later article in this series can be found here:
Esperanto and Other Characters - The Complete Solution


 

 

 

 


TOP