run two loops at once run two loops at once zolken1 (Programmer) (OP) 4 May 07 22:06 is there any way you can run two loops at once that are not inside each other??? i want one loop to open a file and print a line and the other loop ti input and save a message.how do i do that .... srry im new with some of this stuff.. RE: run two loops at once PROFESSORSPARKIE (Instructor) 17 May 07 12:30 I am not sure if this is what you want but a Qbasic program could "SHELL" a Windows "START" command which starts another window which could be a .BAT file that contains the running of any program including a Qbasic program of it's own.Then the first Qbasic program could issue another "SHELL" "START" command. this is fairly straight forward if you are familiar with the Qbasic "SHELL" command & the WINDOWS "START" command. The new WINDOWS can run Max/Min plus a lot of other options.These two new windows can be independent tasks of the orinination Qbasic program or it can "WAIT" on either window but that would defeat your purpose of doing multi-tasking the set of ".BAT" files.to get help with the "START" command enter "START /?" on a command line.Hope this helps. I teach a lot of programming so I can learn. You can never learn it all. RE: run two loops at once zolken1 (Programmer) (OP) 22 May 07 08:51 ok so how do i use this statement, i tried it after i read your post i just wanted to see if i could get it to work. but i ccouldnt lol. but i think i ran across a post a while back saying that you could run two loops at once but i couldnt find it again. oh well. Im usiong this in my qbim program thats in another post.. RE: run two loops at once PROFESSORSPARKIE (Instructor) 28 May 07 21:43 An example use of the Qbasic SHELL command.The first SHELL starts a sub shell that executes the directory request command with it's output going to a simple file. The swcond one starts a new window of NOTEPAD editing the created file. The second window can continue to run as an independent window even if the original Qbasic program terminates.You can start any number of additional windows running independent of each other if desired. You will have to figure out the application needs but this is a simple implementation of what I was talking about.A SHELL could issue the Windows "START" command. SHELL "C:\DIR >C:\TEMP\DIR.TXT"SHELL "NOTEPAD C:\TEMP\DIR.TXT" I teach a lot of programming so I can learn. You can never learn it all. RE: run two loops at once ngxGraz (TechnicalUser) 22 Jun 07 09:26 Are they going to be running simultaneously as in when one is done, the other is?if so just put calls to a print line sub, or a call to an input/save sub RE: run two loops at once QBasicMac (Programmer) 23 Jun 07 09:26 The short answer is "No". There is no QBasic command such as "GC" (GOTO and Continue). If there were, you could codeCODEPRINT "Start two processes"CG ReadFile 'This will goto ReadFile but also immediately continueOPEN "OutFile.dat" for output as #2do line input "Enter message to be saved: "; M$ if M$="" then exit do print #2, m$loop close #2END Me ' This would end only this taskReadFile:OPEN "InFile.dat" for input as #1do if EOF(1) then exit do line INPUT #1, l$ print l$ line input "Read another line? "; a$loop while ucase$(a$)="Y"close #1End Me ' This would end only this task(In my imaginary instruction set, as soon as no tasks are running, the program would END.)Anyway, you can't do that. Even if you could, it would be very confusing to the user. If the user hits a key, which of the two tasks would receive it?That said, I would add that you can accomplish stuff like the above in a single task if you write your own replacement for LINE INPUT so that your basic program looks likeCODEDim Status as string*1 ' Identity of the task currently expecting user inputcall Task1(""): call Task2("") ' Each will return when it needs a characterdo k$=inkey$ if k$=(some key that means swap tasks) then if Status=1 then Status=2 elseif k$<>"" then if Status=1 then call Task1(k$) else call Task2(k$) endifloop That's just the big picture. Lots of details to make it work. So you really need to explain exactly what you want to accomplish and why.Mac RE: run two loops at once edfair (TechnicalUser) 23 Jun 07 13:19 This is not my basic but from what I know of timing problens with others I would suggest that you really need only one loop but handle things for both possibilities at different sections of the loop on a character by character basis. Ed FairGive the wrong symptoms, get the wrong solutions. RE: run two loops at once ngxGraz (TechnicalUser) 25 Jun 07 09:16 CODEDim Status as string*1 ' Identity of the task currently expecting user inputcall Task1(""): call Task2("") ' Each will return when it needs a characterdo k$=inkey$ if k$=(some key that means swap tasks) then if Status=1 then Status=2 elseif k$<>"" then if Status=1 then call Task1(k$) else call Task2(k$) endifloopStatus would eventually get stuck on two.