Facility Control

 View Only
  • 1.  adding a Delay between tasks

    Posted 05-01-2019 16:08

    i have an OG script that sends a command to animate off our graphics.  

    then preform a transition on the program buss.

    but it takes a second to preform the animate action as the graphic folds up and slides off. 

    how can i add a delay between the two tasks. 

    such that the transition will not fire for a set time after the button is pressed to give time to the animation. 

     



  • 2.  RE: adding a Delay between tasks

    Posted 05-01-2019 18:49

    In the window that you create an OG script command such as taking a graphic to air, there is another tab under OG Script called Pause. This is where you'd do this at. You can set it to be to any duration.


    #DashBoard


  • 3.  RE: adding a Delay between tasks

    Posted 05-01-2019 23:11

    Thanks 

    i did it the hard way. 

    and wrote a sleep function in JS. 

     

    that worked too. 


    #DashBoard


  • 4.  RE: adding a Delay between tasks

    Posted 05-02-2019 09:05

    Well... Yes and no...

    While the sollution to Drew works, and I'm sure your way of doing it as well works just fine John, there is a way to add pauses in DashBoard natively. However not in the way you expect.

    DashBoard has by default two threads (line of processing), and the main thread is used whenever you just push a button and it reads code from top to bottom. However, as Drew may have noticed is that if you have this pause command on that thread, this will freeze the main thread intil the pause is activated. However, if you want more stuff done, while waiting for something else...

    DashBoard has an Async.Exec (more can be added), that is basically a seperate thread that lets you do operations asynchronous from the main thread. And this one can be paused. See example DashBoard below with both Drew's sollution, and a button with async example:

    <abs contexttype="opengear" gridsize="20" id="_top" style="">
    <meta>
    <params>
    <param access="1" maxlength="0" name="done" oid="done" type="STRING" value="Pause done" widget="text-display"/>
    </params>
    </meta>
    <button buttontype="push" height="180" left="260" name="&lt;html&gt;&lt;center&gt;Press me&lt;br/&gt;5 sec pause in main thread&lt;/center&gt;&lt;/html&gt;" style="size:Big;" top="80" width="340">
    <task tasktype="ogscript">params.setValue('done', 0, 'starting... Pause for 5 sec...');
    </task>
    <task tasktype="pause">5000</task>
    <task tasktype="ogscript">params.setValue('done', 0, 'Pause done');
    </task>
    </button>
    <param expand="true" height="180" left="260" oid="done" style="txt-align:center;size:Biggest;" top="280" width="760"/>
    <button buttontype="push" height="180" left="680" name="&lt;html&gt;&lt;center&gt;Press me&lt;br/&gt;5 sec pause in async thread&lt;/center&gt;&lt;/html&gt;" style="size:Big;" top="80" width="340">
    <task tasktype="ogscript">function runLater()
    {
    params.setValue('done', 0, 'async done...');
    }
    ogscript.asyncExec(runLater, 5000); //run a function asynchronous, delayed 5000 milliseconds

    params.setValue('done', 0, 'Button pressed...');


    </task>
    </button>

    </abs>




    #DashBoard