walle Posted February 10, 2008 Share Posted February 10, 2008 (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... expandcollapse popup#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 February 10, 2008 by walle Link to comment Share on other sites More sharing options...
walle Posted February 11, 2008 Author Share Posted February 11, 2008 Ah, it is a limitation within Utorrent. The interface won't update when minimized. Link to comment Share on other sites More sharing options...
Bert Posted February 11, 2008 Share Posted February 11, 2008 will it update with the window hidden? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
walle Posted February 11, 2008 Author Share Posted February 11, 2008 (edited) will it update with the window hidden?That would probably work. But you won'tbe able to work with utorrent. If the useradds 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 February 11, 2008 by walle Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now