Executing Foreign Code (OpenInsight 16-Bit Specific)
At 29 JUL 2002 09:26:09PM Marty Rosenbloom wrote:
Hi,
I have a Monarch/Paxar thermal printer. Code is written for this printer and saved in a .txt file using notepad. To execute the code, I have to switch to DOS mode and at a C:] prompt type in
"Copy C:\\Filename.Txt LPT2"
so that it will print on LPT2 and the thermal printer.
How do I accomplish this while in a "Click" event in OI?
Using OI v2.6.
TIA,
Marty
At 29 JUL 2002 10:23PM Richard Hunt wrote:
Marty, try this…
DECLARE FUNCTION UTILITY
SENTENCE=COMMAND.COM /C COPY C:\\FILENAME.TXT LPT2:'
RESULT=UTILITY('RUNWIN',SENTENCE)
1) You must use "COMMAND.COM /C" before the "COPY" command.
2) If you want to copy to the LPT2 port then you must append a colon (like this LPT2:).
It should work fine for ya.
At 30 JUL 2002 03:14AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Marty,
Also consider using a /B option in your copy statement. Otherwise any char(26) in the character stream will truncate the file output.
World Leaders in all things RevSoft
At 30 JUL 2002 10:30AM Tony Splaver wrote:
Hi Marty,
I have two other options that you may want to explore to execute this program, in addition to the build-in (using the Utility() function) abilities of OI:
1. Use the WinAPI WinExec() to execute the command, but hide the command window – otherwise you will see the command screen appear for a second.
Declare Function WinExec ;* this should already be declared
* NOTE: This will execute and hide the command window,
* and run the command asynchronously, and don't forget
* to check the return value (success ] 31, failure \Filename.Txt LPT2", 0)
2. If you want to avoid creating the text file and copying it to LPT2, or if the printer happens to be connected to a network or a USB port, then you might try using Direct Print. This is a third party utility that I created for sending "data" directly to the printer, and it is very similar to the "good old" AREV PRINT commands. It allows you to send plain text and escape codes directly to the printer (bypassing the printer drivers), and it works with any type of printer on any type of port (LPT, USB, or network). You can contact me at [email protected] if you want to explore this option too.
Good luck!
Tony
At 03 AUG 2002 08:28PM Donald Bakke wrote:
Marty,
I highly recommend that you checkout Tony's Direct Print product. We've successfully used it to replicate some of our most sophisticated AREV printer-specific code. We are now in the process of testing it for controlling POS registers and cash drawers.