Announcement

Collapse
No announcement yet.

Sending file to printer

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

  • Sending file to printer

    I am producing A4 size labels with the customer's name and address.
    When using DOS, I created a file "prntfile.tmp" with a postscript
    header, followed by the various labels in the required list.
    To send it to the Postscript Laser Printer on the network, I used
    the following:
    SHELL "COPY PRNTFILE.TMP \\LAURA\EPSON"
    I have rewritten the code using PBDLL, creating the Postscript file
    in the same manner as in DOS but using the SHELL statement as above,
    the programme produces an error.
    What am I doing wrong?
    Help would be appreciated.
    Regards,
    Brian.


    ------------------
    Brian.

  • #2
    What error are you receiving?

    I searched my Win98 machine for "Copy.*" and did not find any file. According to the PB DOCS, SHELL will assume COPY to be an .EXE file since you did not include an extension. Perhaps COPY is either internal to the MS-DOS mode/window or it is a .COM file?

    Bernard Ertl

    ------------------
    Bernard Ertl
    InterPlan Systems

    Comment


    • #3
      "Copy" has been used in DOS programming for many, many moons.
      I think you would call it a DOS Utility.

      Regards,
      Brian.


      ------------------
      Brian.

      Comment


      • #4
        COPY is a DOS command.
        You can Shell it with "command.com \c copy //blah/blah"

        Or just use this:

        Code:
        #COMPILE EXE
        
        FUNCTION PBMAIN
          blah$ = "This is a Test!"
          OPEN "\\Work-blu101\HP-DJ-970CXI" FOR OUTPUT AS #1
          PRINT #1, blah$
          CLOSE #1
        END FUNCTION
        Works much better

        To read your file, use

        open "myfile.txt" for binary as #1
        get$ #1, lof(1), a$
        close #1

        'a$ contains your file. Just PRINT it

        regards,
        Sven



        ------------------
        e-mail: [email protected]
        e-mail (work): [email protected]

        Comment


        • #5
          The slashes need to go the other way, Sven. It would also be better
          to use the default command shell. Try this:
          Code:
          SHELL ENVIRON$("COMSPEC") + " /c COPY PRNTFILE.TMP \\LAURA\EPSON"
          It would be prudent to specify a full filespec for PRNTFILE.TMP
          instead of assuming that it's in the default directory. Windows
          doesn't treat default directories in quite the same fashion as DOS.


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

          Comment


          • #6
            From the aforementioned, I get the idea I can use the following:

            open "\\laura\epson" for output as #1
            open "prntfile.tmp" for input as #2
            while not eof(2)
            line input #2, a$
            print #1, a$
            wend
            close

            Does that look okay?

            Regards,
            Brian.



            ------------------
            Brian.

            Comment


            • #7
              Looks fine to me!

              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment

              Working...
              X