1

Any ideas how to resurrect or uncover the contents of the ArcGIS Samples toolbox?

In version 9.x there were occasionally useful developer sample tools like Write Features To Text File and Batch Define Coordinate System among others. In version 10.0 the samples.tbx was deprecated, but still installed so that older scripts and models using the samples remain functional.

The .tbx is still there in 10.3, at ...\Desktop10.3\ArcToolbox\Toolboxes\Samples.tbx but marked as a Hidden File, and it doesn't show up in the toolbox list. If the hidden attribute is removed, it shows up. However looking at it in ArcCatalog/Map shows an empty container, yet the file on disk is 927kb (most of the tbx files are less than 100k).

I've verified on a 10.3 machine that the samples do indeed still work, so they're there. How can I see and inspect them directly?

I need to write arcinfo ungenerate files, and there's a bug in either the code or the docs for WriteFeaturesToTextFile, I want to fix it. While I'm there I might as well let some other possibly useful code see the light of day again.

3
  • I managed to id the WriteFeatures... script by crafting a broken python script. The error message revealed the source, Traceback (most recent call last): File "c:\arcgis\desktop10.3\ArcToolbox\Scripts\WriteFeaturesToTextFile.py", line 90, in <module>. Presumably this recipe can be used to divine the rest. I'm still curious about the hidden contents of the toolbox though. Commented Feb 10, 2015 at 20:17
  • After you unhide the toolbox you should be able to view its contents in ArcCatalog. If you still have a copy of the samples toolbox from 9.x it should still work - I have some 9.2/9.3 toolboxes that still work in 10.2. Commented Feb 11, 2015 at 4:44
  • @MichaelMiles-Stimson, doesn't work here. I can see the toolbox in catalog, but the contents remain blank. Also tried "r-click > Save as > v9x Toolbox" but that didn't nothing (no file created, no error message. Didn't work on any other system tbx either though.) Commented Feb 11, 2015 at 17:24

1 Answer 1

1

7Zip can open the .tbx file and shows several files within.

7zip view into a TBX file

Extract those and load into a Hex Editor, then extract only the text strings. Alternatively use Notepad++ and remove all non-ascii and ascii control characters.

From there look for smashed together words that look like tool names followed by the same words with spaces, e.g.

WriteFeaturesToTextFileWrite Features To Text File
  • WriteFeaturesToTextFile - is the tool and script name, if there is a script
  • Write Features To Text File - is the tool label

Armed with a name go digging in C:\Path\to\Desktop10.x\ArcToolbox\Scripts. If lucky you'll see WriteFeaturesToTextFile.py. Copy that somewhere useful and start hacking.

Other tools like CADtoFeatureClass don't have a python script so you'll have to find a different method to extract. Given the size of the .tbx file it's in there somehow.


Postscript: I also tried @Jason-Scheirer's tool in answer to Convert a Toolbox (.TBX) to a Python script (.PY)?. It ran without error but it only created the toolbox, no tools.

After going through all this I realized a much faster way to find the name of the python script, if any, is readily available in the 9.x help docs just by scanning for gp = arcgisscripting.create(). Oh well. I leave this bushwack trail here anyway because it reveals some internal structure that may be useful to someone else someday.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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