Search the Community
Showing results for tags 'controllistview'.
-
So am reading a ControlListView() and is not working so I code a troubleshooter to figure it out. #AutoIt3Wrapper_UseX64=n #include <Array.au3> ; Remarks: ( from the help file ) ; ------------------------------------------------------------------------------------------------ ; Some commands may fail when using a 32-bit AutoIt process to read from a 64-bit process. ; Likewise commands may fail when using a 64-bit AutoIt process to read from a 32-bit process. Global $g_sAutoIt3Path = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) If StringInStr($CmdLineRaw, "/GuiListviewToReadFrom") Then Exit GuiListviewToReadFrom() ShellExecute($g_sAutoIt3Path & "AutoIt3.exe", '"' & @ScriptFullPath & '" /GuiListviewToReadFrom') ;~ ShellExecute($g_sAutoIt3Path & "AutoIt3_x64.exe", '"' & @ScriptFullPath & '" /GuiListviewToReadFrom') Test() Func Test() Local $vRet = ReadTheListViewFromSomewhere() If @error And @error < 5 Then MsgBox(262144, @ScriptName, "Fail #:" & @error & @CR & $vRet, 10) Else _ArrayDisplay($vRet, 'Error: ' & @error & " - " & _ (@AutoItX64 ? "64-bit" : "32-bit") & " - " & _ @ScriptName, "", 0, Default, "Row A|Row B|Row C") EndIf WinClose("GuiListviewToReadFrom - ") EndFunc ;==>Test Func GuiListviewToReadFrom() Opt("TrayIconHide", 1) Local $iW = 400, $iH = 100, $sXbit = (@AutoItX64 ? "64-bit" : "32-bit") Local $hGui = GUICreate("GuiListviewToReadFrom - " & $sXbit, $iW, $iH) Local $idListview = GUICtrlCreateListView("Row A|Row B|Row C", 0, 0, $iW, $iH) GUICtrlCreateListViewItem("0-A|0-B|0-C", $idListview) GUICtrlCreateListViewItem("1-A|1-B|1-C", $idListview) GUICtrlCreateListViewItem("2-A|2-B|2-C", $idListview) GUISetState() While GUIGetMsg() <> -3 WEnd GUIDelete() EndFunc ;==>GuiListviewToReadFrom Func ReadTheListViewFromSomewhere($sTitle = "GuiListviewToReadFrom - ", $sLvCtrl = "SysListView321") If Not WinWait($sTitle, "", 3) Then Return SetError(1, 0, "Window not found") Local $hWin = WinGetHandle($sTitle) If @error Then Return SetError(2, 0, "No WinHandle") Local $n, $iItemCount = ControlListView($hWin, "", $sLvCtrl, "GetItemCount") If @error Then Return SetError(3, 0, "No ItemCount") Local $m, $iSubItemCount = ControlListView($hWin, "", $sLvCtrl, "GetSubItemCount") If @error Then Return SetError(4, 0, "No SubItemCount") Local $aArray[$iItemCount][$iSubItemCount] For $n = 0 To $iItemCount - 1 For $m = 0 To $iSubItemCount - 1 $aArray[$n][$m] = ControlListView($hWin, "", $sLvCtrl, "GetText", $n, $m) If @error Then Return SetError(5, 0, $aArray) ; "No ItemText") Next Next Return $aArray EndFunc ;==>ReadTheListViewFromSomewhere Did not need to do this.
-
Hi all, I've been search all around this forum for a solution, but so far haven't been able to find one. So I thought I'd explain it as good as possible and ask here for your views on the issue. Situation: I'm trying to automatically (on first run of a newly installed PC for our customers) open the adapter properties of a specific network adapter and then disable all protocols except TCP/IP V4. This is needed for specific functionality with hardware connected to this adapter. I am aware of most of the existing tools (wmic/netsh/devcon/...) to interfere with network adapters, but apart from a WHOLE lot of work in the registry, automating the checkmarks in the properties window should be the fastest solution. System is Windows 10 64-Bit and I've compiled the application as a x64-executable (since I know from the past that the choice between 32- and 64-bit can have consequences for interaction with SysListViews). Let's suppose the adapter is called "ADAPTERXX" (I am aware that my screenshot shows FUJIFILM, but that's from my own PC) Problem: I am perfectly able to automatically open the properties window of the correct adapter using the following code (I know the sending of the keystrokes can be programmed in a little loop, no worries, I'll get to this a little later, this is just a quick draft)... ShellExecute("control.exe","ncpa.cpl",@WindowsDir,"",@SW_SHOW) WinWait("Network Connections","") WinActivate("Network Connections","") WinWaitActive("Network Connections","") Send("{F5}") Sleep(250) BlockInput(1) Send("{A}") Send("{D}") Send("{A}") Send("{P}") Send("{T}") Send("{E}") Send("{R}") Send("{X}") Sleep(500) Send("{APPSKEY}") Sleep(100) Send("{R}") Local $ListWindow = WinWaitActive("ADAPTERXX Properties","") When I arrive in this window, I can detect which specific options has which specific ID in the SysListView32-instance by using: ControlListView("ADAPTERXX Properties","","[CLASSNN:SysListView321]","FindItem","Client for Microsoft Networks") But then, I can't control the checkmark in front of the text and the icon... I've tried lots of solutions. I've tried checking the state, but this next command always returns 'True' Local $GHandle = ControlGetHandle("ADAPTERXX Properties","","[CLASSNN:SysListView321]") MsgBox(0,"Is Item3 checked?",_GUICtrlListView_GetItemChecked($GHandle,3)) I've tried selecting or deselecting, but no result... ControlListView("FUJIFILM Properties","","[CLASSNN:SysListView321]","Deselect",$List_CMN) Creating an array of the window returns an empty array Local $ListArray = _GUICtrlListView_CreateArray($GHandle,Default) If anyone has any ideas, please shoot. It's also something that anyone can try at home with their own 'network properties', just change the ADAPTERXX to another name and the code to select the right adapter in the network connections window (all the little keystrokes). I'm open to any and all suggestions, I'm just at the end of my wits here... Thanks in advance! Jan
- 2 replies
-
- syslistview32
- syslistview
-
(and 2 more)
Tagged with:
-
I am trying to get the Text of given item in controllistview object (SysListView32). ControlListView("Select", "", "[CLASS:SysListView32; INSTANCE:1]", "Select",0,0) This statement is selecting the item but below statement is not getting the text of the item. It is returning item no not text. $txtItem = ControlListView("Select", "", "[CLASS:SysListView32; INSTANCE:1]", "GetText",0) Let me know if I am missing anything here.
-
Hi Guys, I am writing a script that will check a set of folders to populate a list with available data. Here is how i create the liveview: $listview = GUICtrlCreateListView("", 10, 30, 330, 250) _GUICtrlListView_InsertColumn($listview, 0, "Client Name", 160) _GUICtrlListView_InsertColumn($listview, 1, "Available P11D Data", 160) If FileExists($Location & "2005-2006\P11DDATA.MDB") Then GUICtrlCreateListViewItem($Client & "|2005-2006", $listview) EndIf If FileExists($Location & "2006-2007\P11DDATA.MDB") Then GUICtrlCreateListViewItem($Client & "|2006-2007", $listview) EndIf Next here i want to select one of the list view items and when i click open it will run the relevant command. GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() Do $msg = GUIGetMsg() If $msg = $open Then $iSelect = ControlListView($hGUI, "", $listview, "GetSelected") If $iSelect = "" Then MsgBox(0, "ERROR!", "No data selected, the program will now exit.") Exit EndIf If $iSelect = 0 Then Run('"C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" /runtime /wrkgrp "' & $Location & '2005-2006\P11D.mdw" "' & $Location & '2005-2006\P11DSys.mdb"') EndIf If $iSelect = 1 Then MsgBox(0, "Pretend Run", "2006-2007") EndIf The problem i am having is with this line: $iSelect = ControlListView($hGUI, "", $listview, "GetSelected") Depending on which item is seleted it flags it using a 0, 1, 2 onwards where as i want it to get the text from the list view because if all the data doesnt exists the numbers are not in the correct order so it will run the wrong command. I have tried GetText but either i dont understand the syntax so am doing it wrong or it just doesnt work (most likely the first :-() Can anyone help? Thank you P.S. If anyone can identify why this line doesnt work properly that would be appreciated: If $iSelect = "" Then MsgBox(0, "ERROR!", "No data selected, the program will now exit.") Exit EndIf If i dont have the "Exit" command it automatically launches the next command down which it shouldnt as that isnt selected!