PDA

View Full Version : Running ThinBasic Programs from Master Program



kryton9
15-11-2007, 05:52
Let's say I made 3 totally self contained independent thinBasic programs. That is I can load any of the three and run it without it depending on the other 2 programs.

Now can I make a 4th program, like a master control program, that I can run any of the 3 applications when I want and in any order and when I quit that program it will automatically go back to the master program that launched it?

Master Program
\
\
Launches Program 2
...
Program 2 terminates
/
/
Control goes back to Master Program.

Master Program
\
\
Launches Program 1
...
Program 1 terminates
/
/
Control goes back to Master Program.

Master Program
\
\
Launches Program 3
...
Program 3 terminates
/
/
Control goes back to Master Program.

Don't forget Programs 1-3 can run on their own and in that case would not go back to the Master Program.
It only goes back to the Master Program when it is executed by the Master Program.

Thanks for any help.

Michael Clease
15-11-2007, 09:43
the first 3 program are normal but include this in the master program

Use this to call the script

n = OS_ShellExecute(Operation, File, Parameters, Directory, ShowCmd)

sit in a loop until the title of the new window is invalid

hWnd = Win_FindByTitle(WindowTitle [, FindMethod])

it doesnt say but I think that returns 0 if not found.

thats one way. I am sure Eros will have a better way ;)

kryton9
15-11-2007, 10:11
Thanks Abraxas, great to know it can be done!!

ErosOlmi
15-11-2007, 11:14
What Abraxas suggested is a possible way.

Anothe way is to use OS_Shell(Command[, WindowStyle[, Mode]]) (http://www.thinbasic.com/public/products/thinBasic/help/html/os_shell.htm)
Mode parameter can be used to specify how to run the sub-process, if SYNC or ASYNC. Using %OS_SHELL_SYNC will run the process and wait.

Let me know.
Eros

kryton9
16-11-2007, 11:39
Thanks Eros, so not only can we do it, but we have different ways, woo hoo!!