PersonalCorpus 版 (精华区)
'**********************************************************************
'* Filename: test.vbs *
'* Author: Pred *
'* You may freely modify or redistribute this file *
'*This is an example in VBScript, showing how to use the methods in
'*STermScript. To run the script, just click Run command under Script Menu,
'*and select this file.
'**********************************************************************
Option Explicit
Main
MsgBox ("Script End")
Sub Main()
Const nTimeout = 20
Dim bConnect, nTime, nScreenHeight, strScreenLine, nDelay
MsgBox ("Selection is:" + Chr(13) + STermScript.GetSelectText())
nTime = Timer
nDelay = 3000
While (Not STermScript.IsConnected())
If (Abs(Timer - nTime) > nTimeout) Then
Exit Sub
End If
MsgBox ("Not Connected, Let's Connect to Host")
STermScript.Reconnect
MsgBox ("Let's wait " + CStr(nDelay) + " ms")
STermScript.Delay nDelay
Wend
MsgBox ("Connected to Host, Now let's send ""AAA"" to host")
STermScript.SendData ("AAA")
STermScript.Delay 200
nScreenHeight = STermScript.GetScreenHeight()
strScreenLine = STermScript.GetBuffer(nScreenHeight - 1)
MsgBox ("The last line of screen is" + Chr(13) + strScreenLine)
If (MsgBox("Abort connection?", vbYesNo, "STerm Script") = vbNo) Then
Exit Sub
End If
STermScript.Disconnect
End Sub
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.304毫秒