Quick and Dirty, Part Two
(Read Part One.)
The beauty of a quick and dirty solution is its simplicity. I'll admit it isn't always preferable--many times it amounts to a hack--but if it works, it works. Data mining problems don't necessarily need cumbersome, complex or paperwork solutions. And that's where DOS comes in.
DOS (rhymes with "toss") stands for Disk Operating System, originally a series of I/O (input/output) routines that allowed a user to communicate with the computer. It is a non-graphical, command-line interface instead of the GUI (pronounced "gooey"), or Graphical User Interface, of Windows.
On the Windows Start Menu is a program called "Command Prompt" that brings up a window of white text on a black background with the cursor blinking to the right of something like C:\Document and Settings\User> (the so-called "C:> prompt"). Type dir and press Enter, and you'll get a list of files. That's DOS.
Here's the good part. A batch file "batches" DOS commands to run automatically. I'm often amazed at their power, given the bloatware available.
Here is a simple example:
@ECHO OFF
ECHO Hello World!
PAUSE
Type or cut and paste the above into Notepad and save as HELLO.BAT. (You'll need to change Save As Type to "All Files" and add the .BAT extension.) To run this batch file, open the folder where it is saved and double-click its icon. A window pops up that says this:
Hello World!
Press any key to continue...
Back to our problem: how to collect quality data real time. Batch files can display a message as in our trivial example. But they can also ask for input, change it and write it to a file with just a few lines of code. Next, I'll show how.