Copy txt to lpt1 using shell

In order to print labels i’ve created a report wich first creates a txt file. After creating the file i use the shell command to copy this file to lpt1: SHELL(‘COMMAND.COM’,’/C’,STRSUBSTNO(‘copy %1 LPT1:’,strFileName)); This works fine on a PC’s installed with Windows XP or Windows 2K . But on PC’s installed with Windows 98 it doesn’t work. When i open the DOS window by hand and type the copy-command it works fine on W98 PC’s. It seems that on these machines Navision doesn’t recognize lpt1. Does anyone know how to fix this. Best regards Marcel

Hi, we faced the same problem. What we have done is to call/execute a dos-batch file: SHELL(‘command.com /c c:\mrd12.bat’); // mrd12.bat for serial printing And in the batch we copy the created file to the serial device. This is working in XP/2000 and WIN98 environments Regards Walter

There is a way because Lanham’s e-ship does it. I don’t want to post the code…I don’t know the legal ramifications - sorry. I do know they use a shell command.

I tried the solution with the bat file. But even that is not working… [V]

quote:


Originally posted by Idefix
I tried the solution with the bat file. But even that is not working…


Marcel, are you sure you called the shell like this: SHELL(‘command.com /c c:\mrd12.bat’); {the “shell-command” has to be between the ‘’} I just tried it on a Win98 machine and it is workung. If you still use your call SHELL(‘COMMAND.COM’,‘/C’,‘BatchCallHere’); you might face the same problem because you still call the command processor with an argument. Good luck.

Marcel We are printing lots of lables. We have shared the lable printers on the network and then I print directly to the shared printer as if it is a file. I have developed a CodeUnit for Lable Printing and it works just fine. Code: PrintLable(TextLine : ARRAY [9] OF Text[80];PrinterSelect : Integer;StrNo : Code[10]) SetPrinter; FilePath := ENVIRON(‘TEMP’); StChar := 2; LableLine[1] := FORMAT(StChar) + ‘L’; LableLine[2] := ‘D11’; LableLine[12] := ‘E’; FOR I := 3 TO 11 DO LableLine[I] := DELCHR(TextLine[I - 2],’<>’); COMPRESSARRAY(LableLine); LableFileName := PrinterName[PrinterSelect]; LableFile.TEXTMODE(TRUE); LableFile.WRITEMODE(TRUE); LableFile.OPEN(LableFileName); FOR I := 1 TO 12 DO IF LableLine[I] <> ‘’ THEN LableFile.WRITE(LableLine[I]); LableFile.CLOSE;

quote:


In order to print labels i’ve created a report wich first creates a txt file. After creating the file i use the shell command to copy this file to lpt1: SHELL(‘COMMAND.COM’,‘/C’,STRSUBSTNO(‘copy %1 LPT1:’,strFileName));


Now that you have this file can you not just use the Shell command for “PRINT” ? SHELL(‘PRINT’,‘strFileName’); When I tried this it printed the “strFileName” to the LPT1