|
楼主 |
发表于 2009-2-2 16:37:55
|
显示全部楼层
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
GUICreate("中兴交换机开端口程序",450,450)
$telnet=GUICtrlCreateInput("10.",120,30,200,20)
GUICtrlCreateLabel("请输入ip地址:",5,30,110,20)
$b=GUICtrlCreateButton("开端口按钮",350,30,80,30)
$login=GUICtrlCreateInput("",120,60,200,20)
GUICtrlCreateLabel("请输入登陆用户名:",5,60,110,20)
$password=GUICtrlCreateInput("",120,90,200,20)
GUICtrlCreateLabel("请输入telnet密码:",5,90,110,20)
$enable=GUICtrlCreateInput("",120,120,200,20)
GUICtrlCreateLabel("请输入enable密码:",5,120,110,20)
$port=GUICtrlCreateInput("",120,150,200,20)
GUICtrlCreateLabel("请输入要开的端口:",5,150,110,20)
GUISetState(@SW_SHOW)
Func ports()
$s=ping(GUICtrlRead($telnet),200)
if $s Then
run("telnet " & GUICtrlRead($telnet))
WinActivate("Telnet","")
send(GUICtrlRead($login) & "{enter}" & GUICtrlRead($password) & "{enter}" & "enable" & "{enter}" & GUICtrlRead($enable) & "{enter}")
send("set port " & GUICtrlRead($port) & " enable" & "{enter}" & "save" & "{enter}")
Else
MsgBox(0,"交换机状态","设备不通")
EndIf
EndFunc
while 1
$msg=GUIGetMsg()
select
case $msg=$gui_event_close
ExitLoop
case $msg=$b
ports()
EndSelect
WEnd |
|