Summary
This article demonstrates how to create a template file that is loaded whenever you open a new script window.
Procedure
- Open a new script window.
A. Activate the Project window.
B. Click the Scripts icon.
C. Click New.
- 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
- Select Compile from the Script menu or click the
![[O-Image] Script compile button](https://webapps-cdn.esri.com/CDN/support-site/technical-articles-images/000003910/00N39000003LL2C-0EM39000000wcZd.png)
button.
- 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.
- Select Embed Script from the Script menu.
- Change to the Project window and select Customize from the Project menu.
- Select Script from the Type dropdown list.
- Select Menus from the Category dropdown list.
- Click the New Item button.
- Double-click the Invisible field to set the value to True.
- Double-click the Update field.
- Select the script template.ave from the list box of the Script Manager and click OK.
- 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.