本帖最后由 pcl_test 于 2016-1-5 22:00 编辑
问题:我想用VB编个SecureCRT 5.1脚本,目的是在弹窗中输入设备号就能自动输入相对应的MAC地址。但是我自己编的脚本只在输入设备号为1时,自动输入相对应MAC:031001。但输入2或者3都直接报错 "错误的设备号,请核对" 。求大神解答
脚本如下:- # $language = "VBScript"
- # $interface = "1.0"
-
- Sub Main
- On Error Resume Next
- Const ForReading = 1, ForWriting = 2, ForAppending = 8
- Dim fso,MAC1,line,params
- Dim DeviceNo
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set MAC1 = fso.OpenTextFile("c:\2.ini",Forreading, False)
- crt.Screen.Synchronous = True
-
- line = MAC1.ReadLine
- params = Split (line)
-
- crt.Screen.WaitForString "或批处理文件。"
- DeviceNo = inputbox("请输入设备号","设备号输入对话框")
-
- If DeviceNo = params(0) Then
-
- crt.Screen.Send params(1) & vbcr
- Else
- MsgBox "错误的设备号,请核对"
-
- End If
- crt.Screen.Synchronous = False
- End Sub
复制代码 2.ini文件中格式如下:
1 031001
2 031002
3 031003 |