Python script and Hyperlinks

5266
11
Jump to solution
09-04-2015 12:58 PM
RobertMateja
New Contributor II

Hyperlinks have always been an issue for me.  Dynamic hyperlinks are only available in the .mxd which won't work for me.  I thought attachments were going to be the way to go until I started researching and found out that the attachement is stored in the geodatase.  Unfortunately, this won't work for our workflow.  Record maps are constantly being updated which means that every update would result in several steps to keep the attachment up to date.  Too bad attachments can't just store the path to the file location, but I digress.

So i have been using hyperlinks.  This works great when I only have one file linked to a feature class.  Unfortunately, we have several features that have multiple files.  I have been storing these in my hyperlink field separated by a "|".  So I may have the following entry

\V09\VBP001.tiff | \V09\VBP006.tiff

In these cases the hyperlink tool will not work.  I am looking for a way to have my python script to split the above entry and open both files.  This is what I have so far

import webbrowser

def OpenLink ( [FIELD] 😞

  path = 'PATH' + [FIELD]

  webbrowser.open(path)

  return

This works great for hyperlinks that only have one file.  I cannot figure out what I need to add to open multiple files separated by the "|"

thanks for the help

0 Kudos
11 Replies
IanMurray
Frequent Contributor

Glad it worked for you.  I went ahead an updated my original response with the working code, if you wouldn't mind marking the question as answered.

0 Kudos
BlakeTerhune
MVP Regular Contributor

Looks like just Vertical Bar might be the more generic term. Apparently "Pipe" is more of a Unix thing.

0 Kudos