Facility Control

 View Only
  • 1.  ogScript for displaying XML value in Dashboard

    Posted 09-14-2025 02:55

    Can someone help me with the ogScript for displaying the "Hscore" value from this XML file on Dashboard as a label? It would need to update when the value changes. 

    I have attempted to make a task using visual logic just to get the something to show up but it is not working. I am a beginner when it comes to scripting.  



    ------------------------------
    Bob Ramsay
    Broadcast Engineer
    Memphis-Shelby County Schools
    ------------------------------


  • 2.  RE: ogScript for displaying XML value in Dashboard

    Posted 09-15-2025 13:10

    Hi Bob,

    Here is an ogScript example that displays the HScore value from an XML file as a label. When the XML changes, pressing the 'read' button will update the HScore label.

    <abs contexttype="opengear" id="_top">
    <meta>
    <params>
    <param access="1" maxlength="0" name="filename" oid="filename" type="STRING" value="sportscast2.xml" widget="file-picker"/>
    <param access="1" maxlength="0" name="hscore" oid="hscore" type="STRING" value="54321" widget="default"/>
    </params>
    </meta>
    <label height="40" left="40" name="Hscore from XML" style="txt-align:west;size:Bigger;" top="40" width="420"/>
    <param expand="true" height="40" left="40" oid="filename" top="100" width="420"/>
    <button buttontype="push" height="40" left="470" name="Read" top="100" width="120">
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("Hscore");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("hscore", 0, v);
    ogscript.rename("HScoreLabel", "Hscore: " + v);</task>
    </button>
    <label height="60" id="HScoreLabel" left="40" name="Hscore: --" style="txt-align:center;bdr:shadow;size:Bigger;" top="170" width="240"/>
    </abs>


    ------------------------------
    Kiran Adhikari
    ------------------------------



  • 3.  RE: ogScript for displaying XML value in Dashboard

    Posted 09-15-2025 16:46

    Thank you so much! It seems to be working.

    I've place the code into the template I was already working on. To find additional values I added additional parameters and added more tasks to the read button. Is that the best way to go about it? I also want the values to refresh automatically so I added a setInterval command at the end of each task.

    setInterval(fetchHscore, 10000)

     Will that work or is there a better way to do that? 

    Here is the code I have so far. 

    <meta>
    <params>
    <param access="1" maxlength="0" name="filename" oid="filename" type="STRING" value="file:/sportzcast2.xml" widget="file-picker"/>
    <param access="1" maxlength="0" name="hscore" oid="hscore" type="STRING" value="0" widget="default"/>
    <param access="1" maxlength="0" name="vscore" oid="vscore" type="STRING" value="0" widget="default"/>
    <param access="1" maxlength="0" name="clock" oid="clock" type="STRING" value="0:00" widget="default"/>
    </params>
    </meta>
    <param expand="true" height="40" left="57" oid="filename" top="598" width="420"/>
    <button buttontype="push" height="40" left="485" name="Read" top="597" width="120">
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("Hscore");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("hscore", 0, v);
    ogscript.rename("HScoreLabel", + v);
    setInterval(fetchHscore, 10000);</task>
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("Vscore");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("Vscore", 0, v);
    ogscript.rename("VScoreLabel", + v);
    setInterval(fetchVscore, 10000);</task>
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("clock");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("clock", 0, v);
    ogscript.rename("ClockLabel", "" + v);
    setInterval(fetchclock, 10000);</task>
    </button>
    <label height="29" id="HScoreLabel" left="729" name="HScore: --" style="txt-align:center;bdr:shadow;size:Bigger;bg#000000;fg#FFFFFF;" top="193" width="71"/>
    <label height="29" id="VScoreLabel" left="437" name="VScore: --" style="txt-align:center;bdr:shadow;size:Bigger;bg#000000;fg#FFFFFF;" top="193" width="73"/>
    <label height="29" id="ClockLabel" left="906" name="Clock: --" style="txt-align:center;bdr:shadow;size:Bigger;bg#000000;fg#FFFFFF;" top="193" width="100"/>


    <param expand="true" height="35" oid="0xC" right="7" showlabel="false" top="275" width="112"/>


    ------------------------------
    Bob Ramsay
    Broadcast Engineer
    Memphis-Shelby County Schools
    ------------------------------



  • 4.  RE: ogScript for displaying XML value in Dashboard

    Posted 09-16-2025 14:47

    Hi Bob,

    Given you already have a function, you can use ogscript.installTimer to register a timer and run a task (your function) in a timed interval. 




    ------------------------------
    Cheers,

    Aury Rukazana
    Senior Software Developer
    Ross Video
    ------------------------------



  • 5.  RE: ogScript for displaying XML value in Dashboard

    Posted 09-16-2025 20:11

    I'm not having any luck getting this to work. Would you mind showing me what that code should look like?

    <abs contexttype="opengear" dblinqport="2222" id="Football_TEST" keepalive="true" name="Scoreboard_FOOTBALL" virtualheight="385" virtualwidth="1000">
    <abs height="359" left="37" style="bg#dark;bdr:etched;" top="13" width="937"/>
    <meta>
    <ogscript handles="onchange,onload" oid="IP">var newIP = params.getValue('IP', 0);
    ogscript.putPrivateString('hosts', '127.0.0.1.host', newIP);</ogscript>
    <lookup id="hosts">
    <entry key="localhost.host">localhost</entry>
    <entry key="localhost.port">7788</entry>
    <entry key="127.0.0.1.host">127.0.0.1</entry>
    <entry key="127.0.0.1.port">7788</entry>
    </lookup>
    <context>
    <meta>
    <lookup/>
    <color/>
    <style/>
    <api/>
    <ogscript/>
    <listener/>
    </meta>
    </context>
    <api/>
    <context/>
    <ogscript/>
    </meta>
    <meta>
    <params>
    <param access="1" constrainttype="INT_CHOICE" name="VisitorTimeOuts" oid="VisitorTimeOuts" precision="0" type="INT32" value="3" widget="radio-vertical">
    <constraint key="0">0</constraint>
    <constraint key="1">1</constraint>
    <constraint key="2">2</constraint>
    <constraint key="3">3</constraint>
    </param>
    <param access="1" constrainttype="INT_CHOICE" name="HomeTimeOuts" oid="HomeTimeOuts" precision="0" type="INT32" value="3" widget="radio-vertical">
    <constraint key="0">0</constraint>
    <constraint key="1">1</constraint>
    <constraint key="2">2</constraint>
    <constraint key="3">3</constraint>
    </param>
    <param access="1" constrainttype="INT_CHOICE" name="Distance" oid="Distance" precision="0" type="INT32_ARRAY" value="1" widget="default">
    <constraint key="1">Goal</constraint>
    <constraint key="2">Inches</constraint>
    <constraint key="3">1</constraint>
    <constraint key="4">2</constraint>
    <constraint key="5">3</constraint>
    <constraint key="6">4</constraint>
    <constraint key="7">5</constraint>
    <constraint key="8">6</constraint>
    <constraint key="9">7</constraint>
    <constraint key="10">8</constraint>
    <constraint key="11">9</constraint>
    <constraint key="12">10</constraint>
    <constraint key="13">11</constraint>
    <constraint key="14">12</constraint>
    <constraint key="15">13</constraint>
    <constraint key="16">14</constraint>
    <constraint key="17">15</constraint>
    <constraint key="18">16</constraint>
    <constraint key="19">17</constraint>
    <constraint key="20">18</constraint>
    <constraint key="21">19</constraint>
    <constraint key="22">20</constraint>
    <constraint key="23">21</constraint>
    <constraint key="24">22</constraint>
    <constraint key="25">23</constraint>
    <constraint key="26">24</constraint>
    <constraint key="27">25</constraint>
    <constraint key="28">Long</constraint>
    </param>
    <param access="1" constrainttype="INT_CHOICE" name="Downs" oid="Downs" precision="0" type="INT32" value="1" widget="combo">
    <constraint key="1">1st</constraint>
    <constraint key="2">2nd</constraint>
    <constraint key="3">3rd</constraint>
    <constraint key="4">4th</constraint>
    </param>
    <param access="1" maxlength="0" name="Visitor" oid="Visitor_Name" type="STRING" value="VISITOR" widget="text"/>
    <param access="1" maxlength="0" name="Home" oid="Home_Name" type="STRING" value="HOME" widget="text"/>
    <param access="1" constrainttype="STRING_CHOICE" maxlength="0" name="Period" oid="Period" type="STRING" value="F" widget="combo">
    <constraint>1st</constraint>
    <constraint>2nd</constraint>
    <constraint>H</constraint>
    <constraint>3rd</constraint>
    <constraint>4th</constraint>
    <constraint>F</constraint>
    <constraint>OT</constraint>
    <constraint>F/OT</constraint>
    </param>
    <param access="1" maxlength="0" name="IP" oid="IP" type="STRING" value="192.168.0.143" widget="text"/>
    <param access="1" maxlength="0" name="A" oid="A" type="STRING" value="" widget="label"/>
    </params>
    </meta>
    <abs height="39" id="Backplate" left="51" name="Backplate" style="bg#FFFFFF9E;" top="119" virtualheight="39" virtualwidth="1142" width="882">
    <abs height="112" left="406" top="-52" virtualheight="112" virtualwidth="6" width="6"/>
    </abs>
    <param expand="true" height="45" left="341" oid="HomeTimeOuts" style="size:Bigger;" top="246" width="232"/>
    <param expand="true" height="45" left="341" oid="VisitorTImeOuts" style="size:Bigger;bdr:etched;bdr#readonlyborder;o#darkdivider;" top="188" width="232"/>
    <param expand="true" height="29" left="816" oid="Distance" style="bg-eo:0x0;size:Biggest;font:bold;" top="125" width="88"/>
    <param height="29" left="746" oid="Downs" style="size:Biggest;font:bold;txt-align:center;" top="125" width="66"/>
    <param bottom="467" left="61" oid="Visitor_Name" right="1142" style="fg#FFFFFF;size:Bigger;bg#000000;font:bold;txt-align:center;bdr:etched;" top="189"/>
    <param expand="true" height="50" left="1096" oid="STATUS" style="bdr:none;" top="200" width="100"/>
    <param height="29" left="251" oid="Home_Name" style="fg#FFFFFF;size:Bigger;bg#000000;font:bold;txt-align:center;bdr:etched;" top="125" width="99"/>
    <param height="29" left="537" oid="Period" style="fg#darkdivider;font:bold;txt-align:center;bdr:none;size:Big;" top="125" width="66"/>
    <label height="33" id="VisitorTimeoutsRemaining" left="352" name="Visitor Timeouts Remaining" style="txt-align:center;font:bold;size:Bigger;" top="175" width="178"/>
    <label height="33" id="HomeTimeoutsRemaining" left="353" name="Home Timeouts Remaining" style="txt-align:center;font:bold;size:Bigger;" top="231" width="178"/>
    <button buttontype="push" height="45" left="49" name="CLEAR CH1" style="fg#FFFFFF;size:Big;bg#E30000;font:bold;txt-align:center;bdr:none;o#darkdivider;" top="244" width="133">
    <task tasktype="rosstalk">rosstalk.sendMessage(ogscript.getPrivateString('hosts', '127.0.0.1.host'), parseInt(ogscript.getPrivateString('hosts', '127.0.0.1.port')), 'CLFB 0');</task>
    </button>
    <button buttontype="push" height="44" id="BugOn" left="49" name="BUG ON/OFF" style="fg#000000;size:Big;bg#timerfg;font:bold;bdr:none;" top="186" width="133">
    <task tasktype="rosstalk">rosstalk.sendMessage(ogscript.getPrivateString('hosts', '127.0.0.1.host'), parseInt(ogscript.getPrivateString('hosts', '127.0.0.1.port')), 'TAKE 11:0:0');</task>
    </button>
    <button buttontype="push" height="37" id="1stAnd10" left="803" name="1st &amp; 10" style="size:Big;bg#F97600;font:bold;bdr:none;o#darkdivider;" top="71" width="133">
    <task tasktype="ogparamset">params.setValue('Downs', 0, 1);</task>
    <task tasktype="ogparamset">params.setValue('Distance', 0, 12);</task>
    </button>
    <param height="27" left="565" oid="IP" style="size:Bigger;bg-align:center;txt-align:center;bdr:etched;" top="55" width="202"/>
    <label height="20" left="565" name="IP ADDRESS" style="size:Big;txt-align:center;bdr:etched;" top="31" width="200"/>
    <table height="121" left="757" top="235" width="129">
    <tr>
    <button buttontype="push" colspan="1" fill="both" name="FLAG ON" rowspan="1" style="bg#F6F501;look:flat;font:bold;size:Bigger;o#darkdivider;" weightx="1.0" weighty="1.0">
    <task tasktype="rosstalk">rosstalk.sendMessage(ogscript.getPrivateString('hosts', '127.0.0.1.host'), parseInt(ogscript.getPrivateString('hosts', '127.0.0.1.port')), 'TAKE 3');</task>
    </button>
    </tr>
    <tr>
    <button buttontype="push" colspan="1" fill="both" name="FLAG OFF" rowspan="1" style="size:Bigger;font:bold;bg-fill:paint9;look:flat;bg#F30000;o#darkdivider;" weightx="1.0" weighty="1.0">
    <task tasktype="rosstalk">rosstalk.sendMessage(ogscript.getPrivateString('hosts', '127.0.0.1.host'), parseInt(ogscript.getPrivateString('hosts', '127.0.0.1.port')), 'TAKE 4');</task>
    </button>
    </tr>
    </table>
    <table height="32" left="707" top="180" width="227">
    <tr>
    <button buttontype="push" colspan="1" fill="both" name="DOWN &amp; DISTANCE COVER ON" rowspan="1" style="bg#timerfg;look:flat;size:Big;o#darkdivider;" weightx="1.0" weighty="1.0">
    <task tasktype="rosstalk">rosstalk.sendMessage(ogscript.getPrivateString('hosts', '127.0.0.1.host'), parseInt(ogscript.getPrivateString('hosts', '127.0.0.1.port')), 'TAKE 1');</task>
    </button>
    <button buttontype="push" colspan="1" fill="both" name="DOWN &amp; DISTANCE COVER OFF" rowspan="1" style="bg#F50A0A;look:flat;size:Big;o#darkdivider;" weightx="1.0" weighty="1.0">
    <task tasktype="rosstalk">rosstalk.sendMessage(ogscript.getPrivateString('hosts', '127.0.0.1.host'), parseInt(ogscript.getPrivateString('hosts', '127.0.0.1.port')), 'TAKE 2');</task>
    </button>
    </tr>
    </table>
    <meta>
    <params>
    <param access="1" maxlength="0" name="filename" oid="filename" type="STRING" value="sportzcast2.xml" widget="file-picker"/>
    <param access="1" maxlength="0" name="hscore" oid="hscore" type="STRING" value="0" widget="default"/>
    <param access="1" maxlength="0" name="vscore" oid="vscore" type="STRING" value="0" widget="default"/>
    <param access="1" maxlength="0" name="clock" oid="clock" type="STRING" value="0:00" widget="default"/>
    </params>
    </meta>
    <param expand="true" height="18" left="572" oid="filename" top="87" width="144"/>
    <button buttontype="push" height="18" id="Read" left="720" name="Read" top="87" width="41">
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("Hscore");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("hscore", 0, v);
    ogscript.rename("HScoreLabel", + v);</task>
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("Vscore");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("Vscore", 0, v);
    ogscript.rename("VScoreLabel", + v);</task>
    <task tasktype="ogscript">var file = params.getValue("filename", 0);
    var xml = ogscript.parseXML(file);
    var nodes = xml.getElementsByTagName("clock");
    var v = "--";
    if (nodes &amp;&amp; nodes.getLength() &gt; 0) {
    var n = nodes.item(0);
    if (n &amp;&amp; n.getFirstChild() != null) {
    v = ("" + n.getFirstChild().getNodeValue()).trim();
    }
    }
    params.setValue("clock", 0, v);
    ogscript.rename("ClockLabel", "" + v);</task>
    </button>
    <label height="29" id="HScoreLabel" left="356" name="HScore: --" style="txt-align:center;bdr:etched;size:Biggest;bg#000000;fg#FFFFFF;" top="125" width="73"/>
    <label height="29" id="VScoreLabel" left="165" name="VScore: --" style="txt-align:center;bdr:etched;size:Biggest;bg#000000;fg#FFFFFF;" top="125" width="73"/>
    <label height="29" id="ClockLabel" left="608" name="Clock: --" style="txt-align:center;bdr:etched;size:Biggest;bg#000000;fg#FFFFFF;" top="125" width="86"/>
    <label height="51" left="52" name="Football Controller" style="txt-align:center;font:bold;size:Biggest;o#000000;bg#tablezebra;bdr:etched;bdr#FFFFFF;" top="31" width="493"/>
    <param expand="true" height="29" left="55" oid="Visitor_Name" style="fg#FFFFFF;size:Bigger;bg#000000;font:bold;txt-align:center;bdr:etched;" top="125" width="105"/>
    </abs>



    ------------------------------
    Bob Ramsay
    Broadcast Engineer
    Memphis-Shelby County Schools
    ------------------------------



  • 6.  RE: ogScript for displaying XML value in Dashboard

    Posted 09-17-2025 16:27

    Nevermind, I figured it out. I just had to move the tasks from the "Read" button to a timer so it automatically refreshes the data. Thanks anyways.  



    ------------------------------
    Bob Ramsay
    Broadcast Engineer
    Memphis-Shelby County Schools
    ------------------------------