To make scripts easier to develop the properties and methods of the global MWOffice application object are added to the Global namespace in the scripting environment. The API is designed as a rooted hierarchy with all objects accessible from one global MWOffice Application object. And because you are working in the context of the MWOffice application when in scripting environment making these accessible from the global namespace makes it simpler to access objects associated with the application. It also makes it easier to use the immediate window in the scripting environment to evaluate expressions. For example, to get a count of the Models currently loaded into the system we can type:
Both lines work, the first is just shorter. Likewise you'll often be using the MWOffice.Project object to access information in the currently loaded project. Again we can just directly access this object from the global namespace. Assuming we have a schematic called "MySchematic" we could get a count of the schematic elements using:
Again we could have used
and obtained the same result. One case in which you might want to use the MWOffice. portion is in the case of namespace conflict. We try to avoid these conflicts however occasionally a method or property name may match with either a global from the scripting environment or another library reference in your project. In these cases you can clarify which property or method you intend by using the application portion MWOffice.before the property or method name.