The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Running a program from ORIGIN 5 script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

a_user

USA
0 Posts

Posted - 08/19/1998 :  3:06:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have setup a script that runs a DOS program that does some
Calculations. The program generates an ASCII file that is read
be the script and plotted.
The problem I have, is when I use the run command to run the DOS
Program. The DOS program in lunched and the script continues to
run before the DOS program finished the calculation.
Is there any way to run a program and have the script wait until
the program stops.

Gary Lane

USA
150 Posts

Posted - 08/19/1998 :  3:08:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000