@smitaranjan OK this is a bit more involved for the layout select - Give this a try:
I'm using Lee Mac's List Box V1.2 for the layout select dialog: https://www.lee-mac.com/listbox.html
(defun c:LLINK (/ ch e ll ly ss)
(vl-load-com)
(initget "Select All")
(if (not (setq ch (getkword "\nSelect a Single Layout or All [Select/All] <Select>: ")))(setq ch "Select"))
(cond
((= ch "Select")
(setq ll (layoutlist))
(if
(and
(setq ly (LM:listbox "Select a Layout to Link:" ll 0))
(setq ss (ssget))
)
(repeat (setq c (sslength ss))
(setq e (ssname ss (setq c (1- c))))
(vla-add
(vla-get-hyperlinks (vlax-ename->vla-object e))
"" ;; External Hyperlink
(strcat "Go to " (car ly)) ;; display description
(strcat "," (car ly)) ;; Named location in the document
)
)
)
)
((= ch "All")
(foreach n (layoutlist) ;; for each layout name,
(if (setq e (entsel (strcat "\nSelect Object to link to \"" n "\""))) ;; select an object to add the link
(vla-add
(vla-get-hyperlinks (vlax-ename->vla-object (car e)))
"" ;; External Hyperlink
(strcat "Go to " n) ;; display description
(strcat "," n) ;; Named location in the document
)
)
)
)
)
(princ)
)
;; List Box - Lee Mac
;; Displays a DCL list box allowing the user to make a selection from the supplied data.
;; msg - [str] Dialog label
;; lst - [lst] List of strings to display
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil
(defun LM:listbox ( msg lst bit / dch des tmp rtn )
(cond
( (not
(and
(setq tmp (vl-filename-mktemp nil nil ".dcl"))
(setq des (open tmp "w"))
(write-line
(strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
(if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}"
)
des
)
(not (close des))
(< 0 (setq dch (load_dialog tmp)))
(new_dialog "listbox" dch)
)
)
(prompt "\nError Loading List Box Dialog.")
)
( t
(start_list "list")
(foreach itm lst (add_list itm))
(end_list)
(setq rtn (set_tile "list" "0"))
(action_tile "list" "(setq rtn $value)")
(setq rtn
(if (= 1 (start_dialog))
(if (= 2 (logand 2 bit))
(read (strcat "(" rtn ")"))
(mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")")))
)
)
)
)
)
(if (< 0 dch)
(unload_dialog dch)
)
(if (and tmp (setq tmp (findfile tmp)))
(vl-file-delete tmp)
)
rtn
)