<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python script and Hyperlinks in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486905#M38006</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked.&amp;nbsp; Thanks so much. This is going to be a huge time saver!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Sep 2015 17:20:20 GMT</pubDate>
    <dc:creator>RobertMateja</dc:creator>
    <dc:date>2015-09-08T17:20:20Z</dc:date>
    <item>
      <title>Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486896#M37997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hyperlinks have always been an issue for me.&amp;nbsp; Dynamic hyperlinks are only available in the .mxd which won't work for me.&amp;nbsp; 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.&amp;nbsp; Unfortunately, this won't work for our workflow.&amp;nbsp; Record maps are constantly being updated which means that every update would result in several steps to keep the attachment up to date.&amp;nbsp; Too bad attachments can't just store the path to the file location, but I digress.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i have been using hyperlinks.&amp;nbsp; This works great when I only have one file linked to a feature class.&amp;nbsp; Unfortunately, we have several features that have multiple files.&amp;nbsp; I have been storing these in my hyperlink field separated by a "|".&amp;nbsp; So I may have the following entry&lt;/P&gt;&lt;P&gt;\V09\VBP001.tiff | \V09\VBP006.tiff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In these cases the hyperlink tool will not work.&amp;nbsp; I am looking for a way to have my python script to split the above entry and open both files.&amp;nbsp; This is what I have so far&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import webbrowser&lt;/P&gt;&lt;P&gt;def OpenLink ( [FIELD] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; path = 'PATH' + [FIELD]&lt;/P&gt;&lt;P&gt;&amp;nbsp; webbrowser.open(path)&lt;/P&gt;&lt;P&gt;&amp;nbsp; return&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great for hyperlinks that only have one file.&amp;nbsp; I cannot figure out what I need to add to open multiple files separated by the "|" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 19:58:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486896#M37997</guid>
      <dc:creator>RobertMateja</dc:creator>
      <dc:date>2015-09-04T19:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486897#M37998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you could parse out each path individually using [FIELD].split(" | ") and make a for loop that opens each parsed path.&amp;nbsp; Even if it has only 1 record, it will still return a list of string(s).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test = "Test1 | Test2"&lt;/P&gt;&lt;P&gt;test2 = "Test1"&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #004da8;"&gt;print&lt;/SPAN&gt; test.split(" | ")&lt;/P&gt;&lt;P&gt;['Test1', 'Test2']&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #004da8;"&gt;print&lt;/SPAN&gt; test2.split(" | ")&lt;/P&gt;&lt;P&gt;['Test1']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just would need to add "PATH" in front of each.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import webbrowser
def OpenLink ( [FIELD] ):
&amp;nbsp; pathlist = [FIELD].split(" | ")
&amp;nbsp; for path in pathlist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fullpath = 'PATH' + path
&amp;nbsp;&amp;nbsp;&amp;nbsp; webbrowser.open(fullpath)
&amp;nbsp; return&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: Updated code to final.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:26:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486897#M37998</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T21:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486898#M37999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use the &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;A href="https://docs.python.org/2/library/stdtypes.html#str.split"&gt;split()&lt;/A&gt;&lt;/SPAN&gt; method to get your hyperlinks in a list (EDIT: Ian beat me to it).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a one to many relationship between features and files, and you're using code to make it work, maybe you could just store your hyperlink paths in a related table with a key to the feature instead of just a single field in the feature class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And, FYI, the &lt;SPAN style="font-family: 'courier new', courier;"&gt;|&lt;/SPAN&gt; character is called a pipe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 20:09:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486898#M37999</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-09-04T20:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486899#M38000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian and Blake,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying.&amp;nbsp; Using the split method is kind of working.&amp;nbsp; It will open the first file (before the pipe - Blake, thanks for pointing that out.&amp;nbsp; I had no idea.). I would like it to open each file at the same time.&amp;nbsp; I am not sure if that is even possible.&amp;nbsp; Any thoughts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 15:34:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486899#M38000</guid>
      <dc:creator>RobertMateja</dc:creator>
      <dc:date>2015-09-08T15:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486900#M38001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So is it not opening subsequent hyperlink if there is more than one?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 16:23:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486900#M38001</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-09-08T16:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486901#M38002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that is correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 16:25:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486901#M38002</guid>
      <dc:creator>RobertMateja</dc:creator>
      <dc:date>2015-09-08T16:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486902#M38003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;move the return in my script outside the for-loop, I think it is causing it to end the loop prematurely.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 16:26:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486902#M38003</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-09-08T16:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486903#M38004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I follow what you are saying but I keep getting an indentation error.&amp;nbsp; This is what I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import webbrowser&lt;/P&gt;&lt;P&gt;def OpenLink ( [HYPERLINK] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pathlist = [HYPERLINK] .split(" | ")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for path in pathlist:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fullpath = "U:\LWATER\SCANNED" + path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webbrowser.open(fullpath)&lt;/P&gt;&lt;P&gt; return&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:06:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486903#M38004</guid>
      <dc:creator>RobertMateja</dc:creator>
      <dc:date>2015-09-08T17:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486904#M38005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the return needs to be within the function, but outside the for-loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import webbrowser&lt;/P&gt;&lt;P&gt;def OpenLink ( [HYPERLINK] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pathlist = [HYPERLINK] .split(" | ")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for path in pathlist:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fullpath = "U:\LWATER\SCANNED" + path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webbrowser.open(fullpath)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, you had 3 spaces for the for-loop indent, but 4 spaces for the function.&amp;nbsp; I went ahead and made it 4 and 4.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:16:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486904#M38005</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-09-08T17:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486905#M38006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked.&amp;nbsp; Thanks so much. This is going to be a huge time saver!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486905#M38006</guid>
      <dc:creator>RobertMateja</dc:creator>
      <dc:date>2015-09-08T17:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486906#M38007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad it worked for you.&amp;nbsp; I went ahead an updated my original response with the working code, if you wouldn't mind marking the question as answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:24:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486906#M38007</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-09-08T17:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python script and Hyperlinks</title>
      <link>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486907#M38008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like just &lt;A href="https://en.wikipedia.org/wiki/Vertical_bar"&gt;Vertical Bar&lt;/A&gt; might be the more generic term. Apparently "&lt;A href="https://en.wikipedia.org/wiki/Vertical_bar#Pipe"&gt;Pipe&lt;/A&gt;" is more of a Unix thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-and-hyperlinks/m-p/486907#M38008</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-09-08T17:28:21Z</dc:date>
    </item>
  </channel>
</rss>

