Hello,
I had the occasion to need to send control codes to a printer/cash drawer from within A5. I wrote a small exe that accepts command line paramaters that can be called with sys_shell(). I thought this might be of use to some of you out there. I named the file SendStr.exe. It accepts numerical parameter on the command line. By entering SendStr on the command line by itself the program will print to screen a short list of instructions.
The first parameter must be a number between 1 & 4 inclusive. 1 represents lpt1, 2 represents lpt2, 3 represents com1 and 4 represents com2. Each parameter after that must be the decimal representation of the ascii character you wish to send to the device, usually a printer. For instance, to send the string 'JIM' to a printer on lpt1, followed by a form feed:
sendstr 1 74 73 77 12
1 denotes output to lpt1, 74, 73, 77 are the decimal codes for J,I,M respectively, and 12 is the ascii code for a form feed.
Each parameter needs only to be seperated by a space. From within A5, assuming the sendstr.exe is in the root directory of the c: drive, the following should work:
sys_shell("c:sendstr.exe 1 74 73 77 12", 2)
This should make it easy to send control characters to printers from within A5. Feel free to use this as you wish, but as a word of caution, this is just written and untested. I didn't do any bounds checking except for the first parameter, and I haven't checked it with anything except a printer on lpt1.
Hope it helps,
Jim Chapman
I had the occasion to need to send control codes to a printer/cash drawer from within A5. I wrote a small exe that accepts command line paramaters that can be called with sys_shell(). I thought this might be of use to some of you out there. I named the file SendStr.exe. It accepts numerical parameter on the command line. By entering SendStr on the command line by itself the program will print to screen a short list of instructions.
The first parameter must be a number between 1 & 4 inclusive. 1 represents lpt1, 2 represents lpt2, 3 represents com1 and 4 represents com2. Each parameter after that must be the decimal representation of the ascii character you wish to send to the device, usually a printer. For instance, to send the string 'JIM' to a printer on lpt1, followed by a form feed:
sendstr 1 74 73 77 12
1 denotes output to lpt1, 74, 73, 77 are the decimal codes for J,I,M respectively, and 12 is the ascii code for a form feed.
Each parameter needs only to be seperated by a space. From within A5, assuming the sendstr.exe is in the root directory of the c: drive, the following should work:
sys_shell("c:sendstr.exe 1 74 73 77 12", 2)
This should make it easy to send control characters to printers from within A5. Feel free to use this as you wish, but as a word of caution, this is just written and untested. I didn't do any bounds checking except for the first parameter, and I haven't checked it with anything except a printer on lpt1.
Hope it helps,
Jim Chapman
Comment