Here is one I did a while back but works with on/off not Freeze/Thaw.
;; User pick of layers to remain ON
;; Picked layers turn off as picked, when Enter is pressed
;; picked layers are turned on and all others are turned off
(defun c:layon (/ laylst ent lname)
;;=====================================
;; Turn Layer On/Off -
;;=====================================
;; lst is a list of layer names
(defun layon (lst / doc lname)
(vl-load-com) ; load ActiveX support
;; set vlax pointers
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
;; step through each layer
(vlax-for for-item (vla-get-layers doc) ;(vla-GetExtensionDictionary)
;; get the name of the layer
(setq lname (vlax-get-property for-item 'name))
;; if the name is in the 'Keep On' list
(if (member lname lst)
;; turn layer on
(vlax-put-property
(vla-item (vla-get-layers doc) lname)
'layeron :vlax-true) ; layer ON
;; ELSE turn layer off
(vlax-put-property
(vla-item (vla-get-layers doc) lname)
'layeron :vlax-false) ; layer OFF
) ; endif
) ; vlax-for
) ; defun
;;===================
;; Start of Routine
;;===================
(command ".undo" "begin")
(prompt "\nLayers picked will turn off during selection.")
(setq laylst '())
(while (setq ent (nentsel "\nPick layers to keep on. Enter when done"))
(setq laylst (cons (setq lname (cdr (assoc 8 (entget (car ent))))) laylst))
(command "._Layer" "_Off" lname "")
) ; while
(and laylst (layon laylst)) ; Turn layers Off
(command ".undo" "end")
(princ)
) ;defun
(prompt "\n*-* Layers On loaded, Enter LayOn to run. *-*")
(princ)