WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Control Manager
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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.

Any ideas?

Answer:

I would recommend using the Roboscripter to help generate the code for you. The code will be slightly different for each Windows platform


For Windows XP
;Designed for Windows XP
; This code launches the Network Connections dialog, right clicks on the Local Area Connection icon 
; which launches the Local Area Connection Properties, selects 'Internet Protocol (TCP/IP)' from the list


Run("control.exe","ncpa.cpl") 
ret = WinWaitExist("Network Connections", 20)
if ret == @false 
	message("Could not locate","Network Connections")
	exit
endif

;RoboScripter
; Made with 
;   RoboScripter ver: 29
;   CtlMgr ver: 20028
AddExtender("wwctl34i.dll")

;Title: FolderView
;ID: 1
;Class: SysListView32
;Level: 3
window1=cWndByWndSpec("CabinetWClass","explorer",4,40965,9999,40961,0)
window2=cWndByClass(window1,`SHELLDLL_DefView`)
ControlHandle=cWndByClass(window2,`SysListView32`)
cSetFocus(ControlHandle)  ; Activates Window
wintext=cGetLVText(ControlHandle)     ;Get first column of SysLsitView32 text
;Get the index of the item
myitem="Local Area Connection"
select1=ItemLocate(myitem, wintext, @tab)
if select1
   cSetLVitem(ControlHandle,select1)     ;Set a SysListView32 item 
else
  Message(myitem,"Doesn't Exist")
  exit
endif
;right click and select properites
Sendkey("+{F10}r")

ret = WinWaitExist("Local Area Connection Properties", 10)
if ret == @false 
	message("Could not locate","Local Area Connection Properties")
	exit
endif

;Select general tab
window1=cWndByWndSpec("#32770","explorer",6,0,1,2,12321,9,12320)
ControlHandle=cWndByID(window1,12320)
result=cSetTABItem(ControlHandle,1)     ;Sets a Tabbed dialog item


;Title: 
;ID: 15007
;Class: SysListView32
;Level: 3
window1=cWndByWndSpec("#32770","explorer",6,0,1,2,12321,9,12320)
window2=cWndByName(window1,`General~`)
ControlHandle=cWndByID(window2,15007)
wintext=cGetLVText(ControlHandle)     ;Get first column of SysLsitView32 text


;Get the index of the item
myitem="Internet Protocol (TCP/IP)"
select1=ItemLocate(myitem, wintext, @tab)
if select1
   cSetLVitem(ControlHandle,select1)     ;Set a SysListView32 item 
else
  Message(myitem,"Doesn't Exist")
  exit
endif
exit

For Windows 2000
;Designed for Windows 2000
; This code launches the 'Network and Dial-up Connections'dialog, selecta the 'Local Area Connection' icon 
; from the list which launches the 'Local Area Connection Properties' dialog, selects 'Internet Protocol (TCP/IP)' 



Run("control.exe","ncpa.cpl") 

ret = WinWaitExist("Network and Dial-up Connections", 20)
if ret == @false 
	message("Could not locate","Network and Dial-up Connections")
	exit
endif
;RoboScripter
; Made with 
;   RoboScripter ver: 29
;   CtlMgr ver: 20028
AddExtender("wwctl34i.dll")

;Title: 
;ID: 1
;Class: SysListView32
;Level: 3
window1=cWndByWndSpec("ExploreWClass","Explorer",5,40965,9999,40961,0,0)
window2=cWndByClass(window1,`SHELLDLL_DefView`)
ControlHandle=cWndByClass(window2,`SysListView32`)
cSetFocus(ControlHandle)  ; Activates Window
wintext=cGetLVText(ControlHandle)     ;Get first column of SysLsitView32 text

;Get the index of the item
myitem="Local Area Connection"
select1=ItemLocate(myitem, wintext, @tab)
if select1
   cSetLVitem(ControlHandle,select1)     ;Set a SysListView32 item 
else
  Message(myitem,"Doesn't Exist")
  exit
endif
;right click and select properites
Sendkey("+{F10}r")

ret = WinWaitExist("Local Area Connection Properties", 10)
if ret == @false 
	message("Could not locate","Local Area Connection Properties")
	exit
endif



;Title: 
;ID: 15007
;Class: SysListView32
;Level: 3
window1=cWndByWndSpec("#32770","Explorer",6,0,1,2,12321,9,12320)
window2=cWndByName(window1,`General~`)
ControlHandle=cWndByClass(window2,`SysListView32`)
wintext=cGetLVText(ControlHandle)     ;Get first column of SysListView32 text

;Get the index of the item
myitem="Internet Protocol (TCP/IP)"
select1=ItemLocate(myitem, wintext, @tab)
if select1
   cSetLVitem(ControlHandle,select1)     ;Set a SysListView32 item 
else
  Message(myitem,"Doesn't Exist")
  exit
endif

exit

Article ID:   W15395
File Created: 2017:07:28:13:58:27
Last Updated: 2003:07:16:11:55:14