Facility Control

 View Only
  • 1.  Read and Display Text From File in DashBoard

    Posted 08-23-2022 17:00
    This is probably a silly question, but is there a way for DashBoard to read/import a file and display just the text contents? Perhaps through OGscript?

    The files I have are production flow scripts in the DOCX format (but they can be converted to other formats if needed).

    #DashBoard

    ------------------------------
    Nick Kubinski
    ------------------------------


  • 2.  RE: Read and Display Text From File in DashBoard

    Posted 11-02-2022 14:47
    Hi Nick
    This is simple to do with plain text files with ogscript.asyncPost and providing the file URL (or just the filename if it is in the same folder as the CustomPanel):
    <abs contexttype="opengear" id="_top" keepalive="false" style="">
       <meta>
          <params>
             <param access="1" maxlength="0" name="Multi-Line Text" oid="MultiLine_Text" type="STRING" value="" widget="multiline-text"/>
          </params>
       </meta>
       <param expand="true" height="335" left="39" oid="MultiLine_Text" scroll="vertical" top="62" width="657"/>
    <button buttontype="push" height="41" left="43" name="Read text.txt" top="16" width="651">
          <task tasktype="ogscript">ogscript.asyncPost('text.txt', null, function(result)
    {
       params.setValue('MultiLine_Text', 0, result);
    });
    </task>
       </button>
    </abs>
    ​


    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 3.  RE: Read and Display Text From File in DashBoard

    Posted 11-07-2022 17:16
    Thank you very much James! That worked.

    I have an additional question. If I wanted to change the text color based on the text displayed, how would I go about that? I'm specifically trying to "highlight" a certain recurring sentence in the text document.

    ------------------------------
    Nick Kubinski
    ------------------------------



  • 4.  RE: Read and Display Text From File in DashBoard

    Posted 11-08-2022 09:11
    If you just want to display, you may want to switch from the multi-line text to the rich text display or just a label with HTML-based content. This will give you the ability to use HTML tags to set the size, color, and weight for your fonts.

    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 5.  RE: Read and Display Text From File in DashBoard

    Posted 11-08-2022 09:17
    Here is a modified/quick example:
    <abs contexttype="opengear" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" maxlength="0" name="Multi-Line Text" oid="MultiLine_Text" type="STRING" value="" widget="html-text"/>
          </params>
       </meta>
       <param expand="true" height="335" left="39" oid="MultiLine_Text" scroll="vertical" top="62" width="657"/>
       <button buttontype="push" height="41" left="43" name="Read text.txt" top="16" width="651">
          <task tasktype="ogscript">ogscript.asyncPost('text.txt', null, function(result)
    {
       params.setValue('MultiLine_Text', 0, '&lt;html&gt;&lt;pre&gt;' + result + '&lt;/pre&gt;&lt;/html&gt;');
    });</task>
       </button>
    </abs>
    ​


    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------