VBS a WINDOWS script that is represented by: Microsoft Visual Basic Script Editon. (Microsoft Visual Basic Scripting Edition), VBS is an abstract subset of Visual Basic. is built-in, the script code written with it can not be compiled into binary files, directly run by the Windows system (actually is called Host host interpretation of the source code and run ), efficient, easy to learn, but most of the high-level language capable things. It basically has, it can make a variety of tasks to self-active. Be able to free you from repetitive and trivial work. greatly improve the efficiency.
And the reason I learn VBS is because I have to learn QTP. Based on VBS, the tool for editing VBS VBSEDIT Of course can also be used Notapad, F1 in the editor to bring up the help document
Because of the lack of some elements in computer programming language, the descriptive narrative ability of the event is weak. So called scripting, its most convenient place is to provide easy support for COM objects.
As I understand it, COM objects are some program modules with specific function functions. They generally use OCX or DLLs as extensions. You just have to find the module file that includes the functionality you need and a reference to the specification in the script. will be able to implement specific functions. That is, the Vbs script is to call out-of-the-box "control" as an object, with the object's properties and methods to achieve the purpose, completely exempt from writing code, design algorithms, and so trouble.
It doesn't even require a dedicated development environment, and in your computer you can write a VBS script with just Notepad. and can run directly.
Open your Notepad program. Fill in the Edit form:
MsgBox "He Llo world!"
Then save, then double-click on the saved VBS file with the mouse to execute it
When the dialog box pops up, click OK and the dialog box disappears. It's a little ugly, but it's really the first script you've written.
Msgbox Syntax: Msgbox "dialog box Contents", "dialog box title"(Baidu Encyclopedia Msgbox)
Cases:
Vartemp = MsgBox ("Hello World", Vbabortretryignore + _ ' Underline for line wrapping vbcritical + vbDefaultButton3 + vbsystemmodal + _vbmsgboxrig HT, "Warning") ' MsgBox vartempselect case vartempcase 1MsgBox ' vbOK clicked ' OK ' button ' case 2MsgBox ' vbcancel clicked ' Cancel ' button ' Case 3MsgBox "Vbabort clicked ' terminate ' button ' case 4MsgBox ' vbretry clicked ' Retry ' button ' case 5MsgBox ' vblgnore clicked ' ignore ' button ' case 6MsgBox "Vbyes clicked ' is ' button ' case 7MsgBox" vbno clicked ' No ' button ' End select
How to use Select Case in code
To write multiple lines of code in one line, use theColon(
:) asSeparators。 Like what:
A = 1b = 2c = 3
Write a line
A = 1:b = 2:c = 3
-----------------------Hua-----------------------li---------------------------------------------------------------------cut- ----------------------Line-----------------------
' Dim name:dim Sexdim name,sexname = InputBox ("Please enter your name", "name", "Zhang San") Sex = InputBox ("Please enter gender", "gender", "male") MsgBox name & Sex ' MsgBox name, ' Your name is '
The first sentence is to define the variable. Dim is the statement that defines the variable. The format is:
Dim variable 1, Variable 2 ..., Vbs has only one variable type, so you don't have to declare the variable type.
The system will actively resolve the variable type itself.
Fr=aladdin ">inputbox is a VBS built-in function that accepts input content. Its syntax format is:Inputbox ("dialog box content", "dialog box title"), the second sentence means to accept the user's input. and pass the input result to the variable name.
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
VBS learning Diary (one) begin to understand