Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2018
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Programatically accessing text displayed in a .NET application

    My company runs a proprietary piece of software which monitors remote two-way radio systems. I can't give too many details about it, but this monitoring software is a .NET GUI application which detects radio statuses (temperature, fan speed, RF module power state, etc.) and sends out e-mails when there is a problem.

    There is a big problem with this monitoring software which our vendor refuses to fix. The monitoring software stops "pinging" the remote radios on occasion, putting itself into a paused state without e-mailing anybody that anything is wrong. It will run for days or weeks in the "paused" state until anybody realizes it's not actually doing any monitoring.

    We have been forced to work around this poorly designed software in various ways. One way is that we use Nagios to ping the remote radios to see if they are online. This only gives us IP interface up/down status, not any details about what modules are and aren't working in the radio itself.

    The second way we have worked around the monitoring software's shortcomings is by developing a separate "watchdog" software which runs in the background. The watchdog ensures that the monitoring software's process is always running, and it also uses optical character recognition (tesseract) to read the text within the monitoring software's GUI which show the current state of the monitoring software. Paused, or Monitoring are the two states which it displays.

    OCR works, but only under perfect conditions. Windows must be rendering the console to a display; a screensaver or headless machine will make OCR fail. For that reason, I would like to do away with OCR, and instead access the text in the monitoring software another way. This is where I'm stumped.

    The watchdog program I created is written in AutoIt3. AutoIt has many functions for reading text within windows applications, however none of the relevant text in the monitoring software is visible to AutoIt.

    Are there alternate ways to reliably access text displayed within the monitoring software? Memory inspection libraries, etc?

  2. #2
    New to the CF scene
    Join Date
    Jul 2018
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I figured out a solution using an AutoIt Library, IUIAutomation.

    This library is able to read the text in question.


    ```AutoIt
    #include "contrib\UIAWrappers.au3"
    #include "contrib\CUIAutomation2.au3"
    AutoItSetOption("MustDeclareVars", 1)


    Local $oP1=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=MonitoringSoftware;controltype:=UIA_WindowControlTypeId;class:=[REGEXPCLASS:WindowsForms10\.Window\.8\.app\.0\..*]", $treescope_children)
    Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=statusStrip;controltype:=UIA_StatusBarControlTypeId;class:=[REGEXPCLASS:WindowsForms10\.Window\.8\.app\.0\..*]", $treescope_children)
    Local $oUIElement=_UIA_getObjectByFindAll($oP0, "ControlType:=UIA_TextControlTypeId", $treescope_subtree)
    Local $statusText = _UIA_action($oUIElement,"propertyvalue", "text")
    ```


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •