Currently we manually update the file path for a polygon field to hyperlink to tiffs of registered plans for our fabric records (we use Parcel Editor currently using ArcMap 10.2.2). The problem is we can/and have forgotten to update the field for given polygons for any number of reasons. Ideally, using a python script to look for tiffs based on standard naming conventions would be amazing!
What I have had success doing so far:
- in the layer properties under the display tab, I check on "Support Hyperlink using field:", with the field "NAME"
- Updated the radio button to Script and used the following script:
import webbrowser, os def OpenLink ( [Name] ): for r,d,f in os.walk(r"\\ref\ref\scanned_rp"): for image in f: if image.startswith(str([Name])): webbrowser.open(os.path.join(r,image)) return
This will eventually open the file requested, but due to the many subfolders and hundreds of tiffs in each subfolder it takes 2 to 3 mintues to return the results.
- Speed up the search results.
- Open only the first file with a similar name (if possible)
As our file names are standardized. The polygon layer name for a 2016 file, for example, would be 1610000. In the year subfolder, the tif would be named 1610000.tif.
The original source of python script came from here: http://support.esri.com/cN/knowledgebase/techarticles/detail/41382).