Select to view content in your preferred language

Hyperlink or HTML Popup - need to open a folder

8432
11
Jump to solution
10-06-2014 06:44 PM
KimSlezak
Deactivated User

Designing a mapping process with efficient maintenance. Each point and polygon may have many documents associated with it. License level prevents attachments. One-to-many relationship to table of links is a possible solution, but hard to maintain for the non-gis staff using the end product. If the hyperlink or html pop up provided a link to open a folder, then all new documents in the future could just be put in that folder. I have searched documentation and the internet and saw two people doing what looked to be solutions - (a) creating shortcuts (.lnk) files for each folder and (b) someone actually able to open a folder. Neither seem to work. ArcMap 10.2 Basic license, file gdb holds features. Folders of documents at same "layer" as mxd. Relative paths checked. Have tried hyperlink scripts both python and VBscript, and sample popup css file with the // lines tweaked. Closest I've gotten was a windows explorer opening, but to c:\ not the desired folder. Or get "Cannot find "file://<correct-filepath-and-folder-name>  Make sure the path or file name is correct." Or get nothing at all. Any thoughts or ideas welcome. Thanks.

0 Kudos
11 Replies
DanPatterson_Retired
MVP Emeritus

and you get no error messages...is your code indented 2 spaces or 1?  Not that it matters as long as it is indented in a similar fashion (notice the grasping at straws).  It must be a network thing so unless someone else can verify a similar task over a network or you have access to another network, ....

0 Kudos
KimSlezak
Deactivated User

Eureka!

Thanks, Dan for riding thru the pain.

This version works either with the mxd on local using data on network drive or with mxd on network drive with the data.

import webbrowser, arcpy, os

from arcpy import env

def OpenLink ( [HereYaGo]   😞

  wksp = env.workspace

  part_1 = wksp.replace("\\","/").split("/")[:-1]

  part_2 = "\\".join(part_1)

  final_path = os.path.join(part_2, "mainfolder",[HereYaGo] )

  webbrowser.open(final_path)

  return

The map properties hyperlink base is not needed, but the default gdb for the map must be set to this gdb. So when new maps are created and the feature class added, that setting and adding the script is needed. I'm suggesting to the client that the mxd is copied/save as new mxd and then modified if new layouts or what have you are needed.

0 Kudos