|
楼主 |
发表于 2009-11-5 10:15:19
|
显示全部楼层
谢谢楼上帮助!我就是通过 vista的 netsh wlan 命令后才有了这个想法!!!
楼上您测试是这段吗:
;Assign variables
$ssid = ('Self Explanatory')
$auth = ('Authentication mode here')
$encrypt = ('Encryption style here')
$NetKey = ('And just what is your password?')
; Setting the advanced setting in Network Properties
Run(@ComSpec & " /c " & 'ncpa.cpl', "C:\WINDOWS\system32\dllcache", @SW_HIDE)
;Open the Network Connections dialog and activate the properties page of the Wireless Network Connection
WinWait ( 'Network Connections')
if NOT WinActive ( 'Network Connections') then
WinActivate ( 'Network Connections')
endif
WinWaitActive ( 'Network Connections')
Send('wireless')
send ('{Appskey}')
send ( 'r' )
;Insure the Wireless Network Connection Properties page has focus and move to the appropriate tab
$hwnd = WinGetHandle('Wireless Network Connection Properties')
WinWait ( $hwnd, 'General' )
if NOT WinActive ( $hwnd, 'General' ) then
WinActivate ( $hwnd, 'General' )
endif
WinWaitActive ($hwnd, 'General' )
Sleep(500)
ControlCommand($hwnd, 'General', 12320, 'TabRight', '')
Sleep(500)
;Insure the Wireless Networks tab has focus
WinWait ( $hwnd, 'Wireless Networks')
if NOT WinActive ( $hwnd, 'Wireless Networks') then
WinActivate ( $hwnd, 'Wireless Networks')
endif
WinWaitActive ( $hwnd, 'Wireless Networks')
Sleep(500)
;Check to insure that Windows Wireless Zero Configuration is being used, then click on the Add button
If Not ControlCommand($hwnd, 'Wireless Networks', 7024, 'IsChecked','') Then
ControlCommand( $hwnd, 'Wireless Networks', 7024, 'Check', '')
EndIf
ControlFocus($hwnd, 'Wireless Networks', 7033)
Sleep(500)
ControlClick($hwnd, 'Preferred networks', 'Button7')
;Input the Wireless network properties information and save it
$handle = WinGetHandle('Wireless network properties')
ControlSetText($handle, "Association", "Edit1", $ssid)
ControlCommand($handle, "Wireless network key", "ComboBox1", "SelectString", $auth)
ControlCommand($handle, "Wireless network key", "ComboBox2", "SelectString", $encrypt)
ControlSetText($handle, "Wireless network key", "Edit2", $Netkey)
ControlSetText($handle, "Wireless network key", "Edit3", $Netkey)
ControlClick($handle, "", "Button4")
;Close the Wireless Network Connection Properties window
If WinExists('Wireless Network Connection Properties') Then
WinActivate('Wireless Network Connection Properties')
ControlFocus('Wireless Network Connection Properties', "Wireless Networks", 1)
ControlClick('Wireless Network Connection Properties', 'Wireless Networks', 1)
EndIf
;Close the Network Connections windows
WinActivate('Network Connections')
Send('!{F4}') |
|