ArcGIS banner

Adding a script to a toolbox

Geoprocessing

Segment 3 of 8

Top  Previous  Next

You can add a script to a toolbox, and it will become a tool that you can use like any other tool in ArcToolbox.

A script is a simple text file that can be created in any text editor. It holds a loosely typed (meaning variable declaration is not required) scripting language, such as JScript, VBScript, or Python. Refer to Writing Geoprocessing Scripts With ArcGIS to learn more about writing geoprocessing scripts.

To do so, right-click your My_Management_Tools toolbox in the ArcToolbox window, point to Add, and click Script. Type “Multi_Clip” for the name of the script and type “Clip Feature Classes” for the label. Optionally, add a description to explain what the script will do.

The script’s name can be used when running the script inside another script or at the command line. The label is used as the script’s display name in the user interface.

The default stylesheet will be applied to the dialog box of the script unless specified otherwise. Here you’ll use the default, so leave the Stylesheet text box blank.

Check Store relative path names. All pathnames referenced by the script will be stored relative to the location of the toolbox containing the script. Storing relative paths avoids the hassle of repairing pathnames to data sources if the toolbox and associated data sources are moved to a new location. Provided the same directory structure is used at the new location, the tools contained within the toolbox will still be able to find their data sources by traversing the relative paths.

Click Next. Click the Browse button to the right of the Script File text box and navigate to your GP_Tutorial folder. Click multi_clip.py and click Open to add the script.

Click Next. Leave the parameters and their properties as they are at this point and click Finish. The script Clip Feature Classes is added to your My_Management_Tools toolbox.


Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.