; hplfnd search for all objects with matching hyperlinks ; OP: ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-all-objects-with-specific-hyperlink/m-p/12858768/highlight/true (defun c:hplfnd (/ $hyperlink -hyperlnk cmdflg dynmode ent entdata get_hyperlink n selopt ss ssfnd stropt) ; get hyperlink address passing entity as argument (defun get_hyperlink (ent-arg) (cdr (cadr (car (cdr(assoc -3 (entget ent-arg '("PE_URL"))))))) ) ; chk if preselection (setq cmdflg (ssget "_I") **selopt** "Enter" ss "https://www.autodesk.com/" ;; place your hyperlink address here ) (if (not ss) (progn ; dynamic input with selection options ; Also when you set dynmode to 1 or 3 during the getkword prompt ; when the cursor moves from the command prompt into the drawing area ; a cursor menu appears to choose from (if(<= (rem (getvar"dynmode") 2) 0) ; if even # chks negative value as well (progn (setq dynmode (getvar"dynmode")) ; save current setting (setvar "dynmode" 1) ; enable dynmode ) ) ; if (or **selopt** (setq **selopt** "Select")) (setq stropt "Enter Select") (setq selopt (vl-string-translate " " "/" stropt)) ; converts to "Enter/Select" (progn ; only need progn if testing code from command prompt (initget stropt) (setq **selopt** ; set new default (cond ; display in popup # selection option as cursor hovers over graphics area & highlite # selection options at command line ((getkword (strcat"\nURL Address To Find [" selopt "] <" **selopt** ">: "))) (**selopt**) ; else return original value ) ; cond ) ; setq ) ; progn ; Command prompt will show: ; Select One [Enter/Select]: ; Now you can select an option (if dynmode (setvar "dynmode" dynmode)) ; restore original dynmode setting (while(not ss) (if (eq **selopt** "Select") (progn (princ"\nSelect Object with Hyperlink to Match...") (setq ss (ssget "_+.:E:S" '((-3 ("PE_URL"))))) ) (progn (setq ss (getstring T "\nEnter URL Address: ")) (if(zerop(strlen ss))(setq ss nil)) ) ) ) ; while ) ; progn ) ; if (if ss (progn (if (eq **selopt** "Select") (setq -hyperlink (get_hyperlink (ssname ss 0))) ; get hyperlink from selection (setq -hyperlink ss) ) (if (setq ss (ssget "_X" (list (cons 410 (getvar"ctab")) '(-3 ("PE_URL"))))) ; select all objects with hyperlink in current tab (progn (setq ssfnd (ssadd)) (repeat (setq n (sslength ss)) (setq ent (ssname ss (setq n (1- n))) $hyperlink (get_hyperlink ent) ) (if (eq $hyperlink -hyperlink) (ssadd ent ssfnd) ) ) ; repeat (if (zerop (sslength ssfnd)) (princ(strcat"\nNo Objects Found with Matching URL Address:\n" -hyperlink)) (progn (if cmdflg (progn (sssetfirst nil)(vl-cmdf "_.Cmdecho" 1))) ; required to highlite ssfnd if preselection (princ(strcat"\nFound " (itoa (sslength ssfnd)) " Objects with Matching URL Address...")) (sssetfirst nil ssfnd) ) ) ) ; progn (princ"\nDrawing has NO Objects with URL Adress.") ) ; if ) ; progn (princ"\nNo URL Address given.") ) ; if (princ) ) ; defun