Select to view content in your preferred language

In ArcMap, how can I create a script tool that is portable?

688
2
01-22-2019 05:22 PM
CraigPennington
Occasional Contributor

I have developed Python scripts for processing maps.  I've created tools in a toolbox that uses them.  I have two issues:
1.  I can easily copy the Python scripts to a different computer.  But, after copying the toolbox, the paths to the scripts point to directories on the first machine.  I have to recreate each tool pointing to the right script AND redefine parameters, etc.
2. Toolboxes seem to be stored in each user's appdata folder.  I want any user that needs to manage maps to be able to use the toolbox without needing to make copies for each user.  Can I store a toolbox in a single user-independent location?

0 Kudos
2 Replies
CraigPennington
Occasional Contributor

 I found an easy way to solve this problem. 

I stumbled across the fact that I can store a toolbox in a file geodatabase. If I also specify the script path as a relative path and check the checkbox to use relative paths, I can copy and paste the file geodatabase anywhere I want with a consistent folder structure. This preserves the parameter settings and uses the intended script.

Easy, clean, portable without the complexity of creating a package.

DanPatterson_Retired
MVP Emeritus

An alternative is to simply store the scripts in the same location as the *.tbx… zip everything and ship it.

You just need to make sure that your scripts are set to use 'relative paths' when assigning properties in the toolbox