|
Post by programmer on Jul 9, 2002 18:38:54 GMT
can qbasic open a .bas file if it can how
|
|
|
Post by brisray on Jul 13, 2002 8:16:32 GMT
What a strange question - it should be able to, QBasic creates BAS files.
Actually the answer isn't so straightforward as that.
From v4.5 (I think) QBasic can save the BAS files in a non-text form. QBasic v1.1 can only open them if they were saved as text files.
Also Visual Basic saves module files as BAS files. QBasic v1.1 can open them as well as V4.5 and v7.1 BAS files, whether it makes any sense to it is a different matter.
There is another thing to consider, if you mean how you associate BAS files with QBasic on a Windows PC, then yes you can have problems as if you've got VB or Visual Studio loaded then the BAS files are associated with Visual Basic.
I use Visual Basic but have changed the file association so that BAS files always open QBasic. I use Windows 2000 so you may have to change the way you do this but to change the association in Windows Explorer open Tools > Folder Options > File Types. Highlight BAS then Change > Other. (QBAsic isn't a registered program so it's not listed). Click the "Always use this program to open these files" box. Now look for QBasic.exe and click OK.
Another, not so permanent, but always available way is to create a shortcut to QBasic and put it in the Windows Send To folder. Now you can just right click on a BAS file and choose QBasic to open it.
Ray
|
|
|
Post by programmer on Jul 15, 2002 1:38:09 GMT
lol sorry i should of ritten in more detail im like can qbasic open a .bas file with a command in a program. eg. ____________________________________________ PRINT "IF YOU WANT TO OPEN A CALCULATOR PRESS 1 " INPUT " IF YOU WANT TO QUIT PRESS 2", a$ _____________________________________________ then have respond to the input by opening a .bas program or end
|
|
|
Post by brisray on Jul 16, 2002 6:43:41 GMT
Ha, now I understand. There certainly is a command to do this. It's called CHAIN
Here's a simple program, CALLBAS.BAS
DO CLS Cmmnd$ = "" PRINT "This is callbas.bas" PRINT PRINT "What you like to do?" PRINT PRINT "Call next.bas (C)" PRINT "Exit the program (X)" DO Cmmnd$ = UCASE$(INKEY$) LOOP UNTIL Cmmnd$ <> "" IF Cmmnd$ = "C" THEN CHAIN "c:\qbasic\next.bas" Cmmnd$ = "" END IF LOOP UNTIL Cmmnd$ = "X" END
and and even simpler one being called NEXT.BAS:-
CLS PRINT "This is next.bas" PRINT PRINT "Press any key to return to callbas.bas" DO Cmmnd$ = INKEY$ LOOP UNTIL Cmmnd$ <> "" CHAIN "c:\qbasic\callbas.bas" END
Have you considered using a batch file to start the various basic programs?
The batch file simply contains a simple menu and the commands to open the QBasic files without showing the editor.
Here's a simple menu in a batch file :-
REM - Main menu @echo off :loop cls echo. echo. ****************************** echo. * Welcome to Ray Batch * echo. ****************************** echo. echo. echo. What would like to do? echo. echo. echo. echo. S - Show a calandar (Press Esc when you've finished with it) echo. echo. R - Use RayDos - an improved DOS (sort of) echo. echo. X - Exit this batch file. echo.
choice /C:SRX /N " Press D,S,R or X to continue ..."
if errorlevel 3 goto end if errorlevel 2 goto fundos if errorlevel 1 goto cal
REM - Run QBasic Calandar program :cal a:\qbasic.exe /run a:\calandar.bas goto loop
REM - Run QBasic RayDos program :fundos a:\qbasic.exe /run a:\raydos.bas goto loop
REM - Quit program :end
It assumes that QBasic and the programs are on the A: drive, you can easily edit it for your own uses. When you do remember to not use END in your BAS programs but use SYSTEM instead.
You'll also need the DOS program CHOICE. This is not available with some versions DOS supplied with Windows. You should be able to get a copy from anything before Windows ME though. If you copy it from an older machine it should work, as far as I know it's not going to give one of those "Wrong DOS version" messages.
Ray
|
|
|
Post by programmer on Jul 17, 2002 1:13:39 GMT
thx i've been dieing to no how
|
|