0

Is there any way to automatically open a toolbox in ArcMap either from a model, a Python script or a Python Add-In, or similar? Or to otherwise make all of the tools in a toolbox easy to access for novice ArcMap users who are unfamiliar with the Toolbox view or Catalog view?

I would like my Python Add-In to have a button that will open a toolbox so that the user can see a list of the in-house custom tools that are all in a particular toolbox.

Note that the list of tools in this toolbox is dynamic. There are new tools being added periodically, and old tools may be removed from time to time. I would like the users' to always see the current tools, and not have to navigate among system tools to find them. (They are welcome to use the system tools - but that's a separate issue).

At present, the only work around I've found is to add a button for each tool, but this requires a lot of tedious configuration in the Python Add-In each time a new tool is added, and also requires the user to download and install the new Add-In each time a new tool is added.

Otherwise, they have to navigate the Toolbox view or the Catalog view, which is tedious for our users, many of whom are ArcMap novices.

UPDATE:

I do not want to have to manually configure each user's system any more than I already do. They already use our custom in-house Python Add-In toolbar, so if it can be done that way, that would be ideal (ie, they only have to update their toolbar once, and then for ever after that, they have the current set of tools available, even if that set changes from time to time).

There are about 30 users. At present there are about a dozen tools (and growing).

  • 2
    This is not possible. You should be able to populate an Add-in combobox dynamically with all the tools in a toolbox though and then call that tool when the comboxbox item is selected. – user2856 May 24 at 4:15
  • That may be a solution. I'll give that a go. – Son of a Beach May 24 at 4:20
  • I won't post an answer, I don't use ArcMap anymore, just ArcGIS Pro which doesn't support Python Add-Ins so I'm not setup to code/test them. – user2856 May 24 at 4:47
  • Have you tried having them use the Search window to find/access tools instead? I never use the Toolbox view and only use the Catalog view for accessing custom toolboxes. – PolyGeo May 24 at 4:47
  • I think it would be useful to know approximately how many tools in how many toolboxes for how many users you are dealing with. – PolyGeo May 24 at 5:53
1

I recommend that you train your users to use the Search window to find and access tools. As documented in A quick tour of creating custom tools:

Tools you create are called custom tools and become an integral part of geoprocessing, just like system tools. You can open and run any tool from the Search or Catalog window, use it in ModelBuilder and the Python window, and call it from another script.

I never use the Toolbox window and, although I often use the Catalog window for accessing (not finding) custom toolboxes, I never access system tools from the Catalog window.

  • Its a good suggestion. I use the search all the time. But I'm not convinced it would be a great option for our novice users. Partly because they may not know what to search for, and partly because they may get overwhelmed the the results of some of their searches. I wan't an easy way for them to see only our custom set of tools, and none of the system tools. (I don't have anything against them using system tools, mind.) – Son of a Beach May 24 at 5:21
  • 1
    Why not drag those custom tools onto a new toolbar? – PolyGeo May 24 at 5:37
  • 3 reasons: 1. I didn't know you could drag tools onto a toolbar. I've just tried it now (a new empty toolbar) and it didn't work. How can I do this? 2. I don't want to have to configure it individually for every user on every machine they use. They all have our custom Add-In already, so if I can make it work through the Add-In, that would be preferable. Then there's only ONE item that I have to keep maintained for all our users. 3. And I like the dynamic nature of the Add-In where new tools would be added automatically for all users once created in a single source toolbox on the net. – Son of a Beach May 24 at 5:43
  • There's documentation on 1. at desktop.arcgis.com/en/arcmap/latest/analyze/finding-tools/… I only recall trying it once long ago and that it worked. – PolyGeo May 24 at 5:48
  • Thanks, I vaguely remember seeing that in the past, but have never tried it. I reckon that will be VERY useful for my own personal uses. But probably not for this particular issue. – Son of a Beach May 24 at 5:49
0

This turned out to be trivially simple to do by adding a combo-box to my existing Python Add-In (as suggested in comments by @user2856). The combo-box gets initialised to contain the names of whatever tools are currently in the toolbox.

Here's my initial simple implementation:

class ToolSelector(object):
    """Implementation for CustomStuff_addin.toolSelector (ComboBox)"""
    def __init__(self):
        arcpy.ImportToolbox(toolbox, "customtools")
        self.items = [t.replace("_customtools", "") for t in arcpy.ListTools("*_customtools")]
        self.editable = False
        self.enabled = True
        self.dropdownWidth = 25*'W'
        self.width = 1*'W'
    def onSelChange(self, selection):
        pythonaddins.GPToolDialog(toolbox, selection)
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass

IMPROVEMENTS TO BE IMPLEMENTED IF POSSIBLE:

I would like to be able to glean the labels of the tools, so that the user could be presented with the human-readable labels of the tools (ie, with spaces between words) rather than the all-in-one-word tool names.

UPDATE: I can't figure out how to get the tool labels, so I have instead used a regular expression (found on Stack Exchange) to change camel-case tool names to space-delimited labels and use a dictionary to convert between the two as necessary in the Add-In. Works nicely for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.