(setq i 1 acadver_bit (getenv "PROCESSOR_ARCHITECTURE") acadver_bit (substr acadver_bit (1- (strlen acadver_bit))))
(while (< i 24)
  (if (menucmd (strcat "P" (itoa i) ".1=?"))
    (setq i (1+ i))
    (progn
      (menucmd (strcat "p" (itoa i) "=+VetCAD++.POP1"))
      (setq i 25)
    )
  )
)

(if
  (not LOADVETCAD)
  (progn
    (setq acadver_for_vetcad (atof (substr (getvar "ACADVER") 1 4)))

      (cond
 	(
	   (and (>= acadver_for_vetcad 19.0) (<= acadver_for_vetcad 19.9))
	   (progn
	     (if (= acadver_bit "64")
 	        (setq startfile_vetcad "VetCAD13x64.arx")
 	        (setq startfile_vetcad "VetCAD13.arx")
	     )
	   )
	)
 	(
	   (and (>= acadver_for_vetcad 18.0) (<= acadver_for_vetcad 18.9))
	   (progn
	     (if (= acadver_bit "64")
 	        (setq startfile_vetcad "VetCAD10x64.arx")
 	        (setq startfile_vetcad "VetCAD10.arx")
	     )
	   )
	)
 	(
	   (and (>= acadver_for_vetcad 17.0) (<= acadver_for_vetcad 17.2))
	   (progn
	     (if (= acadver_bit "64")
 	        (setq startfile_vetcad "VetCAD8x64.arx")
 	        (setq startfile_vetcad "VetCAD7.arx")
	     )
	   )
	)
 	(
	   (and (>= acadver_for_vetcad 16.0) (<= acadver_for_vetcad 16.2))
	   (setq startfile_vetcad "VetCAD4.arx")
 	)
 	(
	   t
	   (setq startfile_vetcad "VetCAD.arx")
 	)
      )



    (setq i (findfile "SetupVetCAD_2004-2006.arx")
	  i (strcat (substr i 1 (- (strlen i) 25)) "App\\" startfile_vetcad)
    )
    (arxload i)
  )
)
(setq i nil acadver_for_vetcad nil startfile_vetcad nil acadver_bit nil)

(LOADVETCAD)
(princ)
