How to Select the "Local Area Connection" Item in Explorer
Keywords:
Question:
I want to select the "Local Area Connection" under "Network Connections" in Explorer. The problem is that some users may have more than simply Local Area Connection installed, so I need to make sure I click on the right item in the listbox.Any ideas?
Answer:
This will get you to the right selection, then you can use cSetTabItem, etc. to get the information out of the dialog boxes.Run("control.exe","ncpa.cpl") ;RoboScripter ; Made with ; RoboScripter ver: 29 ; CtlMgr ver: 20028 AddExtender("wwctl34i.dll") ;Title:;ID: 100 ;Class: SysTreeView32 ;Level: 4 window1=cWndByWndSpec("ExploreWClass","explorer",5,40965,9999,40961,0,0) window2=cWndByClass(window1,`BaseBar`) window3=cWndByID(window2,40965) ControlHandle=cWndByID(window3,100) cSetFocus(ControlHandle) ; Activates Window ;Title: FolderView ;ID: 1 ;Class: SysListView32 ;Level: 6 window1=cWndByWndSpec("ExploreWClass","explorer",5,40965,9999,40961,0,0) window2=cWndByClass(window1,`SHELLDLL_DefView`) window3=cWndByID(window2,0) window4=cWndByID(window3,0) window5=cWndByID(window4,0) ControlHandle=cWndByID(window5,1) ; Get the labels from the first column of each row in the control. wintext = cgetlvtext(ControlHandle) ;Get the index of the item myitem="Local Area Connection" select1=ItemLocate(myitem, wintext, @tab) Message("Position of Local Area Connection on List",select1) if select1 cSetLVitem(ControlHandle,select1) ;Set a SysListView32 item result=cGetLVSelText(ControlHandle) ;Get SysListView32 Selected text Message("Selected Text",StrReplace(result,@tab,@crlf)) ;TODO - Remove Message. Add code Endif