Jump to content

Need help getting elapsed time from a static control


Recommended Posts

So there's a timer/counter inside a program that I use at work that is a static control.  With AU3info it just reads the control as 999:99:99. Is there a way I can read the actual timer? Here's the control's info:

>>>> Window <<<<

Title: Title

Class: Afx:00400000:b:00010003:00000006

Position: -8, -8

Size: 1296, 1000

Style: 0x15CFC000

ExStyle: 0x00000100

Handle: 0x000205E4

>>>> Control <<<<

Class: Static

Instance: 32

ClassnameNN: Static32

Name:

Advanced (Class): [CLASS:Static; INSTANCE:32]

ID: 10011

Text: REC

Position: 472, 28

Size: 74, 24

ControlClick Coords: 11, 11

Style: 0x50020001

ExStyle: 0x00000004

Handle: 0x0001065A

>>>> Visible Text <<<<

Elapsed

999:99:99

Remaining

999:99:99

 

Link to comment
Share on other sites

Autoit can read and send data to certain dll/Com objects. That being said you might be better off using and OCR solution to read a timer and convert it to text and then compare the numbers generated. It's tricky and make no mistake not very reliable.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

Try using this, and submit the output...make sure your window is active:

#include <WinAPI.au3>
#include <array.au3>
Sleep(5000)
Var_GetAllWindowsControls2("[ACTIVE]")

#include <WinAPI.au3>
#include <Array.au3>
$hWin = WinGetHandle("Title")
Var_GetAllWindowsControls2($hWin)
Func Var_GetAllWindowsControls2($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Loop
    Local $iCurrentClass = "", $iCurrentCount = 1, $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)
        If IsArray($aPos) Then
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $text & "]." & @CRLF)
        Else
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next
EndFunc
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...