VBS learning diary (2) Basic knowledge, vbs Diary
VBScript Basics
I. Variables
1,All content after single quotes is interpreted as comments. (Ctrl + m comments in vbsedit and ctrl + shift + m comments in reverse comments)
2. In VBScript, variable naming rules follow standard naming rules. Note the following:Variables, methods, functions, and objects are case-insensitive in VBScript.. When declaring a variable, to explicitly declare a variable, you need to use the DIm keyword to tell VBScript that you want to create a variable and keep the variable name behind it.Declare multiple variables of the same type, which can be separated by commas. Note: In VBScriptYou cannot assign values to a variable when declaring a variable.. HoweverAssign values to both variables in one line of code, separated by colons.
3. YouYou can use Option Explicit to tell the host that the variable must be declared first and then used.
4. VBScript only has one variable type. In actual use, you need to use a type conversion function to convert the variable to the corresponding variable type.
The Cbool function converts a variable to a Boolean value;
The Cbyte function converts a variable to an integer between 0 and 255.
The Ccur function, Cdbl function, and Csng function convert the variable to a floating point value. The former is only accurate to four digits after the decimal point. The latter two are more precise and the value range is greater.
The Cdate function converts a variable to a date value.
The Cint and Clng functions convert variables to integers. The latter has a larger range than the former.
The Cstr function converts a variable to a string.
2. Array
The definition of an array is very similar to that of a variable. You only need to describe the number and dimension of the array after the variable. Note that the subscript of an array always starts from 0 and ends with a minus one in the array definition. That is to say, to define an array with ten data records, you will write the code as follows: dIm array (9). Similarly, when you want to access the fifth element, the actual code is arr ay (4 ). Of course, you can declare a dynamic array without specifying the number and dimension of the array. When the number and dimension of the array are fixed, use the keywordRedim to change the Array. Note: When the array size is changed, the data in the array will be damaged.Keyword preserve to protect data.
For example:
RedIm space preserve space array parentheses count comma-dimensional brackets
Iii. Operators
In VBScript operators, addition, subtraction, multiplication, division, and division are all common symbols. The multiplication operator uses ^, And the modulo operation uses Mod. In comparison operators, equal to, less than, greater than, less than or equal to, greater than, and so on are all consistent with commonly used symbols.
Not equal to less than or greater than used for connection.
Logical operators: AND operations-> AND non-operations-> not or operations-> OR;
You can use
Operator + and operator & to connect strings, generally use & operator;
There is also a special
Operator Is used to compare objectsSuch as button object, if
The object is of the same type and the result is true. If the object is not of the same type, the result is false..
Iv. Condition statements
Mainly include if ...... Then statement and selectcase statement
In if ...... In the then statement, the basic form is:
If condition then
Statement of the processing condition;
......
Endif
The basic form can only verify a single condition. If there are two conditions, you need to add a single row statement else in the basic form. If there are more conditions to be verified, you need to add the Elseif condition then Processing Condition Statement.
In the selectcase statement, the basic form is:
Select case variable
Case condition Value
Processing Condition Statement
And repeat the previous two sentences.
The last sentence should be
Case else
Processing statement
Of course, do not forget to put the End select clause in the last row.
Note: When performing string comparison, pay special attention to Case sensitivity. Generally, before comparison,
Use the lcase function to convert the string to lowercase, and use the ucase function to convert the string to uppercase..
V. cyclic control statements
Loop Control statements include ...... Next loop, ...... Each loop, do ...... While LOOP, do ...... Until loop and while loop.
Before using a loop control statement, you must first determine the loop conditions. If the number of loops is fixed, use ...... Next loop with the following structure:
For counter variable = start Count value to last count value
Execution loop body
Next
To determine each element in an array or object set, use ...... The structure of an each loop is as follows:
For each: the object or array to be viewed by the in variable For cyclic counting
Execute the processing statement
Next
Note:
You can use exit for to exit the loop at any time in the two loops.
If you want
When conditions are metExecute a piece of code and use do ...... While statement, structure:
Do while Condition
Execution loop body
Loop
If you want
When the conditions are not metRun the code and use do ...... The until statement in the following structure:
Do until Condition
Execution loop body
Loop
Of course,
In these two loop statements, you can use exit do to exit the loop.The last loop statement is
Always execute a loop when conditions are met,
While Condition
Execution loop body
Wend
Vi. Use Process
There are two common processes: a function, a return value for the caller, a subroutine, no return value, and a call
Special event subroutines.
The basic function definition method is as follows:
Function Name (parameter list)
Function Code
Function name = A value 'is used to return values.
End function
Some subprograms are similar, but there is no return value
Note:
Although the parameter list must be enclosed in parentheses when defining a subroutine, the parameter list is not added when the subroutine is called.Brackets are used only in functions. In addition,
Subprograms cannot be used in expressions.. The function can only appear on the right of the value assignment statement or in an expression,
Functions cannot be used directly.If the function must be used directly
Must be called using the call Statement and the return value is canceled.
Mathematical essays, mathematical diaries
Junior high school mathematics general review practices
The general review of junior high school mathematics is a key part of the system, improvement, and deepening of the content learned after completing the three-year mathematics teaching task of junior high school. Attaching importance to and conscientiously completing the teaching tasks at this stage will not only help students to consolidate, digest, and summarize the basic knowledge of mathematics, but also improve their ability to analyze and solve problems. It is also conducive to the practical use of employment students. At the same time, the students with poor learning bases can be found and missed, and the students can learn the content of the teaching materials again. Therefore, it is one of the basic skills of junior high school mathematics teachers to carry out general review teaching in a planned and step-by-step manner.
I. Closely following the outline and carefully preparing the review plan
There are many and complex mathematics content in junior high school, and their basic knowledge and skills are scattered in textbooks for three years. Students often learn new ones and forget the old ones. Therefore, the review plan must be carefully prepared based on the content of the outline and the systemic knowledge points. The preparation of the plan must be realistic to the students. The basic knowledge exercise method can be used to compile a test question to penetrate the main knowledge points based on the actual application knowledge of the students in the normal teaching, so that the students can complete the test independently within the specified time. Then, the plan's focus is determined based on the hard-to-understand content of the students in the test, the high forgetting rate, and the ease of mixing and error. After the preparation of the review plan, we should make a good selection of the review examples and homework for exercises. The students should hand over the review plan formulated by the students, and ask the students to make specific review plans based on their own learning practices, determine your own goals.
Ii. Tracing for the source, the system master the basic knowledge
In the first phase of the review, we must first emphasize that the students have mastered the basic knowledge and skills in the textbooks, and pass the textbooks well. Explicit requirements for students: ① the basic concepts, rules, formulas, and theorems must be correctly described and applied flexibly; ② the exercises must pass through the exercises after the textbooks; ③ The exercises after each chapter are comprehensive, requiring most students to complete the exercises independently. A few difficult students can complete the exercises under the guidance of their teachers.
Iii. Organize the system to improve the review efficiency
The second stage of the general review should particularly reflect the leading role of teachers. The mathematical knowledge of junior high school is systematically organized, sorted and classified, segmented, and reorganized based on the relationship between the basic knowledge and the mutual conversion relationship. For example, the third-year algebra can be divided into three parts: Function Definition, positive and negative proportional function, Gini function, quadratic equation, quadratic function, quadratic inequality, and preliminary statistics. Ry is divided into four 13 lines: the first line is a line with a right triangle as the subject. The second triangle is divided into three lines: (1) Proportional line segments; (2) determination and Properties of similar triangles. (3) determination and nature of similar polygon; the third circle, containing seven lines: (4) the nature of the circle; (5) the straight line and the circle; (6) the circle and the circle; (7) angle and circle; (8) triangle and circle; (9) quadrilateral and circle; (10) polygon and circle. The fourth is a graphic question with two lines: (11) the circle and the internal and external public tangent of the circle; (12) the trajectory of the point. This kind of inductive summary can be done jointly by teachers and students under the guidance of teachers and students with minor differences in degree and good quality, that is, the students can draw a dragon and the teachers can tap into the eye ". Middle and lower classes are classified by teachers, compared and explained, and divided into multiple exercises and comprehensive exercises, so that students can truly master the content of junior high school mathematics teaching materials.
4. Concentrate on exercises and strive for the best results
After combing and grasping the content of the teaching materials, we will start the comprehensive review of the third stage. In this stage, in addition to the emphasis on the key chapters in the textbooks, the primary focus is on repeated exercises, giving full play to the main role of students. Generally, the Unit exercises and system knowledge are used as the backbone of the comprehensive exercise questions, and the simulation questions are appropriately increased. For teachers, the main task at this time is to select exercises, carefully correct the exercises completed by students, give comments in a timely manner, check for missing vacancies, consolidate the review results, and achieve the goal of self-improvement. Attention should be paid to two questions in the selection of comprehensive exercises: first, the selected exercises should be purposeful, typical, and regular. For example, the value range of a function can be as follows:
(2) y = 13-2x
(3) y = 3x + 2x-1
(4) y = 1x + 1-1
(5) y = x + 2x-2 second, exercise should be enlightening, flexible, and comprehensive. For example, proof and application of the angle bisector theorem, in the circular proof question, the applications of the circular angle, the circular angle, the string heart angle, the circular power theorem, and the inner theorem are all comprehensive and important questions, capture results .... Remaining full text>
What is the problem about VBS writing log deletion programs?
Dim strComputer
StrComputer = "."
Set ob1_miservice = GetObject ("winmgmts:" & "{impersonationLevel = impersonate, (backup )}! \ "& StrComputer &" \ root \ cimv2 ")
Dim mylogs (3) 'defines the array and contains three values: 'application logs, system logs, and security logs'
Mylogs (0) = "application"
Mylogs (1) = "system"
Mylogs (2) = "security"
For each logs in mylogs
Set colLogFiles = obw.miservice. ExecQuery ("Select * from Win32_NTEventLogFile where LogFileName = '" & logs &"'")
For each objLogFile in colLogFiles
ObjLogFile. ClearEventLog ()
Next
Next
Msgbox "log deleted! ", 0," log deletion"