MapViewer provides ActiveX Automation objects that allow scripts to control practically every feature of MapViewer. These objects can be accessed from Scripter or from any Automation-enabled environment, such as Visual BASIC, Windows Scripting Host, or Excel.
The means of accessing MapViewer automation objects varies depending on the scripting tool and language being used. With the Golden Software Scripter program and other applications compatible with Visual BASIC, the CreateObject function creates a MapViewer Application object:
Set x = CreateObject(" MapViewer.Application")
In this sample, a variable named "x" is assigned the value returned by the CreateObject function. The CreateObject function finds the name MapViewer.Application in the system registry, automatically activates MapViewer, and returns a reference to the MapViewer Application object. For an introduction to the Scripter programming language, see Scripter BASIC Language.
After creating an Application object, you can access other MapViewer objects through the properties and methods (defined below) of the Application object. The object model chart shows you which objects provide access to other objects in the hierarchy. Although the Application object is at the top of the hierarchy, not all objects are directly accessible from the Application object. To access many objects you must traverse from the Application object through one or more layers of sub-objects. People often refer to "drilling" or "boring" through the object hierarchy to describe this traversal through several objects to obtain an object you want to use.
To "drill through" the object hierarchy you must know which properties and methods of an object provide access to the next level of objects. Overview of MapViewer Objects discusses the most commonly used objects and the properties and methods that provide access to other objects in the hierarchy.
Every object represents a specific part of MapViewer. For example, the HatchMap object represents a hatch map, and the Graticule object represents a map graticule. Some objects do not represent a visible entity, but organize other objects into groups. The Shapes collection, for example, provides the means to create new drawing primitives (rectangles, points, polygons, etc.), but the Shapes collection itself is never visible.
Several non-visible objects, called collection objects, are used to organize the object hierarchy. Collection objects are containers for groups of other, related objects. For example, the Documents collection contains all the documents opened during a MapViewer session. All collection objects, regardless of what the collection contains, can be processed using similar techniques.
You can find all the properties and methods that are available for each of the automation objects, as well as a description of the objects themselves, in the online help. The ActiveX Automation Members dialog also shows you the available objects, properties, and methods. To view this dialog, select the Debug | Browse command in Scripter.
See Also