<?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: Update hyperlink based on field text. in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953905#M85667</link>
    <description>&lt;P&gt;This is perfection! HONESTLY, THANK YOU &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2019 18:35:36 GMT</pubDate>
    <dc:creator>Jonathan.Gray68UQW</dc:creator>
    <dc:date>2019-08-07T18:35:36Z</dc:date>
    <item>
      <title>Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953360#M85661</link>
      <description>&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Hey all!&lt;/P&gt;&lt;P&gt;I am looking for some help with how to get a hyperlink to match a "field" text in a drawing. The "field" that I have is one that points to a drawings location and name and what I want is for the hyperlink to match the "field" text.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please look at the video found here &lt;A href="https://imgur.com/a/5cOyKkR" target="_blank" rel="nofollow noopener noreferrer"&gt;https://imgur.com/a/5cOyKkR&lt;/A&gt; for an example. In the video you will see that I have the drawing location as a "field" in my title block, and to make the hyperlink match this text/location I have to copy the text from the "field" and paste it into the hyperlink box.&lt;BR /&gt;&lt;BR /&gt;My desire is, that the hyperlink gets updated to match the "field" entry because currently doing the whole copy paste thing is very repetitive for each new drawing or if the drawing gets moved to a new folder.&amp;nbsp; I understand if I have to issue a lisp command or something for this updating of the hyperlink to occur, it would be fantastic if that the hyperlink would get updated automatically anytime the text in the "field" changes which of course occurs if the drawing file is moved or renamed. But anything is better than coping and pasting that text.... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Aug 2019 14:28:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953360#M85661</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-07T14:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953677#M85662</link>
      <description>&lt;P&gt;If I'm understanding the problem, give this a try:&lt;/P&gt;&lt;PRE&gt;(defun c:foo (/ s str)
  ;; RJP » 2019-08-07
  (cond	((setq s (ssget "_X" '((0 . "mtext,text") (1 . "https*"))))
	 (regapp "PE_URL")
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (entmod (append (entget x)
			   (list (list -3
				       (list "PE_URL"
					     (cons 1000 (setq str (cdr (assoc 1 (entget x)))))
					     '(1002 . "{")
					     (cons 1000 str)
					     '(1002 . "{")
					     '(1071 . 1)
					     '(1002 . "}")
					     '(1002 . "}")
				       )
				 )
			   )
		   )
	   )
	 )
	)
  )
  (princ)
)&lt;/PRE&gt;&lt;P&gt;*Edit .. to filter mapped paths you'll need to change the text filter to this"&lt;/P&gt;&lt;PRE&gt;(setq s (ssget "_X" '((0 . "mtext,text") (1 . "[A-Z]\:*"))))&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2019 16:51:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953677#M85662</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-07T16:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953767#M85663</link>
      <description>&lt;P&gt;Hey! Thanks for taking the time to try to help me. Please see the attached drawing. In this drawing I need the hyperlink to match the drawing file path field,&amp;nbsp; I currently have the hyperlink set to "xxxxxx" as a place holder.&amp;nbsp;&lt;BR /&gt;I tried to run your lisp but I couldn't get it to really do anything for me, probably something I did wrong :(.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 17:28:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953767#M85663</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-07T17:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953832#M85664</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;(defun updatefield (/ s str)
  ;; RJP » 2019-08-07
  (cond	((setq s (ssget "_X" '((0 . "mtext,text") (1 . "@:\*.dwg*"))))
	 (regapp "PE_URL")
	 (setq str (strcat (getvar 'dwgprefix) (getvar 'dwgname)))
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (entmod (append (entget x)
			   (list (list -3
				       (list "PE_URL"
					     (cons 1000 str)
					     '(1002 . "{")
					     (cons 1000 str)
					     '(1002 . "{")
					     '(1071 . 1)
					     '(1002 . "}")
					     '(1002 . "}")
				       )
				 )
			   )
		   )
	   )
	 )
	)
  )
  (princ)
)
;; Update on drawing open
(updatefield)
;; COMMAND REACTOR
(or *fieldpathreactor*
    (setq *fieldpathreactor* (vlr-command-reactor nil '((:vlr-commandwillstart . strtcmd))))
)
;; Update on publish or print
(defun strtcmd (calling-reactor strtcmdinfo)
  (and (wcmatch (car strtcmdinfo) "*PLOT*,*PUBLISH*") (updatefield))
  (princ)
)&lt;/PRE&gt;&lt;P&gt;Curious as to why you hyperlink to the current directory?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:24:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953832#M85664</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-07T18:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953870#M85665</link>
      <description>&lt;P&gt;This is perfect!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We make PDF's of all of our drawings to share with the engineers in house to review. If they want to make a change on the drawing themselves instead of browsing to the file themselves by looking at the info along the side of the drawing they can now just click on that piece of text in the PDF thanks to you, &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ,&amp;nbsp; and the drawing will open up for them automatically in Autocad.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have one last question, is there a way to get this lisp you created for me to run every time that somebody issues the plot/publish command?&amp;nbsp; I ask this because if somebody saves the drawing in a new place the "field" autoupdates with the drawings new location and I would want the hyperlink to update as well.&amp;nbsp; I can add it to my "Startup Suite" but I don't know how to trigger it to run every time another command is issued.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:14:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953870#M85665</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-07T18:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953888#M85666</link>
      <description>&lt;P&gt;I updated the code above to use a command reactor .. give it a go!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:25:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953888#M85666</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-07T18:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953905#M85667</link>
      <description>&lt;P&gt;This is perfection! HONESTLY, THANK YOU &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:35:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953905#M85667</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-07T18:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953914#M85668</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7589489"&gt;@Jonathan.Gray68UQW&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;This is perfection! HONESTLY, THANK YOU &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Glad to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:38:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953914#M85668</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-07T18:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953986#M85669</link>
      <description>&lt;P&gt;Not sure if you use XREFS in paperspace, but this will assign hyperlinks to all of them &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;(defun c:xrefhyperlinks (/ s path)
  ;; RJP » 2019-08-07
  (cond	((setq s (ssget "_X" '((0 . "insert") (410 . "~Model")(2 . "~`*U*"))))
	 (regapp "PE_URL")
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (if (setq path
		      (findfile (cdr (assoc 1 (entget (tblobjname "block" (cdr (assoc 2 (entget x))))))))
	       )
	     (entmod (append (entget x)
			     (list (list -3
					 (list "PE_URL"
					       (cons 1000 path)
					       '(1002 . "{")
					       (cons 1000 path)
					       '(1002 . "{")
					       '(1071 . 1)
					       '(1002 . "}")
					       '(1002 . "}")
					 )
				   )
			     )
		     )
	     )
	   )
	 )
	)
  )
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2019 19:30:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8953986#M85669</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-07T19:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8979713#M85670</link>
      <description>&lt;P&gt;Hey!&amp;nbsp; I have been using this code for a while now and love it!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But I have one request, could you make it so that it updates on regen instead of plots or publishes?&lt;BR /&gt;&lt;BR /&gt;I ask this because if you publish and don't publish in the background it does something crazy and makes the hyperlink go to a location on my C drive instead of the files actual location on a server. So my thoughts were, I believe Autocad always regens right before it publishes, and if it does in fact do this, the lisp should capture a good file location and not a bad one to a location on my C drive.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:59:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8979713#M85670</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-21T20:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8981295#M85671</link>
      <description>&lt;P&gt;Why would it go to a path on your C drive? That seems quite odd.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try this version below to regen after the hyperlink is set.&lt;/P&gt;&lt;PRE&gt;(defun updatefield (/ s str)
  ;; RJP » 2019-08-07
  (cond	((setq s (ssget "_X" '((0 . "mtext,text") (1 . "@:\*.dwg*"))))
	 (regapp "PE_URL")
	 (setq str (strcat (getvar 'dwgprefix) (getvar 'dwgname)))
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (entmod (append (entget x)
			   (list (list -3
				       (list "PE_URL"
					     (cons 1000 str)
					     '(1002 . "{")
					     (cons 1000 str)
					     '(1002 . "{")
					     '(1071 . 1)
					     '(1002 . "}")
					     '(1002 . "}")
				       )
				 )
			   )
		   )
	   )
	 )
	 &lt;STRONG&gt;(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acAllViewports)&lt;/STRONG&gt;
	)
  )
  (princ)
)
;; Update on drawing open
(updatefield)
;; COMMAND REACTOR
(or *fieldpathreactor*
    (setq *fieldpathreactor* (vlr-command-reactor nil '((:vlr-commandwillstart . strtcmd))))
)
;; Update on publish or print
(defun strtcmd (calling-reactor strtcmdinfo)
  (and (wcmatch (car strtcmdinfo) "*PLOT*,*PUBLISH*") (updatefield))
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Aug 2019 13:20:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8981295#M85671</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-22T13:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8983671#M85672</link>
      <description>&lt;P&gt;Hey! Yes, it is a really odd problem. The hyperlink gets screwed up if I publish and "do not run in the background". If I publish and "do run in the background" the hyperlinks are good and match the field path. I ran your updated code and still had the same problem. Do you have any ideas on how to fix this?&amp;nbsp; The folder they hyperlink gets pointed to is a temp folder on my c drive named "Ac_publishxxxx".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I meant to say I ran the updated code and still get the same error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 12:47:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8983671#M85672</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-23T12:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8984073#M85673</link>
      <description>&lt;P&gt;I cannot replicate that behavior? I tried publish in foreground and background and the path / hyperlink stayed intact. Not sure if this part of the problem but what is your DEMANDLOAD set to?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 15:19:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8984073#M85673</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-23T15:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8984093#M85674</link>
      <description>&lt;P&gt;Hey!&amp;nbsp; DEMANDLOAD is set to 3 for me. I just noticed something and wanted to share it, if you look at the file path across the top of the screen in the video link autocad actually changes where my file is at when that I use the publish command... this is crazy.. follow my mouse and you will see that it starts on the "H:" drive (where it should stay) then after I publish the file path changes to a temp folder on my "C:" drive.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/a/i9jL7mm" target="_blank" rel="noopener"&gt;https://imgur.com/a/i9jL7mm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 15:30:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8984093#M85674</guid>
      <dc:creator>Jonathan.Gray68UQW</dc:creator>
      <dc:date>2019-08-23T15:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Update hyperlink based on field text.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8984290#M85675</link>
      <description>&lt;P&gt;Give this a try .. will not update if the path is on C drive.&lt;/P&gt;&lt;PRE&gt;(defun updatefield (/ s str)
  ;; RJP » 2019-08-07
  (cond	((and (/= "C" (strcase (substr (getvar 'dwgprefix) 1 1)))
	      (setq s (ssget "_X" '((0 . "mtext,text") (1 . "@:\*.dwg*"))))
	 )
	 (regapp "PE_URL")
	 (setq str (strcat (getvar 'dwgprefix) (getvar 'dwgname)))
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (entmod (append (entget x)
			   (list (list -3
				       (list "PE_URL"
					     (cons 1000 str)
					     '(1002 . "{")
					     (cons 1000 str)
					     '(1002 . "{")
					     '(1071 . 1)
					     '(1002 . "}")
					     '(1002 . "}")
				       )
				 )
			   )
		   )
	   )
	 )
	)
  )
  (princ)
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:17:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-hyperlink-based-on-field-text/m-p/8984290#M85675</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-08-23T17:17:47Z</dc:date>
    </item>
  </channel>
</rss>

