HOW TO

Load a template script file into each new script window

Last Published: April 25, 2020

Summary

This article demonstrates how to create a template file that is loaded whenever you open a new script window.

Procedure



  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Paste the following code into the new script window:

    Code:
    aScr = av.GetActiveDoc.GetSource
    cnt = aScr.AsString.Count
    'msgbox.info(cnt.asstring,"")

    if (cnt = 0) then
    tf = TextFile.Make ("c:\data\seed.txt".AsFileName, #FILE_PERM_READ)
    source = tf.Read(tf.GetSize)
    tf.Close
    theSed = av.GetActiveDoc
    theSed.Insert(source)
    end

  3. Select Compile from the Script menu or click the
    [O-Image] Script compile button
    button.
  4. Name this script template.ave.

    A. Select Properties from the Script menu.
    B. Type in a new name in the Name field.
    C. Click OK.

  5. Select Embed Script from the Script menu.
  6. Change to the Project window and select Customize from the Project menu.
  7. Select Script from the Type dropdown list.
  8. Select Menus from the Category dropdown list.
  9. Click the New Item button.
  10. Double-click the Invisible field to set the value to True.
  11. Double-click the Update field.
  12. Select the script template.ave from the list box of the Script Manager and click OK.
  13. Create a text file containing the template information and save it as c:\data\seed.txt. For example, you might type the following into the seed.txt file.

    ' Script Name:
    '-- Purpose:
    '-- Requirements:
    '-- Author:
    '-- Company: GIS Consulting Services
    '-- Address: 100 Main St. - Anytown USA
    '-- Web address: www.gisconsultants-anytown.com
    '-- Created on:
    '-- Last Modified on:


    The text in this file will be loaded each time you open a new script window.

Article ID:000003910

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic