In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "the usage of ExecuteGlobal sentence in VBS". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the usage of ExecuteGlobal sentence in VBS.
Execute multiple statements specified in the global namespace of the script.
ExecuteGlobal statement
The statement parameter is a string expression that contains one or more executable statements. You can include multiple statements in the statement parameter, separated by colons.
Description
In VBScript, there are two ways to interpret x = y. The first method is to assign the value of y to x as an assignment statement. The second method is as an expression to test whether x and y have the same value. If they are equal, the result is True;. If they are not equal, the result is that False.ExecuteGlobal statements always use the first method, while the Eval method always uses the second method.
Pay attention to Microsoft? Visual Basic Scripting Edition? There is no aliasing between assignment and comparison because the assignment operator (=) is different from the comparison operator.
In the global namespace of the script, all statements in ExecuteGlobal are executable. Therefore, it allows you to add code to your program so that it can be accessed by any process. For example, a VBScript Class statement can be executed at run time. The function then creates a new instance of this class.
Adding procedures and classes at run time is very useful, but it can also cause existing global variables and functions to be overwritten at run time. Because this can cause very serious programming problems, you must be very careful when using ExecuteGlobal statements. If you do not need to access variables or functions outside the procedure, it is best to use the Execute statement, because it only affects the namespace of the tone function.
The following example explains the use of the ExecuteGlobal statement.
Dim X 'declares X as a global variable. X = "Global" 'assigns values to the global variable X. Sub Proc1 'declaration process. Dim X 'declares X in a local variable. X = "Local" 'assigns values to the local variable X. The executable statement here creates a procedure that, when called, prints X. The value of the global variable X will be printed here because Proc2 'inherits everything in the global variable. ExecuteGlobal "Sub Proc2: print X: End Sub" Print Eval ("X") 'print local X. Proc2 'calling Proc2' in the global scope will print "Global". End SubProc2 'this line will cause an error' because Proc2 is not available outside Proc1. Proc1 'calls Proc1. Execute "Sub Proc2: print X: End Sub" Proc2 'this line was called successfully because Proc2' is available in the global scope.
The following example demonstrates that ExecuteGlobal statements can be rewritten, so you don't need to include the entire procedure below in the reference tag.
S = "Sub Proc2" & vbCrLfS = S & "Print X" & vbCrLfS = S & "End Sub" ExecuteGlobal S Thank you for your reading. The above is the content of "the usage of ExecuteGlobal sentences in VBS". After the study of this article, I believe you have a deeper understanding of the usage of ExecuteGlobal sentences in VBS, and the specific use needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.