Alpha Video Training
Results 1 to 5 of 5

Thread: Need to print .txt files when button is pressed

  1. #1
    David Smothers
    Guest

    Default Need to print .txt files when button is pressed

    I have developed a catalog database for my place of work. Some of the part numbers are items where our customers will need to print predefined text files. I plan to use a field in my database for the text's file name. All files will be in the same directory. My question is: How can I print the correct file from my form by using a button? The text file will be a printable text file.

    Thanks, David L. Smothers

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Need to print .txt files when button is presse

    The sys_shell command will probably handle what you require:

    sys_shell()
    Syntax:
    sys_shell( Program Name [ , Window Mode])
    Description:
    Executes the specified Windows program (Program Name). The optional
    Window Mode parameter is a number that determines the mode of the window in
    which the application runs. If you omit this parameter, the window will be
    minimized by default.
    The Window Mode options are:
    Window Mode Description
    1 Normal
    2 Minimized
    3 Maximized
    Example:
    'This script displays the A5.INI file from the windows directory
    'using the Windows notepad application.
    '---------------------------------------------------------------
    x = sys_shell("c:windowsnotepad.exe c:windowsa5.ini",1)


    i.e. shell out to wordpad and furnish it the file name to use, let the user select print.

  3. #3
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Need to print .txt files when button is presse

    David,

    It seems to me that you could employ Stan's logic to directly print your text file rather than opening it in another program and manually printing if from there.

    You would still use sys_shell but designate command.com as the external program and employ the dos "copy" the text file to the printer. This will be familiar to you if you used to do it in the "good old days" (note heavy sarcasm). If you didn't let us know and many people will be able to help with the syntax which would be along the lines of:

    sys_shell("c:command.com copy yourtextfilepath.txt prn")

    (Remember that backslashes don't show on the board but you must use them.)

    Bill

  4. #4
    Member
    Real Name
    Jack Wheeler
    Join Date
    Apr 2000
    Posts
    570

    Default RE: Need to print .txt files when button is presse

    Here are the best Ideas Ihave seen in a long time. Sometimes I will (not always the best of course and a lot of work) scam om documents and create a memo filed with the text in them directly. I have even had to use bitmaps (very large) as well. The benefit was to keep everything within Alpha and a server, however with Stan's comments You could place all the text files within your current directory and presto you are done! Now I clearly see the power of OLE and keeping bitmaps on another drive or disk (CD,harddrive or zipdrive) and call for the file from there keeping the size of your Alpha directory within some reason.

  5. #5
    Member
    Real Name
    Allen Klimeck
    Join Date
    Apr 2000
    Location
    Colorado
    Posts
    539

    Default RE: Need to print .txt files when button is presse

    There is a shareware program called raw print if you copy a text file to the raw print spool directory raw print will sent it to the printer by passing the print driver(Prints very fast!). You will need to add any formatting to the file so the it will print for the printer you are using in text mode. You can find raw print at:

    http://www.perilous.com/

    Then all you need is a button that will copy the file to the raw print spool directory.

    file_copy("path & file to copy.txt","path to RP spool and file name can be any name.txt")

Similar Threads

  1. Print Button on a form
    By Rob C in forum Alpha Five Version 5
    Replies: 5
    Last Post: 01-29-2004, 02:23 PM
  2. Using a button to print
    By David Darby in forum Alpha Five Version 4
    Replies: 4
    Last Post: 10-14-2002, 07:42 AM
  3. Button to Print a Report?
    By Bob Elliott in forum Alpha Five Version 4
    Replies: 1
    Last Post: 05-24-2002, 05:28 AM
  4. Using One Button to Query and Print
    By Rodney Efird in forum Alpha Five Version 4
    Replies: 6
    Last Post: 12-20-2000, 04:26 AM
  5. Need help with a print button script.
    By George BVI in forum Alpha Five Version 4
    Replies: 1
    Last Post: 05-22-2000, 01:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •