Announcement

Collapse
No announcement yet.

Program will not Print

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Program will not Print

    Why won't this program print when compiled under pb3.5 for DOS
    on a Windows98 machine?????
    I had this running 3 years ago and now it refuses to do so after being on
    a an XP Machine.
    Any help would be greatly appreceiated......I have many other programs in the
    same shape......

    Code:
    	$compile exe
            coo$ = command$
            CO$ = mid$(coo$,1,2)
            open "TEMPSALE" for input as #1
            open "LPT1" for output as #2
            do while not eof(1)
    	line input #1, dtx$
            inv$ = mid$(dtx$,5,6)    ' 5-10
            dat$ = mid$(dtx$,11,10)  ' 11-20
            coco$ = mid$(dtx$,21,2)   ' 21-22
            book$ = mid$(dtx$,23,50)  ' 23-72
            page$ = mid$(dtx$,73,3)   ' 73-75
            qty = val(mid$(dtx$,76,5))   ' 76-80
            card$ = mid$(dtx$,81,20)  ' 81-100
            vers$ = mid$(dtx$,101,5)  ' 101-105
            sale = val(mid$(dtx$,106,8))  ' 106-113
            dspc = val(mid$(dtx$,114,2))  ' 114-115
            dsam = val(mid$(dtx$,116,7))  ' 116-122
            tax = val(mid$(dtx$,123,7))  ' 123-129
            fgt = val(mid$(dtx$,130,7))  ' 130-136
            adl = val(mid$(dtx$,137,7))  ' 137-143
            epg = val(mid$(dtx$,144,7))  ' 144-150
            incr a
            if a = 1 then
             if CO$ = "BC" then
              gosub bcaddr
               end if
    	 if CO$ = "MA" then
              gosub maaddr
               end if
             if CO$ = "RG" then
              gosub rgaddr
               end if
             if CO$ = "RI" then
              gosub riaddr
               end if
             if CO$ = "NU" then
              gosub nuaddr
               end if
            end if
            if coco$ = CO$ then
            tsale = tsale + sale
            tfgt = tfgt + fgt
            pc50 = sale * .50
            tot = pc50 + fgt
            totrm = totrm + tot
             print #2, tab(3);dat$;tab(20);inv$;tab(40);using$("##,###.##",sale);_
                       tab(51);using$("##,###.##",pc50);tab(61);using$("##,###.##",fgt);_
                       tab(71);using$("##,###.##",tot)
            end if
            loop
             print #2,
             print #2,
             print #2, tab(3);"Total Remittance";tab(22);using$("##,###.##",totrm)
            end
    bcaddr:
    	print #2, "TO: BIRCHCRAFT STUDIOS"
            PRINT #2, "    P.O.BOX 328"
            PRINT #2, "    ROCKLAND, MA 02370"
            PRINT #2,
            PRINT #2, "                            FROM: LLOYD'S QUALITY CARDS"
            PRINT #2, "                                  1356 N. 21ST STREET
            PRINT #2, "                                  ALLENTOWN, PA 18104-2502"
            PRINT #2,
            print #2,
            print #2,
            print #2,
            gosub header
    RETURN
    maaddr:
    	print #2, "TO: MASTERPIECE STUDIOS"
            PRINT #2, "    957 N. MERIDIAN STREET"
            PRINT #2, "    SUNMAN, INDIANA 47041-7586"
            PRINT #2,
            PRINT #2, "                            FROM: LLOYD'S QUALITY CARDS"
            PRINT #2, "                                  1356 N. 21ST STREET
            PRINT #2, "                                  ALLENTOWN, PA 18104-2502"
            PRINT #2,
            print #2,
            print #2,
            print #2,
            gosub header
    return
    rgaddr:
    	print #2, "TO: REGENCY GREETINGS"
            PRINT #2, "    731 CLATON AVENUE"
            PRINT #2, "    WAYNESBORO, PA 17268-0990"
            PRINT #2,
            PRINT #2, "                            FROM: LLOYD'S QUALITY CARDS"
            PRINT #2, "                                  1356 N. 21ST STREET
            PRINT #2, "                                  ALLENTOWN, PA 18104-2502"
            PRINT #2,
            print #2,
            print #2,
            print #2,
            gosub header
    return
    riaddr:
    	print #2, "TO: ROYAL IMPRINTS    "
            PRINT #2, "    711 GERBER STREET"
            PRINT #2, "    P.O.BOX 208"
            PRINT #2, "    LIGONIER, IN 46767-0208"
            PRINT #2,
            PRINT #2, "                            FROM: LLOYD'S QUALITY CARDS"
            PRINT #2, "                                  1356 N. 21ST STREET
            PRINT #2, "                                  ALLENTOWN, PA 18104-2502"
            PRINT #2,
            print #2,
            print #2,
            print #2,
            gosub header
    return
    nuaddr:
    	print #2, "TO: NuArt , INC."
            PRINT #2, "    6247 W. 74TH STREET"
            PRINT #2, "    BEDFORD PARK, IL 60499"
            PRINT #2,
            PRINT #2, "                            FROM: LLOYD'S QUALITY CARDS"
            PRINT #2, "                                  1356 N. 21ST STREET
            PRINT #2, "                                  ALLENTOWN, PA 18104-2502"
            PRINT #2,
            print #2,
            print #2,
            print #2,
            gosub header
    return
    header:
            print #2, "                        R E M I T T A N C E   A D V I C E"
            PRINT #2, "                        ---------------------------------
            PRINT #2,
    	Print #2, "     DATE      DEALER P.O.NO.        TOTAL CHARGES    50%     FREIGHT     TOTAL"
            PRINT #2, "  ----------   --------------        -------------  -------   -------     -----"
    RETURN
    ------------------

  • #2
    What kind of a printer do you have attached? If it's a USB
    printer, you'll have to have to get a copy of Lances DOSPRINT
    utility. PB/DOS can't access USB port(s).

    If the printer is connected to LPTx: check the xp control panel
    printer(s) property and make sure you can print to the LPT:x
    port from DOS programs.


    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      The Printer ia a Lexmark 1150 USB...

      ------------------

      Comment


      • #4
        Additionally there is no DOS in XP
        so I Cannot print from a dos printer lpt1..

        ------------------

        Comment


        • #5
          Do a search in Google for 'XP Printing from DOS program' and take your choice of aid.

          ------------------

          Comment


          • #6
            To quote from the tech support reply:

            "The first thing you need to do is to add some error-checking, so you can find out
            about any problems the program runs into. I'd recommend by starting with a big
            $ERROR ALL ON at the top of the code, to turn on all kinds of error detection.

            "One thing to consider, when using Windows, is that many printers aren't
            compatible with DOS any more. This is often the case with USB-connected
            printers. If that turns out to be the problem, an easy solution is to print
            the text to a file, and SHELL to a Windows program to print it:
            SHELL "NOTEPAD /P textfile.txt"

            By the way, there's about as much "DOS" in XP as in any other 32-bit
            version of Windows. It's not identical to stand-alone DOS but, it's close
            enough for most purposes.

            ------------------
            Tom Hanlin
            PowerBASIC Staff

            Comment


            • #7
              For those whom may be interested...

              For a smoother solution than shelling to Notepad to print under Windows, you might like to check out my DOSPRINT utility from http://www.dosprint.com The web site even has a fully function evaluation version you can download to test it out for yourself.

              With DOSPRINT you not only get an optional Print Preview, you'll be able to print to *ANY* printer that has a Windows driver installed, regardless of whether it is connected via an LPT port, a USB port, or its a network printer, etc. Even better, your DOS app may only ever need to use 1 set of Escape Codes to print to *any* printer, so there you might even be able to simplify your app while dramatically enhancing its printing ability!

              Finally, you can easily include graphical images (BMP, JPG, TGA, TIF, PCX, etc) in your print jobs too...

              ------------------
              Lance
              Conductive Software Systems
              mailto:[email protected][email protected]</A>

              [This message has been edited by Lance Edmonds (edited August 18, 2004).]
              Lance
              mailto:[email protected]

              Comment


              • #8
                Lloyd,

                I have had a lot of experience lately with printers in a Dos or Cmd box.

                One of my personal solutions has been to share the printer and then do a net use command. If you share your printer as 'MyPrinter' and your computer is named 'MyComputer' the following command should work:

                net use lpt1: \\MyComputer\MyPrinter

                To test it, simply enter "net use" and see if you have a local share named LPT1 in the list. If you do then I'll bet you'll be able to print from the dos box again.

                I've been able to use this method with printers that are attached to USB ports and http: ports.

                Hope this helps!

                Larry

                Comment


                • #9
                  This also may be of some use:
                  Bypass print driver using Windows XP and make permanent:
                  Can I bypass the print driver for faster printing using XP to an LPT port with a printer that doesn't need a driver? Yes.
                  Type NET USE LPT2: \\MachineName\PrinterShareName /Persistent:Yes at a command prompt one-time only.
                  Replace MachineName and PrinterShareName with the correct names from the machine sharing the printer.
                  Note sure about this old comment:
                  Be sure the printer is marked sharable on the machine hooked to the printer.
                  Print a test page from the workstation to be sure connection is being made.
                  An icon must appear for the printer on the workstation for this to work

                  Be sure to see NET HELP (more commands than in Win95/98)


                  ------------------




                  [This message has been edited by Mike Doty (edited September 05, 2004).]
                  How long is an idea? Write it down.

                  Comment

                  Working...
                  X