(Defun C:Ts ()
  (Setvar "Cmdecho" 0)
  (Initget 1 "A S  ")
  (Setq G (Strcase (Substr (Getkword "Auswahl/<Stil>: ") 1 1)))
  (Cond
    ((= G "A")
      (Setq A (Ssget))
      (Setq B (Sslength A))
      (Initget 1) (Setq C (Getstring "\nNeuer Textstil: "))
      (Extang C)
      (While
        (> B 0)
          (Setq B (1- B))
          (Setq D (Ssname A B))
          (Setq D (Entget D))
          (Setq E (Assoc 7 D))
          (Setq F (Cons 7 C))
          (Setq D (Subst F E D))
          (Setq H (Assoc 51 D))
          (Setq I (Cons 51 J))
          (Entmod (Subst I H D))
      )
      (Setq A nil)
    )
    ((Or (= G "S") (= G ""))
      (Initget 1)
      (Setq A (Strcase (Getstring "\nAlter Textstil: ")))
      (Initget 1) (Setq C (Getstring "\nNeuer Textstil: "))
      (Setq D (Entnext))
      (Extang C)
      (While
        D
          (Princ ".")
          (Setq E (Entget D))
          (If
            (And (= "TEXT" (Cdr (Assoc 0 E))) (= A (Cdr (Assoc 7 E))))
              (Progn
                (Setq F (Assoc 7 E))
                (Setq G (Cons 7 C))
                (Setq E (Subst G F E))
                (Setq H (Assoc 51 E))
                (Setq I (Cons 51 J))
                (Entmod (Subst I H E))
              )
          )
          (Setq D (Entnext D))
      )
    )
  )  
  (Princ)
)

(Defun Extang (A)
  (Setq A (Tblsearch "STYLE" A))
  (Setq J (Cdr (Assoc 50 A)))
)
