
getting a qbasic program to run the command to start another non qbasic
Quote:
> I have just started to learn how to program in Qbasic that came with my computer
> and my problem is finding a statement that will call a program from DOS, like
> going to windows or the command that starts doomII(doom.exe), to put in my
> program's code.
This is done by means of the SHELL statement, which starts up another
command interpreter. Usage:
SHELL "\GAMES\DOOMII\DOOM.EXE"
but I don't think this will work in this case. I don't know how much
conventional memory doomII needs, but I do know that you won't have much
left with QBASIC.EXE and your BASIC program already there. The same goes
for windows [yuck!].
I assume what you are trying to do is to make some sort of menu system
for starting your programs. However, you can't start a program of a
reasonable size with QBASIC.EXE in memory. So you need to exit QBASIC
first, and then start up the desired program, by means of a batchfile
which uses another batchfile created by your menu program. [Setting
errorlevel doesn't work with the crippled version of QuickBasic you get
with DOS].
Use a batchfile like this:
:loop
QBASIC /RUN menu.bas
call option.bat
goto loop
So, you need to have your program create a batchfile called option.bat
which has in it the commands to start up the chosen program, something like
PRINT "1) Program one"
PRINT "2) Program two"
PRINT : PRINT "Type 1 or 2..."
DO
number$=INPUT$(1)
LOOP WHILE NOT INSTR("12",number$)
OPEN "\option.bat" FOR OUTPUT AS #1
PRINT #1,"c:"
SELECT CASE number$
CASE "1"
PRINT #1,"cd\progs\prog1"
PRINT #1,"prog1.exe"
CASE "2"
PRINT #1,"cd\progs\prog2"
PRINT #1,"prog2.exe"
END SELECT
CLOSE #1
SYSTEM 'I forgot how to exit to DOS from a QBASIC program. This probably
'isn't it. Perhaps somebody else knows...
Hope this helps. Good luck!
Wouter Bergmann Tiest
** Electronic mail? Is that some kind of futuristic science fiction armour? **