Get User Input and Print to any Networked Printer From the Windows CLI and Visual Basicget user input and print to any networked printer from the Windows command line and using built-in utilities and Visual Basic. (Yes, I keep calling it "Virtual Basic". I know.)
Here's why I wrote it: There's a specific situation where we have to have to notify another station halfway across the facility that a customer is ready. We have been using phone notifications, but it simply becomes prohibitive when you're on hold for five to ten minutes in order to reach the other (very very busy) station simply to say "Hey, here's a job for you."
They already use printouts as part of their workflow, so we just needed a way to input customer data and have it print on a printer across the network. It also needed to tell us that it'd done so (or if it had failed). Obviously, I've stripped out information that identifies my facility from the code.
While this is a pretty specialized need, I ended up finding answers to questions that a lot of people apparently had.
- Creating the equivalent of a radio button (sort of) from InputBox
- Comparing strings in VBS
- Printing to the non-default printer (including networked printers) from CLI
- Creating multi-line output in a MsgBox
- Handling case and multi-step if/then loops in VBS
- Testing for empty strings in VBS
- Testing for numeric input in VBS
- Reading and writing from text files in VBS
- Get a return status from a called system process
- Execute different actions based on the return status
- Getting human-readable system time from VBS