SecureCRT supports ActiveXscriptengines, including VBScript and JScript (Microsoft & amp; rsquo; sversionofJavaScript. Note: If you want to use the automatic script running mode, you need to set it in sessionoption. The script can be...
SecureCRT supports ActiveX script engines, including VBScript and JScript (Microsoft's version of JavaScript.
Note: If you want to run the script automatically, you need to set it in session option.
The script can be developed using any text editor. The Script header is used to identify the version of the Script language and SecureCRT Script interface. Each line in the Script header must start with #. the header includes the $ language Line and $ interface line. For example, the following is a simple script.
# $ Language = "VBScript"
# $ Interface = "1.0"
Sub Main
'Display SecureCRT's version
MsgBox "SecureCRT version is:" & crt. Version
End Sub
Code is usually placed in the main sub-process. Before the engine executes the main sub-process, it converts and executes Global Code (the script code is defined outside any sub-process). If you have some initialization processing, this feature can be used.
If you want to terminate the main process and use VBScript, you can use the Exit Sub statement. For example:
Sub Main
Condition = DoSomething ()
If condition = 0 Then
'Error, comment lout
Exit Sub
End If
End Sub
SecureCRT has some built-in objects that can be called through top-level application objects or sub-objects. These objects have some attributes and methods. For example:
Dim dlg
Set dlg = crt. Dialog
Dlg. Prompt ("Login :")
The following is a script:
[Javascript]
# $ Language = "VBScript"
# $ Interface = "1.0"
Sub Main
Dim Counter
Crt. Screen. Send "setenv loadaddr 800000" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv fdtaddr 780000" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv bootfile uImage" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv fdtfile mpc8349emitx. dtb" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv serverip 10.1.0.77" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv rootpath/home/test/nfs/rootfs" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv ipaddr 10.1.0.100" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. screen. send "setenv bootargs root =/dev/nfs mem = 1024 M rw nfsroot = $ serverip: $ rootpath ip = $ ipaddr: $ serverip: $ gatewayip: $ netmask: $ hostname: $ netdev: off console = $ console, $ baudrate $ otherbootargs "& vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv nfsboot 'tftp $ fdtaddr $ fdtfile \; tftp $ loadaddr $ bootfile \; bootm $ loadaddr-$ fdtaddr '" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "setenv bootcmd $ nfsboot" & vbCr
Crt. Screen. WaitForString "HD-Mother>"
Crt. Screen. Send "boot" & vbCr
Author: tchonggang77