This is tough, multithreading support for Origin C would be required to do what you want. Until then, you can insert the LabTalk wait command to allow Origin to run during that wait time. The follow code shows how the DataDisplay bar will continue to be updated until you type
junk=1;
into the script window.
void test(int nMax = 100000)
{
string str;
for(int ii = 0; ii < nMax;ii++)
{
str.Format("%d:Please set Junk to 1 to stop", ii);
SetDataDisplayText(str);
double vv;
LT_get_var("junk", &vv);
if(vv > 0)
break;
LT_execute("sec -p 0.2"); // wait 0.2 sec to let Origin run/process its messages.
}
if(ii < nMax)
out_str("user has stopped the loop from LabTalk");
}
CP