找回密码
 加入
搜索
查看: 827|回复: 1

怎么无法运行?

[复制链接]
发表于 2009-3-22 14:22:55 | 显示全部楼层 |阅读模式
我最近要对DSLAM设备的端口进行批量操作,本来使用如下的脚本:
run("telnet 10.10.10.1")
winwait("Telnet 10.10.10.1")
send("root{Enter}")
sleep(1000)
send("office{enter}")
sleep(1000)
send("en{enter}")
sleep(1000)
send("config{space}t{enter}")
sleep(1000)
send("int{space}adsl{space}0/0{enter}")
send("dea{space}        1        {enter}")
send("dea{space}        14        {enter}")
send("dea{space}        15        {enter}")
send("dea{space}        16        {enter}")
可是比较繁琐,我想直接读取excel表格的东西,于是写了如下的代码:
#include <Array.au3>
#include <Excel.au3>
$sFilePath1 = @ScriptDir & "\111.xls"
$oExcel = _ExcelBookOpen($sFilePath1,0)
$line=_ExcelReadCell($oExcel,1,3)
$ipadd=_excelreadcell($oExcel,1,4)
$user=_excelreadcell($oExcel,1,5)
$password=_excelreadcell($oexcel,1,6)
If @error = 1 Then
        MsgBox(0, "Error!", "Unable to Create the Excel Object")
        Exit
ElseIf @error = 2 Then
        MsgBox(0, "Error!", "File does not exist")
        Exit
EndIf
_ExcelSheetActivate($oExcel ,"11")
run(telnet $ipadd)
send("$user{Enter}")
sleep(1000)
send("$password{enter}")
sleep(1000)
send("en{enter}")
sleep(1000)
send("config{space}t{enter}")
sleep(1000)
For $i = 1 To $line
         $board=_excelreadcell($oExcel,$i,1)
         $port=_excelreadcell($oExcel,$i,2)
         send("inter{space}0/$board{enter}"
         Sleep(400)
         send("dea(space)$port")
Next
_ExcelBookClose($oExcel) ; And finally we close out
可是无法运行,就在run(telnet $ipadd)这一行,多谢帮助!


分开那一行,多加几个send就行了,谢谢!

[ 本帖最后由 sun_hoper 于 2009-3-22 16:34 编辑 ]
发表于 2009-3-22 15:37:50 | 显示全部楼层
run(telnet $ipadd)这一行语法错误

你的参数不是可执行文件名吧?!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 09:07 , Processed in 0.071074 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表