Working with tool names and avoiding name conflicts

About working with tool names and avoiding name conflicts

Tools have a name and label property. A tool name must be unique for the toolbox containing the tool, but the label has no restrictions. For example, a tool can be named CalculateBestPath, while its label is Calculate Best Path. There must be no other tool in that toolbox named CalculateBestPath, but other tools can have the same label.
The tool label is used to display the tool in an ArcGIS application and for labeling the tool's dialog box. The tool name is used to execute the tool in the command line, in scripts, and in Java. The name must not have spaces or other restricted characters, such as percent symbols or slashes. For more information, see An overview of managing tools and toolsets in the ArcGIS Desktop Help system. 
A program typically uses tools from more than one toolbox. When using multiple toolboxes, it is possible that two or more toolboxes will contain a tool with the same name. When this happens, the geoprocessor is unable to determine which tool in which toolbox should be executed when the tool is referenced in a program. If the geoprocessor determines that the tool name is ambiguous, Java displays an error or informs you that the tool is ambiguous. 
All toolboxes have an alias property. The alias is a short, alternative name for the toolbox. The alias is also used to avoid confusion when running tools in a program, when tools have the same name but are stored in different toolboxes. For example, there are two tools named Clip, one in the Analysis toolbox (alias name Analysis) and one in the Data Management toolbox for (alias name Management). When you enter Clip to the overloaded Geoprocessor.execute method, you are required to choose either Clip_analysis or Clip_management. Do the following to avoid tool name conflicts:
[Java] buffer = new;
  • Avoid referencing too many toolboxes in your program, since it increases the possibility of a tool name conflict. Add a toolbox when you need its tools and remove a toolbox when you don't need its tools.
  • Use the Execute method in which you specifiy the tool name along with the toolbox alias. The following code example executes a tool by name using the alias:
// Execute the model tool by name.
gp.execute("Clip_analysis", parameters, null);

See Also:

An overview of managing tools and toolsets