ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Adding a script tool

  1. Right-click the toolbox or toolset in which you want to create the script tool, then click Add > Script. The illustration below shows the first panel of the Add Script dialog box.

    Add Script Wizard panel 1

    1. Enter a name for the script tool. Name is used when the script tool is run from Python. You cannot have a space in the name.
    2. Enter a label for the script tool. Label is the display name for the script tool (as shown in the Catalog window) and can contain spaces.
    3. Optionally, type a description for the script.
    4. Optionally, click the Browse button (Browse) to change the default stylesheet used for the tool. If the Stylesheet text box is empty, the default stylesheet is used.
    5. Optionally, check the Store relative path names (instead of absolute paths) check box to store relative path names.

      Note:

      Only the path name to the script is stored as a relative path. Path names within the script code are not converted.

      Learn more about relative path names

    6. You can optionally uncheck Always run in foreground. If unchecked, the tool will respect the current Background Processing setting in the Geoprocessing Options dialog. If checked, the tool will always run in the foreground, overriding the Background Processing setting in the Geoprocessing Options dialog.

      Learn more about running tools in the background

  2. Click Next. The wizard panel appears as follows:

    Add Script Wizard panel 2

    1. For Script File:, click the Browse button (Browse), navigate to the location of your script, then select your script.

      You can type the path name of a script file that does not exist (with the appropriate extension for the script type). The wizard will ask if you want to create the file.

      Optionally, 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 (right-click the tool and click Properties).

    2. Optionally, check the Show command window when executing script check box to view messages that are written to standard output. The Python print directive writes to standard output.

      Since script tools are launched from an ArcGIS application, like ArcMap and ArcCatalog, you can write messages to the progress dialog box instead of standard output.

    3. If your script is a Python script, you will want to check Run Python script in process. With this option checked, Python scripts execute faster.

      Learn more about running in process scripts

  3. Click Next. The wizard panel appears as follows:

    Add Script Wizard panel 3

    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.

      Learn more about setting parameters

  4. Click Finish.

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

  • Renaming a tool: name and label
  • Running a script in process
  • Accessing parameters in a script tool
  • Writing messages in script tools
  • What is a script tool?
  • Embedding scripts and password protecting tools

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal