如何解决send函数问题发送问题
当输入$enable=(wzwg)ccgy##类特殊密码时程序发送就缺了特殊字符,请问如何解决这类问题,总不能碰到特殊字符要一个一个输入吧#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)
$xinhao=GUICtrlCreateInput("",120,180,200,20)
GUICtrlCreateLabel("请输入交换机型号:",5,180,110,20)
GUISetState(@SW_SHOW)
Func ports()
$nub=GUICtrlRead($xinhao)
Select
case $nub="zx"
zx()
case $nub="dl3226"
dlink3226()
EndSelect
EndFunc
func zx()
$s=ping(GUICtrlRead($telnet),500)
if $s Then
run("telnet " & GUICtrlRead($telnet))
WinActivate("Telnet","")
sleep(100)
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
Func dlink3226()
$s=ping(GUICtrlRead($telnet),500)
if $s Then
run("telnet " & GUICtrlRead($telnet))
WinActivate("Telnet","")
sleep(100)
send(GUICtrlRead($login) & "{enter}" & GUICtrlRead($enable) & "{enter}")
sleep(100)
send("{enter}" & "{down}" & "{down} " & "{enter}")
Else
MsgBox(0,"交换机状态","交换机设备不通")
EndIf
EndFunc
while 1
$msg=GUIGetMsg()
select
case $msg=$gui_event_close
ExitLoop
case $msg=$b
ports()
EndSelect
WEnd
[ 本帖最后由 bin0131 于 2009-2-5 12:04 编辑 ] sendx行不行呢 Send ( "按键" ,1 )
页:
[1]