Complex question: sending escape codes to printer from VMWare Virtual Machine
Posted on 2009-05-13
I am trying to set up a new Virtual Machine (Windows XP Home guest on OS X host) that can support a legacy DOS application that I use to print to a USB printer attached to the host.
The DOS application requires some printer control codes to be sent to the printer prior to running. It is kind of a kludge to print from DOS to a USB printer. In the previous real Windows environment, the way this was accomplished was by having the following three lines lines in a batch file (where the names in the second and third lines are changed for simplicity):
net use lpt1: \\network_printer_name /persistent:yes
I was able to successfully duplicate this function in a virtual machine. However, I am having trouble duplicating it in a newly created instance of the virtual machine. Instead of sending the codes, the characters in the codes are getting printed. I think this is because of differences in the way the VMs are set up.
The two obvious differences in the VMs, which may or may not be related are as follows:
1. The older VM that work is using XP Pro; the new one that does not is XP Home.
2. In the older XP Pro VM, the printer is set to print to the USB port. In the newer XP Home VM, no USB port appears available. I am not sure why it is not available. I have tried various permutations of configuration in the though that if I could get the USB port to be present, and set the printer to use it, then it would work.
There are several approaches to this problem:
1. Solve the problem by getting the same method to work. Namely, print to lpt1 via the net use command, and use a program or command to send the proper control codes. Perhaps this involves getting the USB port working, although since I cannot get that far, that may not even be the root cause of the issue. However, it is possibly a step in the right direction and worth points for solving this sub-issue.
2. Come up with a different way to send the control codes.
3. More drastic measures involving modifications to the DOS program to send the codes directly. Since this program dates from around 1988, I really don't want to go there if I don't have to. The reason I used the external DOS utility back in 1988 was because I could not get those control codes to work properly.
However, it would be an elegant solution to send the codes from within the DOS program. Just in case this avenue is fruitful, here is the current codes that the DOS program is supposed to be sending to the printer:
To set 88 lines per page: <27>&l88f<27>(s14H
To reset to 66 lines per page: <27>&l66f<27>(s10H
For clarification, the character to the right of the ampersand is a lower case "L".