Hi Tim.
Your issue is that you are calling your "UselessFunction" instead of passing it.
If your long-running function takes arguments, you'd need to wrap it in a new function like this:
<abs contexttype="opengear" gridsize="20" id="_top" style="">
<meta>
<params/>
</meta>
<meta>
<api>function UselessFunction(integer)
{
ogscript.debug("Busy");
var c = 0;
for (var i = 0; i<integer; i++)
{
c = i;
}
ogscript.debug("Not so busy");
}</api>
</meta>
<button buttontype="push" height="120" left="20" name="Press me to halt Dashboard" top="20" width="280">
<task tasktype="ogscript">ogscript.debug("Working");
ogscript.asyncExec(function() { UselessFunction(100000000) }, 0);
ogscript.debug("Finished");</task>
</button>
<button buttontype="push" height="120" left="320" name="Try to press me while the other task runs" top="20" width="280"/>
</abs>
If it does not, you could pass it directly:
<abs contexttype="opengear" gridsize="20" id="_top" style="">
<meta>
<params/>
</meta>
<meta>
<api>function UselessFunction()
{
ogscript.debug("Busy");
var c = 0;
for (var i = 0; i<50; i++)
{
c = i;
ogscript.pause(100);
}
ogscript.debug("Not so busy");
}</api>
</meta>
<button buttontype="push" height="120" left="20" name="Press me to halt Dashboard" top="20" width="280">
<task tasktype="ogscript">ogscript.debug("Working");
ogscript.asyncExec(UselessFunction, 0);
ogscript.debug("Finished");</task>
</button>
<button buttontype="push" height="120" left="320" name="Try to press me while the other task runs" top="20" width="280"/>
</abs>
#DashBoard