Page 1 of 1

file problems

Posted: Wed Apr 16, 2003 5:12 pm
by Guest
if someone can help me please....

im writing 2 programs...

1 is a bulletins program i figured this would be simple

small portion of whaty i want it to do is this

print " 1. bulletin 1
print " 2. bulletin 2
print:color 11
input " Select Bulletin or (Q)uit :>",input$

if input$="1" then goto 200
if input$="2" then goto 200
if input$="Q" or input$="q" then goto 500
goto top

200 i want a command here to print dos files
500 system

i know theres prolly an easy way to do this the above peice of code was just a ref

im trying to figure out how to display DOS text files and display dos .ANS files

Daniel Spain
www.azonebbs.net229.ca

Re: file problems

Posted: Thu Apr 17, 2003 4:20 am
by John_Schofield
do you want to display the bulletin on screen or out to a printer? It makes a difference!

Also, is your bulletin a plain old ascii text file or something else?

Re: file problems

Posted: Thu Apr 17, 2003 5:33 am
by Baz
Hi.
Ok its not purfik but here goes.
Hope some of it is usefull
depending on your flavour of windows as what information (if any) may be viewed with the files
---------------------------------------------------------
start:
ON ERROR GOTO 0
GOSUB showmenu

DO
k$ = UCASE$(INKEY$)
IF k$ = "1" THEN GOSUB example1: GOSUB footer
IF k$ = "2" THEN GOSUB example2: GOSUB footer
IF k$ = "3" OR k$ = "4" OR k$ = "5" THEN GOSUB file: GOSUB footer
IF k$ = "M" THEN GOSUB showmenu
IF k$ = "Q" THEN END
LOOP


showmenu:
CLS
COLOR 3
LOCATE 12, 30: PRINT "1 = Example 1"
LOCATE 13, 30: PRINT "2 = Example 2"
LOCATE 14, 30: PRINT "3 = Open AUTOEXEC.BAT"
LOCATE 15, 30: PRINT "4 = Open CONFIG.SYS"
LOCATE 16, 30: PRINT "5 = Open WIN.INI"

LOCATE 20, 25: COLOR 4: PRINT "<Enter 1,2,3,4,5 or Q to Quit>"
RETURN

example1:
CLS
PRINT " This is the text at example 1"
RETURN

example2:
CLS
PRINT " This is the text at example 2"
RETURN

footer:
LOCATE 20, 30: COLOR 5: PRINT "< M = Menu>"
RETURN


file:
ON ERROR GOTO fileerror
CLS
IF k$ = "3" THEN OPEN "c:\autoexec.bat" FOR INPUT AS #1
IF k$ = "4" THEN OPEN "c:\config.sys" FOR INPUT AS #1
IF k$ = "5" THEN OPEN "c:\windows\win.ini" FOR INPUT AS #1
WHILE NOT EOF(1)
LINE INPUT #1, a$: PRINT a$
WEND
CLOSE 1
RETURN


fileerror:
PRINT "Ooops, there was an error opening a file"
PRINT "Program will restart in 5 seconds"
BEEP
t = TIMER
DO
LOOP UNTIL t + 5 < TIMER
RESUME start

It depends on the file

Posted: Thu Apr 17, 2003 1:57 pm
by Guest
It depends on a few things:

1) The file(s) you are using is in pure ASCII format (no pics or special characters [< chr$(32)] )

2) A local printer (not networked)

3) Printer port is LPT1 (not LPT2, USB, nor COMx)

(I'm not certain if escape codes are required but PCLs and PS type printers do sometimes have a problem with printouts.)

If all of the above is true (well, except for PCL/PS types) then you should have no problems opening the files for both viewing and printing through one command. &nbsp;

If you are interested, let me know and I can do a test run and get back to you.

--MiggyD