Sign in to follow this  
Followers 0
walle

Struggling with data collection of an minimized window

4 posts in this topic

#1 ·  Posted (edited)

I'm struggling with Utorrent and data collection, This is the second time I have rewritten the code,

but still, it won't work properly. It works great with Utorrent until you

minimize the window, then it wont collect the data anymore.

If you start the script when Utorrent is minimized it will collect the data once,

but thats it.

Anyway, here is the code, You can try it out, just input

the name of a current active torrent in Utorrent and press

start.

Btw, the loop dosn't work properly, the label can

never turn 100...

#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <String.au3>
#include <Array.au3>
#RequireAdmin


GUICreate("My GUI")  ; will create a dialog box that when displayed is centered

$LABEL4 = GUICtrlCreateLabel("Label",0,0,500)
$LABEL1 = GUICtrlCreateLabel("Label",0,20,500)
$LABEL5 = GUICtrlCreateLabel("Label",0,40,500)
$LABEL11 = GUICtrlCreateLabel("Label",0,60,500)
$Input = GUICtrlCreateInput("Torrent name",0,100,500)
$button = GUICtrlCreateButton("Start Script",0,120)
GUISetState (@SW_SHOW)       ; will display an empty dialog box



While 1
    $msg = GUIGetMsg()
    If $MSG = $button Then
        $Readinput = GUICtrlRead($Input)
        Collectdata()
        EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func Collectdata()
Do
$title = "[REGEXPTITLE:Torrent.\d+.*$]"
$listcontrol = "[CLASSNN:SysListView321]"

$hWnd = ControlGetHandle( $title, "", $listcontrol )
$header_hWnd = _GUICtrlListView_GetHeader($hWnd)

$FindTN = _GUICtrlListView_FindInText($HWND, $Readinput)
$ccount = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetSubItemCount")
$icount = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetItemCount")



Dim $listarray[$ccount][$icount+1]
For $c = 0 To $ccount-1
    $listarray[$c][0] = _GUICtrlListView_GetItemText($header_hWnd, $c)
   $Countmore = $icount - $FindTN
   For $i = $FindTN To $icount-$Countmore
        $itemtext = _GUICtrlListView_GetItemText($hWnd, $i, $c)
        $listarray[$c][$i+1] = $itemtext
    Next
Next
For $c = 0 To $ccount-1
    ConsoleWrite($listarray[$c][0])
    For $i = 0 To $icount-1
        ConsoleWrite($listarray[$c][$i+1])
    Next
    ConsoleWrite("|")
Next




For $c = 0 To $ccount-1
    $tmp = ''
    For $i = 0 To $icount-1
        $tmp &= $listarray[$c][$i+1]
    Next
    Switch $c
        Case 0
            GUICtrlSetData($LABEL4,"Torrent name:" & ' ' & $listarray[$c][0] & $tmp)
        Case 2
            GUICtrlSetData($LABEL1,"Size:" & ' ' & $listarray[$c][0] & $tmp)
        Case 4
            GUICtrlSetData($LABEL5,"Statusr:" & ' ' & $listarray[$c][0] & $tmp)
        Case 7
            GUICtrlSetData($LABEL11,"Downloadspeed:" & ' ' & $listarray[$c][0] & $tmp)
    EndSwitch
Next
sleep(1000)
Until $LABEL11 = 100
EndFunc
Edited by walle

Share this post


Link to post
Share on other sites



Ah, it is a limitation within Utorrent.

The interface won't update when minimized.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

will it update with the window hidden?

That would probably work. But you won't

be able to work with utorrent. If the user

adds a new torrent while downloading

the other primary one it will once again

stop refreshing, if the user

minimizes the window.

Edit: True, it updated while the window was hidden.

Is memory reading a option?

Edited by walle

Share this post


Link to post
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
Sign in to follow this  
Followers 0