Most of these scripts are appropriate for use in customized ArcView applications where there is a need for tight control over functionality. Customized applications focus on well defined user needs and include special menus, buttons, and tools that replace the basic functionality that comes with ArcView out-of-the-box. Below is a simple example of a customized application called View Base Map. This application opens a view that displays base map information anywhere in the State of Connecticut either as a set of feature themes (shown below) or as a seamless image theme of tiled USGS Digital Raster Graphic files. People using the application turn on the type of base they want to see, pan to known geographic locations, identify features, and print base maps for any Connecticut town or 7.5 minute quadrangle from a menu. The View Base Map application uses many of the 201 Scripts. For example, each of the five tools in the tool menu shown below runs the zView.ThemeIdentifyTool script, which identifies a theme without forcing the user to make the theme active beforehand. There is a separate tool for identifying roads, railroads, lakes, stream polygons and single line streams.
Each script comes with a header that describes what the script does and how to use it in ArcView. Pay close attention to the Function, Parameters, Requires, and Desc header elements because they usually include everything you need to know. Headers for control update scripts are smaller in scope because these scripts tend to be very short and easy to understand.
' Name zView.ThemeIdentifyTool ' File zViewThemeIdentifyTool.txt ' Application ' Function Identifies theme features ' Parameters theThemeName,theFieldName,theIdWinSizeX,theIdWinSizeY ' Returns NIL upon error ' Called by ' Calls to ' Requires ' Variables ' History 1-99 Howie Sternberg, State of Connecticut, DEP ' Version 3.1 ' Desc An apply event script for a Tool control in a View DocGUI that ' identifies theme features and lists a field value for them in the left hand ' side of the Identify window. Four parameters (theThemeName,theFieldName, ' theWinIdSizeX,theWindIdSizeY) specify the theme name, the id field name, ' and the x and y pixel dimension of the identify window. These parameters ' are passed as the control's tag property and MUST be separated by commas ' with no spaces in between. ' Apply: zView.ThemeIdentifyTool ' Tag: Towns,Town_no,400,200 ' Update: zView.ThemeTagUpdateVisThresh100
These customizable, non-modular scripts add themes, delete themes, and print special types of maps. They include zView.ThemeAdd, zView.ThemeSetAdd, zViewThemeSetDelete, zViewImageThemeAdd, and zView.MapAndReport.
zView.MapAndReport is a non-modular script that prints a map centered on the current view along with a separate report listing features on the map. It labels themes so features are labeled on the map, prints the map, prints an accompanying report listing features on the map, and deletes the labels from the view when done. This script includes a few lists that need to be populated with the names of the themes and fields to label and print in the report. Below is the header portion of the script, followed by the section that includes the lists. Note that zView.MapAndReport is a button or menu click event driver script for a view DocGUI that calls other scripts. It passes these lists to the called scripts so that they know how to label the themes, print the map, print the report, and remove the labels.
' Name zView.MapAndReport ' File zViewMapAndReport.txt ' Application ' Function Driver script for printing a map and accompanying report listing features on map ' Parameters ' Returns NIL upon error ' Called by ' Calls to zView.MapAndReportMakeMap, zView.MapAndReportMakeReport, ' zView.MapAndReportLabelAdd, zView.MapAndReportLabelDelete ' Requires Active view with map units set ' Variables ' History 1-99 Howie Sternberg, State of Connecticut, DEP ' Version 3.1 ' Desc A click event script for a Menu or Button control in a View DocGUI ' that prints a map and accompanying report of attribute information for the ' features appearing on the map. This script is a driver script that calls other ' scripts for adding theme labels, deleting theme labels, printing the map, and ' printing the report. These scripts present a series of message and dialog boxes ' for specifying the printer for the map, the printer for the report, and whether ' to preview the map before printing, etc. Different printers and page sizes can ' be specified for the map and report. ' Click: zView.MapAndReport ' Tag: ' Update: ' Edit the following 5 sections before running this script ' --------------------- Edit Here ------------------------ ' 1 Make list of themes to label on the map ' {theThemeName,theFieldName,theTextFamily,theTextStyle,theTextColor,theTextSize,theDupFlag} theLabelThemes = list.make theLabelThemes.Add({"Avtown.shp","Town","Arial","Normal","Blue",12,TRUE}) theLabelThemes.Add({"Index.shp","Quad_No","Times","Bold","Red",18,TRUE}) ' 2 Make list of themes to report that includes an ordered list of field names to print ' {theThemeName,{theFieldName1,theFieldName2,theFieldName3,,,}} theReportThemes = list.Make theReportThemes.Add({"Avtown.shp",{"Town","Town_No"}}) theReportThemes.Add({"Index.shp",{"Quad_no","Quadrangle"}}) ' 3 Specify the name of report appearing on the top of the page theReportTitle = "Report Of Features Shown On Map" ' 4 Specify scripts used to make the map, label the map, and make the report theMapScriptName = "zView.MapAndReportMakeMap" theLabelAddScriptName = "zView.MapAndReportLabelAdd" theLabelDeleteScriptName = "zView.MapAndReportLabelDelete" theReportScriptName = "zView.MapAndReportMakeReport" ' 5 Edit zView.MapAndReportMakeMap script to specify the map title and legend ' in the title box area.
Notes | |
(1) | Modified original script. The script was included with the initial set of 201 Scripts, but has been modified or enhanced since. |
(2) | A new script that was added April 5, 1999. |
(3) | A new script that was added August 6, 1999. |
Extension | |
zExt.CanUnload (3) | Checks to see whether avdlog.dll can be unloaded |
zExt.Install (3) | Adds extension objects to current project |
zExt.Make (3) | Makes the extension object |
zExt.Uninstall (3) | Removes extension objects from current project |
zExt.Unload (3) | Performs any final cleanup upon unloading |
Layout | |
zLayout.ScaleBarAddTool | Adds standard scale bars (like 1:24,000) to layout |
zLayout.TableAdd | A called script that adds selected table records to a layout as graphic text |
zLayout.TableAddSumTool | Adds selected table records to a layout as graphic text and summarizes numeric fields (sum, avg, min, & max) specified by user. |
zLayout.TableAddTool | Adds selected table records to a layout as graphic text |
zLayout.TableAsColumnAddTool | Adds selected table records to a layout as columns of graphic text |
zLayout.TextFileAddTool | Add a text file to a layout as graphic text |
Project | |
Project.Exit | Exits Arcview and prompts for saving edits, and closes project without saving project |
Project.Close | Closes project and prompts for saving edits, without saving project |
zProject.SaveApplication | Saves customizable and non-customizable versions of project |
zProject.Shutdown | Project shut down script that restores ArcView |
zProject.Startup | Startup script for non-customizable project (production environment) |
zProject.StartupCustomizable | Startup script for customizable project (development environment) |
zProject.StartupViewMake | Called by project startup script to make and add a view to project |
Script | |
zSed.DocWinResize (3) | Makes all script windows the same size |
Table | |
zTable.ClearSelection | Opens Msgbox for choosing tables with selections to clear |
zTable.ClearSelectionUpdate | Control update script for zTable.ClearSelection |
zTable.GetUnique | Returns list of unique values for a field in a table |
zTable.PrintSelection | Opens Msgboxes for choosing a table and the fields to print for selected records in table |
zTable.PrintSelectionUpdate | Control update script for zTable.PrintSelection |
View - Display | |
zView.DisplayWalk | Full screen panning the view up, down, left, right, etc. |
zView.DisplayWalkUpdate | Control update script for zView.DisplayWalk |
zView.DisplayZoomTheme | Zoom view to full extent of Control Tag theme |
zView.DisplayZoomToScale | Zooms view at standard scale centered where user clicks |
zView.DisplayZoomToSelectedTheme (2) | Zooms to selected extent of a theme chosen from Msgbox |
zView.DisplayZoomToSelectedThemes (2) | Zooms to selected extent of one or more themes chosen from Msgbox |
zView.DisplayZoomToTheme (2) | Zooms to theme chosen from Msgbox |
zView.DisplayZoomToThemes (2) | Zooms to one or more themes chosen from Msgbox |
View - DynamicAOI | |
zView.DynamicAOI | A view update script that sets Area Of Interest to view display's visible extent |
zView.DynamicAOISet | Control click event script that sets view update script to zView.DynamicAOI |
zView.DynamicAOIUpdate | Control update script for zView.DynamicAOISet |
View - Edit Theme | |
zView.EditThemeAddTool | Adds new feature to edit theme and assigns it a field value entered in a MsgBox.Input |
zView.EditThemeDeleteTool | Selects features and deletes those confirmed by user. Mgbox.YesNo opens to display a field value identifying each selected feature, prompting user to delete it or not. |
zView.EditThemeEditValueTool | Selects edit theme feature and opens a Msgbox.Input to change a field value |
zView.EditThemeFieldsAddTool | Adds feature where user digitizes and opens a MsgBox.MultiInput to edit all fields |
zView.EditThemeFieldsTool | Selects edit theme features and opens a Msgbox.MultiInput to edit all fields |
zView.EditThemeLineAddTool | Adds new line edit theme feature and assigns it a field value entered in a MsgBox.Input. New line can be made to merge with others having the same field value. |
zView.EditThemeLineEditValueTool | Selects a line edit theme feature and opens a MsgBox.Input to change a field value. Line can be made to merge with existing lines having same field value. |
zView.EditThemeMoveTool | Selects and moves edit theme features |
zView.EditThemePolyAddTool | Adds new polygon edit theme feature and assigns it a field value entered in a MsgBox.Input. New polygon can be made to merge and/or intersect existing polygons. |
zView.EditThemePolyEditValueTool | Selects a polygon edit theme feature and opens a MsgBox.Input to change a field value. Polygon can be made to merge with existing polygons having same field value. |
zView.EditThemePolySubtractTool | Subtracts polygon edit theme features that intersect a user drawn polygon |
zView.EditThemePolyUnmergeTool | Unmerges an existing multiple-polygon feature to create a new feature having one or more polygon shape. New polygon feature can be merged with existing feature having same field value entered in Msgbox.Info that identifies the record. |
zViewEditThemeTagUpdate | Control update script that enables control if Control Tag theme is edit theme |
zViewEditThemeTaglUpdateVis | Control update script that enables control if Control Tag theme is edit theme and visible |
zViewEditThemeTagUpdateVisThresh | Control update script that enables control if Control Tag theme is edit theme, is visible, and within threshold |
zViewEditThemeTagUpdateVisThresh024 | Control update script that enables control if Control Tag theme is edit theme, is visible, within threshold, and view scale < 24001 |
zView.EditThemeToggle | Starts and stops editing a theme |
zView.EditThemeToggleUpdate | Control update script for zView.EditThemeToggle that enables/disables control |
zView.EditThemeUndo | Undo an edit theme edit |
zView.EditThemeUndoAll | Undo all edit theme edits since last save |
zView.EditThemeUndoAllUpdate | Control update script for zView.EditThemeUndo and zView.EdiththemeUndoAll |
zView.EditThemeUpdate | Control update script that enables control if edit theme exists |
zView.EditThemeUpdateNot | Control update script that enables control if no edit theme |
zView.EditThemeUpdateVis | Control update script that enables control if edit theme is visible |
zView.EditThemeUpdateVisThresh | Control update script that enables control if edit theme is visible and within scale threshold |
zView.EditThemeUpdateVisThresh024 | Control update script that enables control if edit theme is visible, within scale threshold, and view scale < 24001 |
View - Graphic | |
zView.GraphicClear | Clears all graphics in the view |
zView.GraphicClearSelection | Clears all selected graphics in the view |
zView.GraphicClearSelectionUpdate | Control update script for zView.GraphicClearSelected |
zView.GraphicClearUpdate | Control update script for zView.GraphicClear |
View - Image Theme | |
zView.ImageThemeAdd (1) | Adds image themes (image files and image catalogs) to view. Sets theme name, visibility, threshold, and transparent color map colors |
View - Label | |
zView.LabelStackedBulletLeaderTool | Labels active theme with stacked bullet leader labels where user clicks |
zView.LabelStackedCalloutTool | Labels active theme with stacked callout labels where user clicks |
zView.LabelStackedShadowBoxTool | Labels active theme with stacked shadow box labels where user clicks |
zView.LabelStackedTool (1) | Labels active theme with stacked labels where user clicks |
zView.LabelStackedToolUpdate | Control update script for zView.LabelStacked... scripts |
View - Legend | |
zView.LegendToggle | Toggles legend visibility for all themes in the active |
View - Map | |
zView.MapAndReport | Driver script for printing a map and accompanying report listing features on map |
zView.MapAndReportLabelAdd | Auto-labels specified themes before printing map |
zView.MapAndReportLabelDelete | Deletes labels for specified themes after printing map |
zView.MapAndReportMakeMap | Prints the map |
zView.MapAndReportMakeReport | Prints the report listing features on the map |
zView.MapQuick | Creates and prints ArcView Quick Map of active view |
zView.MapQuickUpdate | Control update script for zView.MapQuick that disables control if certain themes are visible |
View - Scale | |
zView.Scale024Update | Control update script that enables control if view scale < 1:24001 |
zView.Scale050Update | Control update script that enables control if view scale < 1:50001 |
zView.Scale100Update | Control update script that enables control if view scale < 1:100001 |
zView.Scale400Update | Control update script that enables control if view scale < 1:400001 |
View - Select | |
zView.SelectCircleBoundarySizedTool | Selects features intersecting circle perimeter whose radius is entered in Msgbox.Input |
zView.SelectCircleBoundaryTool | Selects features intersecting user drawn circle perimeter |
zView.SelectCircleDonutSizedTool | Selects features within donut whose radius and buffer is sized in Msgbox.Input |
zView.SelectCircleDonutTool | Selects features within donut shape made from user drawn circle |
zView.SelectCircleSizedTool | Selects features within circle whose radius is sized in Msgbox.Input |
zView.SelectCircleTool | Selects features within user drawn circle |
zView.SelectLineBufferBoundaryTool | Selects features intersecting boundary of buffered user drawn line |
zView.SelectLineBufferTool | Selects features within polygon made from buffered user drawn line |
zView.SelectLineTool | Selects features intersecting user drawn line |
zView.SelectPointTool | Selects features where user clicks point |
zView.SelectPolygonBoundaryTool | Selects features intersecting user drawn polygon boundary |
zView.SelectPolygonBufferBoundaryTool | Selects features intersecting boundary of buffered user drawn polygon |
zView.SelectPolygonBufferTool | Selects features within polygon made from buffered user drawn polygon boundary |
zView.SelectPolygonTool | Selects features within user drawn polygon |
zView.SelectPolylineBufferBoundaryTool | Selects features intersecting boundary of buffered user drawn polyline |
zView.SelectPolylineBufferTool | Selects features within polygon made from buffered user drawn polyline |
zView.SelectPolylineTool | Selects features intersecting user drawn polyline |
zView.SelectRectBoundarySizedTool | Selects features intersecting rect boundary whose width and height are sized in Msgbox |
zView.SelectRectBoundaryTool | Selects features intersecting user drawn rectangle boundary |
zView.SelectRectBufferBoundaryTool | Selects features intersecting boundary of buffered user drawn rectangle |
zView.SelectRectBufferTool | Selects features within polygon made from buffered user drawn rectangle |
zView.SelectRectSizedTool | Selects features within a rect whose width and height is sized in Msgbox.MuliInput |
zView.SelectRectTool | Selects features within user drawn rectangle |
zView.SelectThemeUpdate | Control update script for zView.Select scripts |
View -Theme Active | |
zView.ThemeActiveUpdate | Control update script that enables control if one theme is active |
zView.ThemeActiveUpdateVis | Control update script that enables control if one theme is active and visible |
zView.ThemeActiveUpdateVisThresh | Control update script that enables control if one theme is active, visible, and within threshold |
zView.Theme.ActiveUpdateVisThresh024 | Control update script that enables control if one theme is active, visible, within threshold, and view scale < 24001 |
View -Theme | |
zView.ThemeAdd (1) | Adds feature themes (shapefiles, coverages, library layers) to view. Sets theme name, visibility, threshold, label field, legend file, legend visibility, etc. Joints and links tables. |
zView.ThemeCountFeatures | Open message box displaying selected and total number of features |
View -Theme Find | |
zView.ThemeFindInput | Finds features by entering field value in a MsgBox.Input |
zView.ThemeFindInputAtScale | Finds features at a scale by entering field value in a MsgBox.Input |
zView.ThemeFindListAsString | Finds features by choosing one field value from a Msgbox.ListAsString |
zView.ThemeFindListAsStringAtScale | Finds features at a scale by choosing one field value from a Msgbox.ListAsString |
zView.ThemeFindListAsStringTwice | Finds features by choosing values from two fields in two MsgBox.ListAsString |
zView.ThemeFindListAsStringTwiceAtScale | Finds features at a scale by choosing values from two fields in MsgBox.ListAsString |
zView.ThemeFindMultiListAsString | Finds features by choosing one or more field value from a Msgbox.MultiListAsString |
zView.ThemeFindMultListAsStringAtScale | Finds features at a scale by choosing one or more field value from a Msgbox.MultiListAsString |
View -Theme Identify | |
zView.ThemeIdentifyLinkTool | Identifies theme features and related records in a one-to-many linked table |
zView.ThemeIdentifyMsgBoxInfoTool | Identifies theme features showing values of one Field in MsgBox.Info |
zView.ThemeIdentifyMsgBoxReportTool | Identifies theme features showing values of one Field in MsgBox.Report |
zView.ThemeIdentifyRelatedTool | Identifies theme features and records in another table having the same field value |
zView.ThemeIdentifyTool | Identifies theme features, setting the Id field and sizing the results window |
View -Theme Label | |
zView.ThemeLabelFeatureCountTool (2) | Displays (counts) number of features in a theme where user clicks |
zView.ThemeLabelRect | A called script that auto-labels a theme within a rectangle |
zView.ThemeLabelUserRectTool | Opens a Msgbox for choosing a field to label a theme within a rect drawn by user |
zView.ThemeLableVisibleExtent | Opens a Msgbox for choosing a field to label a theme within view's visible extent |
View -Theme Set | |
zView.ThemeSetAdd (1) | Adds sets of feature themes (shapefiles, coverages, library layers) to view at once. Sets theme name, visibility, threshold, label field, legend file, legend visibility, etc. Joins and links tables. |
zView.ThemeSetDelete | Deletes sets of feature themes from view |
View -Themes | |
zView.ThemesVisibleThresh100Update | Control update script that enables control if a group of themes are all visible, within their thresholds and the view scale is < 100001 |
zView.ThemesVisibleThreshUpdate | Control update script that enables control if a group of themes are all visible and within their thresholds |
zView.ThemesVisibleUpdate | Control update script that enables control a group of themes are all visible |
View -Theme Table | |
zView.ThemeTableClearSelection | Opens Msgbox for choosing themes with selections to clear |
zView.ThemeTableClearSelectionUpdate | Control update script for zView.ThemeTableClearSelection |
zView.ThemeTableLinkOpenTool | Selects theme features where user clicks and opens linked table. Promotes records in linked table and sorts them in ascending order based on a particular field |
zView.ThemeTableOpen | Opens a theme attribute table from a View DocGUI control and promotes selection |
zView.ThemeTableOpenTool | Selects theme features, opens theme attribute table and promotes selection |
zView.ThemeTablePrintSelection | Opens Msgbox for choosing fields to print for selected records in theme attribute table |
zView.ThemeTablePrintSelectionTool | Selects features and opens Msgbox for choosing fields to print for selected records in theme attribute table. |
View -Theme Tag Update | |
zView.ThemeTagUpdate | Control update script that enables control if Control Tag theme exists |
zView.ThemeTagUpdateVis | Control update script that enables control if Control Tag theme is visible |
zView.ThemeTagUpdateVisThresh | Control update script that enables control if Control Tag theme is visible and within threshold |
zView.ThemeTagUpdateVisThresh024 | Control update script that enables control if Control Tag theme is visible, within threshold, and view scale < 24001 |
zView.ThemeTagUpdateVisThresh050 | Control update script that enables control if Control Tag theme is visible, within threshold, and view scale < 50001 |
zView.ThemeTagUpdateVisThresh100 | Control update script that enables control if Control Tag theme is visible, within threshold, and view scale < 100001 |
zView.ThemeTagUpdateVisThresh400 | Control update script that enables control if Control Tag theme is visible, within threshold, and view scale < 400001 |
View -Theme Visible | |
zView.ThemeVisibleChoose | Opens Msgbox for choosing themes to make visible |
zView.ThemeVisibleDoq | Turns on/off visibility of DOQ image catalog and related feature themes |
zView.ThemeVisibleDrg | Turns on/off visibility of DRG image catalog and related feature themes |
zView.ThemeVisibleDrgContours | Turns on/off visibility of DRG contours image catalog and related feature themes |
zView.ThemeVisibleQuadIndex | Turns on/off visibility of Quadrangle Index theme |
zView.ThemeVisibleToggle | Toggles visibility of all themes in active |
zView.ThemeVisiblexxx | Template script for turning on/off visibility of sets of related and unrelated themes |
View TOC | |
zView.TOCHideShow | Toggles hiding and showing the view's table of contents (TOC) |
View Where | |
zView.WhereAmITool | Opens Msgbox identifying town and quadrangle where user clicks |
July, 1999