' Demonstration of using chr2.exe program with WSH ' Copyright 2004 Michael Newman ' This script is public domain. All rights waived. ' This script will print "Espanol es bueno." with a "n with tilde" ' in a Microsoft Word window with document "Document1" ' The idea is to have a way to usg extended characters in programs via WSH. ' Currently, this method is specific to Microsoft Word only. ' ----------------- ' Parameters: ' Path to chr2.exe Dim sChr2Path sChr2Path = "C:\workarea\temp\" ' Path a temp directory Dim sWindowsTemp sWindowsTemp = "c:\windows\temp\" ' ----------------- Dim Wsh, oExec Set Wsh = Wscript.CreateObject("Wscript.Shell") ' Create "n" with tilde Wsh.Run "c:\command.com /c " & sChr2Path & "chr2.exe 0241 > " & sWindowsTemp & "chr2out.txt" ' Activate Microsoft Word Wsh.AppActivate "Microsoft Word" Wscript.Sleep 1000 Wsh.SendKeys "Espa" ' Microsoft_Word-->Menu-->Insert-->File Wsh.SendKeys "%il" Wscript.Sleep 500 Wsh.SendKeys "c:\windows\temp\chr2out.txt{ENTER}" ' Use backspace once to remove unwanted line return Wscript.Sleep 500 Wsh.SendKeys "{BACKSPACE}" Wsh.SendKeys "ol es bueno." ' Remove temp file Wsh.Run "c:\command.com /c del " & sWindowsTemp & "chr2out.txt"