ultim Posted March 1, 2010 Share Posted March 1, 2010 Hi, i have some trouble with this simple script: $Title = "[CLASS:WindowsForms10.window.8.app.0.378734a]" $listview_test = "[CLASS:WindowsForms10.window.8.app.0.378734a4]" $ItemsNo = ControlListView ($Title,"",$listview_test,"GetItemCount") MsgBox(1,"Item Selected ", $ItemsNo) The value returns 0 while there are actually 14 items in the list. What am i doing wrong? Doesn't AutoIt work with the List view of Windows Forms? Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 1, 2010 Share Posted March 1, 2010 Try it this way, and post what you get: #Include <GuiListView.au3> Global $Title = "[CLASS:WindowsForms10.window.8.app.0.378734a]" Global $listview_test = "[CLASS:WindowsForms10.window.8.app.0.378734a4]" Global $hWnd = WinGetHandle($Title) ConsoleWrite("$hWnd = " & $hWnd & @LF) Global $hLV = ControlGetHandle($hWnd, "", $listview_test) ConsoleWrite("$hLV = " & $hLV & @LF) Global $ItemsNo = _GUICtrlListView_GetItemCount($hLV) ConsoleWrite("$ItemsNo = " & $ItemsNo & @LF) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ultim Posted March 5, 2010 Author Share Posted March 5, 2010 Here is what i get from that script: $hWnd = 0x00040916 $hLV = $ItemsNo = 0 Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 5, 2010 Share Posted March 5, 2010 Is that "4" on the end of the control ID actually part of the class name, or an instance number? Maybe it was supposed to be: "[CLASSNN:WindowsForms10.window.8.app.0.378734a4]" Or: "[CLASS:WindowsForms10.window.8.app.0.378734a; INSTANCE:4]" Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ultim Posted March 5, 2010 Author Share Posted March 5, 2010 It's indeed instance number 4, so i changed the code, getting the following output: $hWnd = 0x00020A6E $hLV = 0x00030A82 $ItemsNo = 0 But at the moment of running the script, there are actually 22 items in that list as i've counted by hand. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 5, 2010 Share Posted March 5, 2010 Well, a step closer. Got the window handle and the control handle. Which code did you use to get the count, ControlListView() or _GUICtrlListView_GetItemCount()? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ultim Posted March 5, 2010 Author Share Posted March 5, 2010 (edited) #Include <GuiListView.au3> Global $Title = "[CLASS:WindowsForms10.window.8.app.0.378734a]" Global $listview_test = "[CLASS:WindowsForms10.window.8.app.0.378734a; INSTANCE:4]" Global $hWnd = WinGetHandle($Title) MsgBox(0, "Test", "$hWnd = " & $hWnd & @LF) Global $hLV = ControlGetHandle($hWnd, "", $listview_test) MsgBox(0, "Test", "$hLV = " & $hLV & @LF) Global $ItemsNo = _GUICtrlListView_GetItemCount($hLV) MsgBox(0, "Test", "$ItemsNo = " & $ItemsNo & @LF) This code leads to: $hWnd = 0x00020A6E $hLV = 0x00030A82 $ItemsNo = 0 So that's the function _GUICtrlListView_GetItemCount() Edited March 5, 2010 by ultim Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 5, 2010 Share Posted March 5, 2010 Rats. That indicates it's not a Windows API ListView control, but rather a custom class that AutoIt isn't going to be able to do anything with. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ultim Posted March 5, 2010 Author Share Posted March 5, 2010 I used to work with AutoHotkey, which didn't support it. Then i moved to AutoIt for getting around this specific problem... so it seems this is going to be a dead end also 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