I have an Origin script that, via DDE, queries the state of some variables in Labview. The purpose is to enable the automatic aquisition and processing of data through Labview, then the automatic plotting and printing in Origin. The script waits for a new script to become available, then loads and runs it. The scripts end with a "document -n" command to ensure Origin is in a known state for the next script.Everything runs fine whilst the script is executing, but Origin seems to intermittently hang; the script stops executing, and attempts to exit Origin result in a Dr Watson message and dump.
I've included the server script below; is there an obvious error in it that could be leading to the deadlocks?
// Labview/Origin plotting server
// Waits for a signal from OriginDDE.vi indicating that
// data is ready to be plotted, then loads scripts/Autoplot.txt
// to plot it.
%Z=FALSE;
for (;1==1 {
idLabview=-1;
for (;idLabview==-1 {
dde -c labview|origin idLabview;
if (idLabview==-1) type -q Labview is not responding. Note that this script must be running on the same desktop as Labview!;
second -p 1;
};
type -q Labview responded;
dde -r idLabview DataReady;
if (%Z=="TRUE") {
type -q Data Ready;
run scripts/AutoPlot.txt;
dde -p idLabview DataReady FALSE;
};
else {
type -q Waiting for data;
};
dde -r idLabview Shutdown;
if (%Z=="TRUE") {
type -q Shutdown request. Remember- a goat is for life, not just for Christmas!;
second -p 5;
break 1;
};
dde -d idLabview;
second -p 1;
};