amartin Posted April 14, 2008 Share Posted April 14, 2008 I'm hoping someone will be able to help me with a script I've written using AutoIt v3. While setting up a wireless connection I need to select a certificate authority from a list of trusted root certification authorities. To get to the list, open the Wireless Network Connection Properties, click Add, click on the Authentication tab, select Protected EAP (PEAP) as the EAP type then select the Properties button. After clicking the Properties button the Protected EAP Properties window opens. In the middle of the window is the Trusted Root Certification Authorities box. The "AutoIt v3 Window Info" utility the class is listed as SysListView32 when I select the certification authorities box but no information is available as to the name of the individual check boxes. The certification authority I need is several entries down the list. I made my script work by having the script send Alt+R followed by several down arrow commands. This method will work provided the certification authority I need to select is always in the same position on the list. I would prefer to have the script look for certification authority by name. With the possibility of the certification authority being in a different position on the list I've start a second script which would open a specified wireless connection (the connection name never changes and would be written into the script) and go to the Trusted Root Certification Authorities box for me to review. In writing this script I ran into the same issue where I have to make a selection from a SysListView32 box. In this instance it's the Preferred networks box on the Wireless Networks tab within the Wireless Network Connection Properties window. Below is the part of my code to get to the certificate authorities window. Can any one suggest a way to select items ("workauth" in this example) by name from a SysListView32 box and possibly provide a code example? I'm hopeful that if I can get it working in this example I would then be able to apply it to the verification script. Then again if this can be made to select by name then I wouldn't need to do the verification script. Thanks to everyone who takes the time to read this. CODE;Open network connections and then the wireless nic properties Run ("control ncpa.cpl") ;opens the Network Connections window WinWaitActive("Network Connections") $nic = ControlListView("Network Connections", "", "SysListView321", "FindItem", "Wireless Network Connection") ;opens the Wireless Network Connection Properties ControlFocus("Network Connections", "", ControlListView("Network Connections", "", "SysListView321", "Select", $nic)) ;opens the Wireless Network Connection Properties Send("!{Enter}") ;opens the Wireless Network Connection Properties ControlCommand ( "Wireless Network Connection Properties", "", "SysTabControl321", "TabRight", "") ;selects the Wireless Networks tab ControlGetFocus ( "Wireless Network Connection Properties" ) ;Turn on Windows control of wireless card WinWait("Wireless Network Connection Properties", "General") WinActivate("Wireless Network Connection Properties", "General") WinWaitActive("Wireless Network Connection Properties", "General") ControlCommand("Wireless Network Connection Properties", "General", "SysTabControl321", "TabRight", "") ;selects the Wireless Networks tab If @error = 1 Then MsgBox(0, "AutoIt", "Control could not be found.") If WinWait("Wireless Network Connection Properties", "Wireless Networks", 1) = 1 Then WinActivate("Wireless Network Connection Properties", "Wireless Networks") WinWaitActive("Wireless Network Connection Properties", "Wireless Networks") ControlCommand("Wireless Network Connection Properties", "Wireless Networks", "Button1", "Check", "") ;checks the "Use Windows to configure my wireless..." box EndIf ;Wireless Network Connection Properties window - add connection WinWait("Wireless Network Connection Properties") WinActivate("Wireless Network Connection Properties") WinWaitActive("Wireless Network Connection Properties") ControlClick("Wireless Network Connection Properties", "Wireless Networks", "Button7") ;clicks the "Add" button for a new connection ;Wireless network properties window WinWait("Wireless network properties") WinActivate("Wireless network properties") WinWaitActive("Wireless network properties") Send("workwifi"); enters the SSID ControlCommand("Wireless network properties", "", 6029, "Check", "") ;checks the "Connect even if this network is not broadcasting" box ControlCommand("Wireless network properties", "", "ComboBox1", "SelectString", 'WPA') ;sets the network authentication to WPA ControlCommand("Wireless network properties", "", "ComboBox2", "SelectString", 'TKIP') ;sets the data encryption to TKIP ;Select Authentication tab and configure ControlCommand("Wireless network properties", "Authentication", "SysTabControl321", "TabRight", "") ;selects the "Authentication" tab ControlCommand("Wireless network properties", "Authentication", "ComboBox1", "SelectString", 'Protected EAP (PEAP)') ;sets the EAP type ControlClick("Wireless network properties", "Authentication", "Button2") ;clicks the "Properties" button ;Protected EAP properties, selects the certificate authority called "workauth" Send('{ALTDOWN}') ;selects the "Trusted Root Certification Authorities" window Send('{r}') ;selects the "Trusted Root Certification Authorities" window Send('{ALTUP}') ;selects the "Trusted Root Certification Authorities" window Send("{DOWN}") ;these scroll down to the "workauth" certificate authority Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{SPACE}") ;selects the "workauth" certificate authority Link to comment Share on other sites More sharing options...
covaks Posted April 14, 2008 Share Posted April 14, 2008 See if this works: expandcollapse popup#Include <GuiListView.au3> ;Open network connections and then the wireless nic properties Run ("control ncpa.cpl") ;opens the Network Connections window WinWaitActive("Network Connections") $nic = ControlListView("Network Connections", "", "SysListView321", "FindItem", "Wireless Network Connection") ;opens the Wireless Network Connection Properties ControlFocus("Network Connections", "", ControlListView("Network Connections", "", "SysListView321", "Select", $nic)) ;opens the Wireless Network Connection Properties Send("!{Enter}") ;opens the Wireless Network Connection Properties ControlCommand ( "Wireless Network Connection Properties", "", "SysTabControl321", "TabRight", "") ;selects the Wireless Networks tab ControlGetFocus ( "Wireless Network Connection Properties" ) ;Turn on Windows control of wireless card WinWait("Wireless Network Connection Properties", "General") WinActivate("Wireless Network Connection Properties", "General") WinWaitActive("Wireless Network Connection Properties", "General") ControlCommand("Wireless Network Connection Properties", "General", "SysTabControl321", "TabRight", "") ;selects the Wireless Networks tab If @error = 1 Then MsgBox(0, "AutoIt", "Control could not be found.") If WinWait("Wireless Network Connection Properties", "Wireless Networks", 1) = 1 Then WinActivate("Wireless Network Connection Properties", "Wireless Networks") WinWaitActive("Wireless Network Connection Properties", "Wireless Networks") ControlCommand("Wireless Network Connection Properties", "Wireless Networks", "Button1", "Check", "") ;checks the "Use Windows to configure my wireless..." box EndIf ;Wireless Network Connection Properties window - add connection WinWait("Wireless Network Connection Properties") WinActivate("Wireless Network Connection Properties") WinWaitActive("Wireless Network Connection Properties") ControlClick("Wireless Network Connection Properties", "Wireless Networks", "Button7") ;clicks the "Add" button for a new connection ;Wireless network properties window WinWait("Wireless network properties") WinActivate("Wireless network properties") WinWaitActive("Wireless network properties") Send("workwifi"); enters the SSID ControlCommand("Wireless network properties", "", 6029, "Check", "") ;checks the "Connect even if this network is not broadcasting" box ControlCommand("Wireless network properties", "", "ComboBox1", "SelectString", 'WPA') ;sets the network authentication to WPA ControlCommand("Wireless network properties", "", "ComboBox2", "SelectString", 'TKIP') ;sets the data encryption to TKIP ;Select Authentication tab and configure ControlCommand("Wireless network properties", "Authentication", "SysTabControl321", "TabRight", "") ;selects the "Authentication" tab ControlCommand("Wireless network properties", "Authentication", "ComboBox1", "SelectString", 'Protected EAP (PEAP)') ;sets the EAP type ControlClick("Wireless network properties", "Authentication", "Button2") ;clicks the "Properties" button $hListView = ControlGetHandle("Protected EAP Properties","","SysListView321") $iListViewItem = ControlListView("Protected EAP Properties","","SysListView321","FindItem","workauth") ControlFocus("Protected EAP Properties","","SysListView321") _GUICtrlListView_EnsureVisible($hListView, $iListViewItem) _GUICtrlListView_SetItemFocused($hListView, $iListViewItem) Send("{SPACE}") Link to comment Share on other sites More sharing options...
amartin Posted April 14, 2008 Author Share Posted April 14, 2008 I had to add the three lines below above this line of code ($hListView = ControlGetHandle("Protected EAP Properties","","SysListView321")) to make it work, but then it worked like a charm. WinWait("Protected EAP Properties") WinActivate("Protected EAP Properties") WinWaitActive("Protected EAP Properties") Thank you for your help! See if this works: expandcollapse popup#Include <GuiListView.au3> ;Open network connections and then the wireless nic properties Run ("control ncpa.cpl") ;opens the Network Connections window WinWaitActive("Network Connections") $nic = ControlListView("Network Connections", "", "SysListView321", "FindItem", "Wireless Network Connection") ;opens the Wireless Network Connection Properties ControlFocus("Network Connections", "", ControlListView("Network Connections", "", "SysListView321", "Select", $nic)) ;opens the Wireless Network Connection Properties Send("!{Enter}") ;opens the Wireless Network Connection Properties ControlCommand ( "Wireless Network Connection Properties", "", "SysTabControl321", "TabRight", "") ;selects the Wireless Networks tab ControlGetFocus ( "Wireless Network Connection Properties" ) ;Turn on Windows control of wireless card WinWait("Wireless Network Connection Properties", "General") WinActivate("Wireless Network Connection Properties", "General") WinWaitActive("Wireless Network Connection Properties", "General") ControlCommand("Wireless Network Connection Properties", "General", "SysTabControl321", "TabRight", "") ;selects the Wireless Networks tab If @error = 1 Then MsgBox(0, "AutoIt", "Control could not be found.") If WinWait("Wireless Network Connection Properties", "Wireless Networks", 1) = 1 Then WinActivate("Wireless Network Connection Properties", "Wireless Networks") WinWaitActive("Wireless Network Connection Properties", "Wireless Networks") ControlCommand("Wireless Network Connection Properties", "Wireless Networks", "Button1", "Check", "") ;checks the "Use Windows to configure my wireless..." box EndIf ;Wireless Network Connection Properties window - add connection WinWait("Wireless Network Connection Properties") WinActivate("Wireless Network Connection Properties") WinWaitActive("Wireless Network Connection Properties") ControlClick("Wireless Network Connection Properties", "Wireless Networks", "Button7") ;clicks the "Add" button for a new connection ;Wireless network properties window WinWait("Wireless network properties") WinActivate("Wireless network properties") WinWaitActive("Wireless network properties") Send("workwifi"); enters the SSID ControlCommand("Wireless network properties", "", 6029, "Check", "") ;checks the "Connect even if this network is not broadcasting" box ControlCommand("Wireless network properties", "", "ComboBox1", "SelectString", 'WPA') ;sets the network authentication to WPA ControlCommand("Wireless network properties", "", "ComboBox2", "SelectString", 'TKIP') ;sets the data encryption to TKIP ;Select Authentication tab and configure ControlCommand("Wireless network properties", "Authentication", "SysTabControl321", "TabRight", "") ;selects the "Authentication" tab ControlCommand("Wireless network properties", "Authentication", "ComboBox1", "SelectString", 'Protected EAP (PEAP)') ;sets the EAP type ControlClick("Wireless network properties", "Authentication", "Button2") ;clicks the "Properties" button $hListView = ControlGetHandle("Protected EAP Properties","","SysListView321") $iListViewItem = ControlListView("Protected EAP Properties","","SysListView321","FindItem","workauth") ControlFocus("Protected EAP Properties","","SysListView321") _GUICtrlListView_EnsureVisible($hListView, $iListViewItem) _GUICtrlListView_SetItemFocused($hListView, $iListViewItem) Send("{SPACE}") 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