How to chain programs

Hi I was wondering if someone could tell me how to add lines in my program that can open another true basic program.


Chain command

CHAIN "!"&programname$&" file://"&dir$&"\videos\"&vidname$&".RM", RETURN

The most important and not well documented thing is the "!" in the command. Then there is the name of the program you want to start. If you need to feed some info to the program--in the example above a file name to play, that can be included too. [Note, in case the line gets wrapped--there is a space in front of FILE.]

In the example the programname$ refers to the media player software being used--could be the wmplayer.exe (windows media player) or in my case realplayer.exe (for the Real media player). dir$ is the current directory in which the program is sitting found by doing a
ASK DIRECTORY dir$, and in my case I have a subfolder 'videos' in which a file name stored in vidname$ resides with an extension of ".RM". The RETURN will send execution back to the TrueBasic program after you other program runs. This example then plays a real-media video file and then returns to the True Basic program.

So to simplify, if I want to run the Real Player software with a file (stored in a VIDEOS subfolder that resides in my TRUEBASIC folder that resides on the C: drive) named TEST.RM the Chain command would read"



I dont think that my question was clear

I was wondering like i'm in true basic using a program that i made. I was wondering how to make it open and run another true basic program. Thank you for your response though now I know how to incorperate videos into my programs


Same way--but your second program probably needs to be saved as an executable program (.exe extension). So in the very simplest example

CHAIN "!newprogram.exe",return

where newprogram.exe is the file name of the second program.



Thanks I'll give it a try