Execute a DOS program from a script and then wait until it terminates It involves a few lines of code but there is a way to execute a DOS program
from a LabTalk script and then have the script wait until the DOS program
terminates before continuing with the next script command. First, you must
make a DOS batch file (DosProg.bat) that executes your DosProg.exe and
creates an Origin OGS file that sets a done flag equal to 1 after DosProg.exe
is done executing. For example, create a file named DosProg.bat that
contains the commands:
@echo off
echo [DoneYet] > C:\Origin50\Wait.ogs
echo done=0; >> C:\Origin50\Wait.ogs
start /w C:\Origin50\DosProg.exe
echo done=1; >> C:\Origin50\Wait.ogs
exit
Then, in your LabTalk script place the following lines of code:
// Insert into your script
done=0;
run -e C:\Origin50\DosProg.bat;
for( ;done==0; ) {
sec -p 0.5;
run.section(Wait,DoneYet);
};
// Continue with your script
The LabTalk script will idle in the for loop until your DOS program
terminates and the done flag is set to 1. Of course, you may need to alter
the file and path names in the above code to work with your system setup.