Follow

How can I select multiple objects and turn them all off using MapViewer automation?

This article contains a sample script for turning off the visibility for all selected objects in an existing MapViewer plot.

To run this script:

  1. Copy the script below, or click here to download the BAS file: Hide_Selection.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
  6. Click Script | Run to run the script.
     

*********

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Hide_Selection.bas
' Copyright (C) Golden Software Inc. 1992-2015
'
' This script turns off the visibility of all selected objects.
'
' To run this script, first open your MapViewer GSM file and select
' one or more objects, then run this script from Scripter.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub Main
  Dim mvApp, sel As Object
  Dim i As Long

  ' Find MapViewer and create a pointer to the application object
  Set mvApp = GetObject(,"MapViewer.Application")

  ' Get a pointer to the current selection collection
  Set sel = mvApp.ActiveDocument.ActiveLayer.Selection

  ' Set each selected object to be invisible
  For i = 1 To sel.Count
     sel.Item(i).Visible = False
  Next i

End Sub

 

Updated November 2, 2016

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.