You want a LISP i'm guessing?
This also depends on which properties you want to be the same.
This chatgpt-lisp selects based on Layer, Colour and Object type
Doesn't seem to work for dynamic blocks though.
You could also just use Selectsimilar command and tweak it with SELECTSIMILARMODE
(defun c:SSAME ( / ent entData objType objLayer objColor blockName filter ss)
;; Step 1: Select an object
(setq ent (car (entsel "\nSelect object with desired properties: ")))
(if ent
(progn
(setq entData (entget ent))
(setq objType (cdr (assoc 0 entData))) ; Object type
(setq objLayer (cdr (assoc 8 entData))) ; Layer name
(setq objColor (cdr (assoc 62 entData))) ; ACI color
;; If it's a block reference, get the block name
(if (equal objType "INSERT")
(setq blockName (cdr (assoc 2 entData)))
)
;; Step 2: Build filter list
(setq filter (list (cons 0 objType)
(cons 8 objLayer)))
(if objColor
(setq filter (append filter (list (cons 62 objColor))))
)
(if blockName
(setq filter (append filter (list (cons 2 blockName))))
)
;; Step 3: Select matching objects
(setq ss (ssget "X" filter))
;; Step 4: Feedback
(if ss
(progn
(prompt (strcat "\nFound " (itoa (sslength ss)) " matching object(s)."))
(sssetfirst nil ss)
)
(prompt "\nNo matching objects found.")
)
)
(prompt "\nNothing selected.")
)
(princ)
)