Write securecrt script in VBScript

Source: Internet
Author: User
Creating ActiveX scripts

ActiveX script engines communicate with securecrt via standard interfaces. Therefore, securecrt can host any compliant script engine to run your scripts. The advantage of this approach is that you can script securecrt
Using the language of your choice. If an ActiveX Script Engine is available for your preferred scripting language, you can write scripts that will work with securecrt

The most common ActiveX script engines are VBScript and JScript. ActiveX script engines, which can communicate with securecrt through standard interfaces. Therefore, securecrt can execute VBScript.

Script headers will be used by securecrt to identify which script language the script is written in and the version of securecrt scripting interface. Each line of the script header must begin with a (#) character.
A securecrt script Header between des$ LanguageLine that identifies the script engine and
$ InterfaceLine to identify securecrt's interface version.

The header file is used to identify the script language andInterface is used to identifySecurecrtInterface version

# $ Language = "VBScript"
# $ Interface = "1.0"

Sub main
'Display securecrt's version
Msgbox "securecrt version is:" & CRT. Version
End sub

Note:A securecrt script header may also contain blank lines that begin (#).

It is not a requirement that you place your code within a main however there may be reasons why you wowould want to do this. the VBScript and JScript engines will parse and execute global script code (script code you
Have defined outside of any subroutine) before your main is executed. if you have "initialization" code that you want to ensure has been completely executed before your actual script code begins, it may be useful to place your initialization code at the global
Level. This will ensure that your initialization code will all execute before your main code runs.

It is not necessary to put the code into the main function, but there may be the following reasons.

VBScript generally runs a program outside the main function. It can be initialized.

Another reason is to use exit sub to terminate a program.

Another reason you may want a main routine is to allow your scripts a way of aborting themselves in case of problems. in VBScript there is no built-in way of exiting a script at the global level. however, if you
Want to exit a subroutine it is possible to use the exit sub syntax to do so. For example, in VBScript:

Sub main

Condition = dosomething ()
If condition = 0 then
'Error, comment lout
Exit sub
End if

End sub

Overview of securecrt Script objects

The script interacts with securecrt through attributes and methods. If you want to reference the object of securecrt, it generally starts with CRT.

Scripts interact with securecrt by invoking properties and methods on securecrt's "top-level" or application object or by invoking the properties and methods on "sub-objects" available through securecrt's Application
Object. securecrt's application object is accessed in scripts with the name 'crt '. properties and methods on securecrt's sub-objects may be accessed by creating a reference to a sub-object, or through the use of VBScript's multiple dot syntax. for example:

There are two methods to reference sub-objects.

1 is to first create a parent object and Reference Sub-objects through the parent object.


SetDLG= CRT. Dialog

DLG. Prompt ("login :")

2. It can be referenced directly.

Or, in VBScript and python, without creating the reference:

CRT. Dialog. Prompt ("login :")

For more information about the objects and parameters, see the help documentation of securecrt.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.