![]() |
Forum Index : Microcontroller and PC projects : MMBasic for Windows/DOS question
Author | Message | ||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
I have two programs for Windows/DOS MMBasic and I want the first program to RUN the second one. The trouble is, I want the second program to know if it has been RUN by the first and if so, get the parameters from a file. If not, then I want it to ask for them to be input via the keyboard. I also want these programs to work in the same way for the CMM2. The method I have come up with is for the second program to check for the parameter file and use it if it exists, process the data using the parameters from the file, then delete the file. The first program must therefore create the file each time it RUNs the second one. When the second program is RUN by another means and the parameter file does not exist then it will ask for them. I'd rather not create and delete the parameter file every time because the data it contains will vary infrequently. Having said that, the second program will create a new version of an existing file and over-write it each time it is run. Is there a better way that will work for both MMBasic for Windows and the CMM2? Thanks Bill Edit: Maybe I should add: there is only one parameter at this stage - an integer. Edited 2022-01-06 15:03 by Turbo46 Keep safe. Live long and prosper. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Does the CHAIN command still exist in the DOS version? I seem to recall that CHAIN would run another program, preserving all the variables. I THINK that CHAIN is still in the DOS version, but I would have to check. Smoke makes things work. When the smoke gets out, it stops! |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
No it doesn't thanks Grogster. Not in the CMM2 either. I need to RUN the second program or clear all of the variables, there are large arrays in both programs. I believe CHAIN saves all of the variables for the chained program. Bill Keep safe. Live long and prosper. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
commandline parameters whatever you want when initiating from first program, blank when starting manually. JIm VK7JH MMedit |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
Thanks Jim, I know that works for the CMM2 but the Windows version only has: RUN [file$] The Windows version also has: SYSTEM command-line$ But that exits to DOS and executes the command line then returns to the original program. Not sure that would work and I don't want to return to the original program. I know I can test for which device the program is running on and do one thing or the other, but I don't think it does what I want. Bill Keep safe. Live long and prosper. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Yes, you will need SYSTEM for the DOS version but a simple device test to work out what you are running on will handle that. If you put 'END' immediately after the SYSTEM line, you will exit to MMBasic prompt or 'QUIT' to totally exit MMBasic. VK7JH MMedit |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
Thanks Jim, I think that should work. I hadn't noticed the QUIT command either. I don't know how much memory the Windows version reserves for one instance but I think I ran out of memory at one stage. As long as each program has its own environment that should be OK. Bill Keep safe. Live long and prosper. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |