To add a script tool to a toolbox, complete the following steps:
- Right-click the toolbox or toolset in which you want to create the script tool and click New > Script.
- For Name, 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.
- For Label, 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.
- If you have already created a script, browse to the location of your script and select it. 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.
- Optionally, if you have provided a script and want to embed it (that is, have the contents of your script stored internally with the toolbox), check the Import script check box.
- Optionally, if you have previously embedded a script, you can choose to provide a password to restrict access to the source code by checking the Set password check box. On the Set Password dialog box, enter your new password twice and click OK.
- Optionally, uncheck the Store tool with relative path check box to store absolute paths.
- For Name, enter the name for the script tool.
- Click Parameters. The dialog box appears as follows:
- 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.
- Define the tool parameters in this panel.
- 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 be used to give additional control over parameter behavior. For more information, see Customizing script tool behavior.
- 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.
Rubriques connexes
Vous avez un commentaire à formuler concernant cette rubrique ?