IMO the problem with your version is the fact that you are supplying multiple DXF 8 code specifications inside (ssget) filter, and knowing that DXF 8 code accepts only string value as (cdr) dotted pair specification, I may think that (ssget) function will therefore fail to process multiple DXF 8 code specifications... So as (cdr) value must be string and valid one, (ssget) function should work correctly if specification is supplied likewise (wcmatch) pattern string specification...
So something like this may be more desired and although untested, should be correct way of specifying (ssget) filter...
; another way to omit locked or frozen layers, without using ":L" ssget mode:
; Here we iterate thru the layer definitions (the other way is to iterate thru enames of the SS and check their layer's lock/freeze status - but it may be slower)
(defun C:test ( / ld ThawedOrUnLockedLayersString ThawedOrUnLockedLayers SSX ftLst )
(while (setq ld (tblnext "LAYER" (not ld)))
(if (not (or (= 4 (logand 4 (cdr (assoc 70 ld)))) (= 1 (logand 1 (cdr (assoc 70 ld))))))
(setq ThawedOrUnLockedLayers (cons (cdr (assoc 2 ld)) ThawedOrUnLockedLayers))
)
)
(if ThawedOrUnLockedLayers
(progn
(setq ThawedOrUnLockedLayersString "")
(foreach x (reverse (acad_strlsort ThawedOrUnLockedLayers))
(setq ThawedOrUnLockedLayersString (strcat ThawedOrUnLockedLayersString x ","))
)
(setq ThawedOrUnLockedLayersString (vl-string-right-trim "," ThawedOrUnLockedLayersString))
)
)
(if
(and
ThawedOrUnLockedLayers
(setq SSX
(ssget "_X"
(setq ftLst
(list
(cons -4 "<AND")
(cons 8 ThawedOrUnLockedLayersString)
(if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model"))
(cons -4 "AND>")
)
)
)
)
)
(sssetfirst nil SSX)
)
(princ)
);| defun |;
This is just my attempt, but if I was to code for thawed and unlocked layers, I would for sure use :
(if (cadr (sssetfirst nil (ssget "_A" ... )))
(sssetfirst nil (ssget "_:L"))
nil
)
Of course I would make sure that at least one layer is unlocked and thawed and has an entity that's possible to select before applying such routine that uses this shortcut snippet...