Problem: I want to use VB to write a SecureCRT 5.1 script, the purpose is to input device number in the pop-up window will automatically enter the corresponding MAC address, but I make up the script in the input device number only to 1, automatic input corresponding MAC: 031001, but direct error input 2 or 3 "wrong number, please check it," strives for the great god answer
The script is as follows:
# $language="VBScript"
# $interface="1.0"
Sub Main
On the Error Resume Next
Const ForReading=1, ForWriting=2, ForAppending=8
Dim fso, MAC1, line, params
Dim DeviceNo
The Set of fso=CreateObject (" Scripting. FileSystemObject ")
The Set MAC1=fso. OpenTextFile (" c: \ 2. Ini, "Forreading, False)
The CRT) Screen) Synchronous=True
The line=MAC1. ReadLine
Params=Split (line)
CRT. Screen. WaitForString "or batch file,"
DeviceNo=inputbox (" please enter the number ", "device number input dialog")
If DeviceNo=params (0) Then
CRT. Screen. Send params (1) & amp; VBCR
The Else
MsgBox "wrong number, please check"
End the If
The CRT) Screen) Synchronous=False
End Sub
2. The ini file format is as follows:
1 031001
2 031002
3, 031003
CodePudding user response:
Under the great god answersCodePudding user response:
The Split (line)?Code seems to be wrong it
The Split (line, "") to just go.
In addition this code you just read the first line
The line=MAC1. ReadLine
Behind and did not continue to read the
There is a problem, of course.
Line2=reader. ReadLine () 'read the second line
Line3=reader. ReadLine () 'read the third line
And then compare