Jump to content

ControlListView, Read data from minimized window?


walle
 Share

Recommended Posts

Posted Image

The labels won't update if utorrent is minimized or lost

focus. Any idea how to solve the problem?

Do
$rows = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetItemCount", "")
$columns = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetSubItemCount", "")
$file = FileOpen( @HomeDrive & "\Temp\IMG" & "\temptorrent.txt", 2 )

For $i = 0 To $rows -1
    $data = ""
    For $r = 1 To 10
        If $r <> 1 Then
            If $r = 10 Then
                $data = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetText", $i, $r)
                If $data = "" Then $data = "N/A"
                If $data = "8" Then $data = "Forever"
            Else
                $data = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetText", $i, $r) & "|"
                If $data = "|" Then $data = "N/A"
                If $data = "8|" Then $data = "Forever|"
            EndIf
            FileWrite( $file, $data )
        EndIf
    Next
    FileWriteLine( $file, "¶" )
Next
FileClose( $file )
;ConsoleWrite(FileRead( @HomeDrive & "\Temp\IMG" & "\temptorrent.txt" ) )
;ConsoleWrite( @CRLF & StringLen( FileRead( @HomeDrive & "\Temp\IMG" & "\temptorrent.txt" ) ) )

$myData = FileReadLine(@HomeDrive & "\Temp\IMG" & "\temptorrent.txt",$KORV +1)
$myArray = StringSplit($myData, "|")
;msgbox(0,"",$myArray [1])

GUICtrlSetData($TORRENT,"Status:" & ' ' & $myArray [3])
GUICtrlSetData($LABEL4,"Done:" & ' ' & $myArray [2])
GUICtrlSetData($LABEL1,"Seeds:" & ' ' & $myArray [4])
GUICtrlSetData($LABEL5,"Peers:" & ' ' & $myArray [5])
GUICtrlSetData($LABEL11,"Down speed:" & ' ' & $myArray [6])
If $myArray [6] > 100 Then
    GUICtrlSetData($LABEL10,"ETA:" & ' ' & $myArray [8])
    Else
    GUICtrlSetData($LABEL10,"ETA:")
EndIf
$TEEEEEEST = StringTrimRight($myArray [2],4)

 
    sleep(2000)
Until $TEEEEEEST = 100
Edited by walle
Link to comment
Share on other sites

  • 1 month later...

Hi,

Try to replace all instanse of "µTorrent 1.7.5" with "[REGEXPTITLE:Torrent \d+.*]"

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi,

Try to replace all instanse of "µTorrent 1.7.5" with "[REGEXPTITLE:Torrent \d+.*]"

Hey, thanks for your effort.

Tried to replace the title with [REGEXPTITLE:Torrent \d+.*] but unsuccessfully, It didn't work out

Even if I change the title with [REGEXPTITLE:Torrent \d+.*] it cant read SysListView321 when utorrent is minimized.

$HWND1 = ControlGetHandle("[REGEXPTITLE:Torrent \d+.*]", "", "SysListView321")

Do
$rows = _GUICtrlListView_GetItemCount($HWND1)
$columns = ControlListView($HWND, "", "SysListView321", "GetSubItemCount", "")
$file = FileOpen( @TempDir & "\temptorrent.txt", 2 )

For $i = 0 To $rows -1
    $data = ""
    For $r = 1 To 10
        If $r <> 1 Then
            If $r = 10 Then
                $data = _GUICtrlListView_GetItemText($HWND1, $i, $r)
                If $data = "" Then $data = "N/A"
                If $data = "8" Then $data = "Forever"
            Else
                $data = _GUICtrlListView_GetItemText($HWND1, $i, $r) & "|"
                If $data = "|" Then $data = "N/A"
                If $data = "8|" Then $data = "Forever|"
            EndIf
            FileWrite( $file, $data )
        EndIf
    Next
    FileWriteLine( $file, "¶" )
Next
FileClose( $file )

$myData = FileReadLine(@TempDir & "\temptorrent.txt",$KORV +1)
$myArray = StringSplit($myData, "|")


GUICtrlSetData($TORRENT,"Status:" & ' ' & $myArray [3])
GUICtrlSetData($LABEL4,"Klart:" & ' ' & $myArray [2])
GUICtrlSetData($LABEL1,"Källor:" & ' ' & $myArray [4])
GUICtrlSetData($LABEL5,"Klienter:" & ' ' & $myArray [5])
GUICtrlSetData($LABEL11,"Nedl-Hastighet:" & ' ' & $myArray [6])
$TEEEEEEST = StringTrimRight($myArray [2],4)

 
    sleep(2000)
Until $TEEEEEEST = 100
Link to comment
Share on other sites

it can’t read SysListView321 when utorrent is minimized.

I think you are confusing here something... Afair, by default uTorrent is minimized to system tray, so the main window is hidden, not minimized :D

But even if it hidden, you still can read the list view, here is a test that works with my uTorrent:

$Items_Cuont = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetItemCount")
$SubItems_Cuont = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetSubItemCount")

MsgBox(64, "Count", _
    "Total Items in ListView: " & $Items_Cuont & @LF & _
    "Total SubItems in ListView: " & $SubItems_Cuont)

See if it's work for you.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I think you are confusing here something... Afair, by default uTorrent is minimized to system tray, so the main window is hidden, not minimized :D

But even if it hidden, you still can read the list view, here is a test that works with my uTorrent:

$Items_Cuont = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetItemCount")
$SubItems_Cuont = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetSubItemCount")

MsgBox(64, "Count", _
    "Total Items in ListView: " & $Items_Cuont & @LF & _
    "Total SubItems in ListView: " & $SubItems_Cuont)

See if it's work for you.

It's surprising, your script worked perfectly, even when the window is hidden.

Any idea why (my script) stops reading SysListView321 when Utorrent is hidden?

If I hide Utorrent and then maximize the window it continues read and update the labels.

Link to comment
Share on other sites

Any idea why (my script) stops reading SysListView321 when Utorrent is hidden?

I can not tell, because your code is not complete, you probably should check returned values from ControlListView(...) and other data-related actions, i sure the problem is in the methods of getting data :D

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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...