Skip To Content

Adding a script tool

  1. Right-click the toolbox or toolset in which you want to create the script tool and click New > Script Tool.
    1. Enter the Name for the script tool. The name is used when the script tool is run from Python. You cannot have a space in the name.
    2. Enter the Label for the script tool. The label is the display name for the script tool (as shown in the Geoprocessing pane) and can contain spaces.
    3. If you have already created a script, browse to the location of your script and select your script. If your script does not already exist, you can skip adding a script file and add it later by changing the properties of the script tool.
    4. Optionally, if you have provided a script and wish to embed it (that is, have the contents of your script stored internally with the toolbox), check on the Embed script check box.
    5. Optionally, if you have previously embedded a script, you can choose to provide a password to restrict access to the source code by checking on the Set password check box. In the Set Password dialog box, enter your new password twice and click OK.
    6. Optionally, check off the Store tool with relative path check box to store absolute paths.
  2. Click Parameters. The dialog box appears as follows:
    Define the script tool parameters
    1. Define the tool parameters in this panel. Almost all tools have input parameters, and all tools must have an output parameter to be used in ModelBuilder.
  3. Optionally click Validation.

    Validation is everything that happens before a tool's OK button is clicked. When creating custom tools, validation allows you to customize how parameters respond and interact to values and each other. Validation is performed with a block of Python code that can used to give additional control over parameter behavior. For more information, see Customizing script tool behavior.

  4. Click OK.

Your script tool is added to the toolbox. You can open and use it like any other geoprocessing tool. You can change any of its properties, including parameters, by right-clicking the script tool and clicking Properties.

Related topics