Document directory
- Eval function
- Execute statement
- ExecuteGlobal statement
Eval function
Calculates the value of an expression and returns the result.
[result = ]Eval(expression)
Parameters
Result
Optional. Is a variable used to accept the returned results. If no result is specified, consider usingExecuteStatement.
Expression
Required. It can be a string containing any valid VBScript expression.
Description
In VBScript,X = yThere are two possible interpretations. The first method is the value assignment statementYValueX. The second explanation is testXAndYEqual or not. If they are equal,ResultIsTrueOtherwiseResultIsFalse.EvalThe method always adopts the second explanation, whileExecuteThe first statement is always used.
Note:There is no confusion between this comparison and assignment in Microsoft (R) Visual Basic Scripting Edition, because the assignment operator (=) is different from the comparison operator (=.
Execute statement
Execute one or more specified statements.
Execute statements
RequiredStatementsA parameter is a string expression that contains one or more statements to be executed. If you wantStatementsThe parameter contains multiple statements, which should be separated by semicolons or embedded branches.
Description
In VBScript,X = yThere are two possible interpretations. First, as the value assignment statementYValueX. Second, as an expression, testXAndYIs the value equal. If they are equal,ResultIsTrue; Otherwise,ResultIsFalse.ExecuteThe statement always uses the first explanation, whileEvalThe second method is always used.
Note:There is no confusion between values assignment and comparison in Microsoft (R) Visual Basic Scripting Edition, because the value assignment operator (=) and comparison operator (=) are different.
CallExecuteThe context of the statement determines the objects and variables that can be used by the code to run. The objects and variables in the scope areExecuteThe code running in the statement can be used. However, you must understand that if the code to be executed is created, the process will not inherit the scope of the process.
Similar to other processes, the scope of the new process is global, and it inherits everything from the global scope. Unlike other processes, the context is not a global scope, so it can onlyExecuteStatement execution in the context. However, if the sameExecuteA statement is called outside the scope of a process (for example, in a global scope), so it not only inherits everything in the global scope, but also can be called anywhere, because its context is global.
ExecuteGlobal statement
Execute multiple statements specified in the global namespace of the script.
ExecuteGlobal statement
StatementA parameter is a string expression that contains one or more executable statements. InStatementParameters can contain multiple statements and are separated by colons.
Description
In VBScript,X = yThere are two ways to explain. The first method is to assign a valueYAssignedX. The second method is used as an expression for testingXAndYWhether the same value exists. If they are equal, the result isTrue; If they are not equal, the result isFalse.ExecuteGlobalThe statement always uses the first method, whileEvalThe method always uses the second method.
Note:There is no confusion between values assignment and comparison in Microsoft (R) Visual Basic Scripting Edition, because the value assignment operator (=) and comparison operator (=) are different.
In the global namespace of the script,ExecuteGlobalAll statements in are executable. Therefore, you can add code to a program so that any process can access it. For example, a VBScriptClassThe statement can be executed at runtime. Then the function creates a new instance of this type.
Adding processes and classes at runtime is very useful, but it may also overwrite existing global variables and functions at runtime. Because this may cause very serious program problems, when usingExecuteGlobalThe statement must be very cautious. If you do not need to access variables or functions outside of the process, it is best to useExecuteStatement, because it only affects the namespace of the main function.