(DEFUN C:MATCH3 (/ QO# Q|# SSET Q%# Q?0)
;(F:MODS (quote ("cmdecho" "expert")))
 (SETVAR "expert" 1)
 (SETVAR "cmdecho" 0)
 (MENUCMD "s=aj01a")
 (IF LAO
  (PROGN
   (COMMAND "LAYER" "ON" LAO "")
   (PROMPT (STRCAT "\nLayer "LAO" turned on."))
   (SETQ LAO NIL)
  )
  (PROGN
   (PROMPT "\n \n \nSelect objects on layers that will be turned off: ")
   (SETQ SSET (SSGET))
   (IF SSET
    (PROGN
     (COMMAND "layer")
     (SETQ Q%# 0)
     (WHILE (SETQ Q|# (SSNAME SSET Q%#))
      (IF (= (SETQ Q?0 (CDR (ASSOC 8 (ENTGET Q|#)))) (GETVAR "clayer"))
       (PROGN
        (MENUCMD "s=au009s1")
        (INITGET "Yes No")
        (SETQ QO# (GETKWORD (STRCAT "\nReally want layer "Q?0"  (the CURRENT layer) off?  <No>: ")))
        (IF (AND (NOT (NULL QO#)) (= (STRCASE (SUBSTR QO# 1 1)) "Y"))
         (PROGN
          (COMMAND "off" Q?0)
          (IF (= Q%# 0)
           (SETQ LAO Q?0)
           (SETQ LAO (STRCAT LAO "," Q?0))
          )
         )
        )
       )
       (PROGN
        (COMMAND "off" Q?0)
        (IF (= Q%# 0)
         (SETQ LAO Q?0)
         (SETQ LAO (STRCAT LAO "," Q?0))
        )
       )
      )
      (SETQ Q%# (1+ Q%#))
     )
     (COMMAND)
     (IF LAO (PROMPT (STRCAT "\nLayer "LAO" turned off.")))
    )
    (PROMPT "\nNo object selected.")
   )
  )
 )
 (MENUCMD "s=s")
;(F:MODR)
 (PROMPT "\n \n \nProcessing completed. ")
 (PRINC)
)
