Back to the Future

2014-03-29_17-00-54Some of my 20-something Computer Science students at the community college where I teach see me as a living fossil because of the several decades age difference between us. Their perception is reinforced when I tell them I use decades-old tools like batch files. However, sometimes an oldie can still be a goodie. If you’re interested, read on.

I am an ENA (Evil Network Administrator) at a law firm. The firm’s accounting software stores client and matter information. The firm’s document management software needs the same information. Entering the same information twice would be double work, plus doubling the risk of data entry error. However, the accounting software did not provide for an export of its client and matter information into a format recognized by the document management software.  Complicating the task is that the two applications use very different database formats.

Text files usually are a common denominator. Accordingly, my plan was to export the client and matter information from the database of the accounting software into a CSV (comma separated values) file, and then import that information from the CSV file into the database of the document management software.

Over a decade ago, I wrote a simple program, in JavaScript, invoking Windows Script Host (WSH), which automated the plan of using a CSV for export/import. For years, it worked fine just by double-clicking it, or running the JavaScript file in Task Scheduler.

Time passed, and the now older Windows 7 32 bit computer was replaced by a new Windows 8 64 bit computer. The new computer took on the chore of running the JavaScript program.

With this transition, the JavaScript program stopped working. The error message was: ”Data source name not found and no default driver specified." Puzzling, since the necessary drivers were on the computer, and the data source had not changed. 

Mr. Google supplied the clue. Since my OS now was 64 bit, by default I was using the 64 bit version of WSH. However, given the venerable database drivers invoked by my over 10 year old JavaScript program, I needed to use the 32 bit version of WSH.

I could modify the code of my JavaScript file to force use of 32 bit WSH. I later did, but that’s another story. In the meantime, I just wrote a batch file (we’ll assume the JavaScript file is called godzilla.js).

start %WINDIR%\SysWOW64\wscript.exe godzilla.js //NoLogo

The second line is the key. It affirmatively runs the JavaScript file using 32 bit WSH. I’m not sure the first or third lines are necessary, but I’m not going to lose sleep over it, as at worst they’re surplusage. The batch file works fine just by double-clicking it, or running the batch file in Task Scheduler.

Next … modifying the code of the JavaScript file to force the running of WSH.

0 Response to “Back to the Future”

Comments are currently closed.