home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / autocad / magic20.arj / LOAD.TXT < prev    next >
Text File  |  1991-10-02  |  6KB  |  164 lines

  1. ;;;**************************************************************************
  2. ;;;   LOAD.TXT
  3. ;;;   (C) 1991 by Walt Craig
  4. ;;;
  5. ;;;   A part of the 
  6. ;;;           MAGIC LISP -- AutoLISP ADS Function Library
  7. ;;; 
  8. ;;;   Conceived and implemented by:
  9. ;;;           Walt Craig 
  10. ;;;           May/June 1991
  11. ;;;
  12. ;;;**************************************************************************
  13. ;;;   Permission to use, copy, modify, and distribute this software and its    
  14. ;;;   documentation for the purpose of creating applications for AutoCAD, is   
  15. ;;;   hereby granted in accordance with the terms of the stated during
  16. ;;;   installation.
  17. ;;;                                                                            
  18. ;;;**************************************************************************
  19. ;;;                                                                            
  20. ;;;   WALT CRAIG PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. WALT CRAIG    
  21. ;;;   SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR       
  22. ;;;   FITNESS FOR A PARTICULAR USE.  WALT CRAIG DOES NOT WARRANT THAT       
  23. ;;;   THE OPERATION OF THE PROGRAM WILL BE UNNINTERRUPTED OR ERROR FREE.     
  24. ;;;                                                                           
  25. ;;;**************************************************************************
  26. ;;;                                                                           
  27. ;;;                        RESTRICTED RIGHTS LEGEND                          
  28. ;;;                                                                           
  29. ;;;   Use, duplication, or disclosure by the U.S. Government is subject        
  30. ;;;   to restrictions set forth in FAR 52.227-19 (Commerical Computer          
  31. ;;;   Software - Restricted Rights) and DFAR 252.227-7013 (c) (1) (ii)         
  32. ;;;   (Rights in Technical Data and Computer Software), as applicable.         
  33. ;;;                                                                           
  34. ;;;**************************************************************************
  35. ;;;   
  36. ;;; DESCRIPTION
  37. ;;;
  38. ;;;   LOAD.TXT is a sample program which illustrates the use of
  39. ;;;   various MAGIC functions. 
  40. ;;;   
  41. ;;;   This program will prompt the user for a lisp file to load. If the 
  42. ;;;   file is found, it is then loaded into AutoCAD via. 'load'.
  43. ;;;   
  44. ;;;   This program undefines the 'LOAD' command in AutoCAD.
  45. ;;;                                                                      
  46. ;;;   (load "loadl")
  47. ;;;   load
  48. ;;;
  49. ;;;*************************************************************************
  50. ;;;* A simple text single lisp file loader ...  modify it as you see fit.  *
  51. ;;;*****************************    Variables    ***************************
  52. (defun c:load(/ file lst temp ret dbtest strings flag)
  53. (if WC_
  54.   (progn
  55.      (setq dbtest (strcat "WC" "_"))
  56.      (if(eval(read dbtest)) ;Is this the _debug_ version?
  57.         (c:clear);This helps if your doing a lot of KIT programming
  58.      )
  59.      (if(/= (WC_ ".VERSION") "I V1.5")
  60.         (progn
  61.            (princ "\nIncompatible KIT's");
  62.            (grread)
  63.            (quit)
  64.         )
  65.      )
  66.      (setvar "cmdecho" 0)
  67.      (textscr)
  68.      (if (/= (cadr (WC_ ".GETMODE")) 7)
  69.      (WC_ ".SETCOLORS"
  70.           (list
  71.                 _WHITE                  ;forward text color
  72.                 _BLUE ;<<--- FOR CLS    ;background color
  73.                 _RED                    ;border background color
  74.                 _GREEN                  ;border text color
  75.                 _BLACK                  ;hilited text color
  76.                 _CYAN                   ;hilited background color
  77.           )
  78.      ))
  79.      (setq 
  80.         _F1            15104
  81.         _F10           17408
  82.         _ESCKEY        283
  83.         _ENTER         7181
  84.         _CANCEL        11779
  85.         _SPACE         14624
  86.      )
  87.      (WC_ ".CLS")
  88.      (WC_ ".SETNUMERIC" 0)
  89.      (WC_ ".SETSPEED" 50)
  90.      (WC_ ".WINDOW" 10 11 65 13 1 1)
  91.      (WC_ ".RELATIVE" 1)
  92.      (WC_ ".DISPLAY" 1 1 "Enter file name: ")
  93.      (WC_ ".TITLE" 0 " AutoLISP Pretty Load ");
  94.      (WC_ ".TITLE" 1 " ENTER or SPACE ");
  95.      (WC_ ".SETUPBOX" 28 12 63 12)
  96.      (WC_ ".SETDENYS" (list _ENTER _ESCKEY _CANCEL _SPACE))
  97.      (WC_ ".CLEANUP"); Forces the editor to exept box not window..!
  98.      (setq strings '("") flag 't)
  99.      (setq lst (list ""))    ;New file 
  100.      (while flag
  101.         (setq ret(WC_ ".EDIT" lst)
  102.            strings(cdr ret)
  103.            ret (car ret) 
  104.         )
  105.         (if (or(= ret _ESCKEY)(= ret _CANCEL))
  106.            (setq flag nil)
  107.         )
  108.         (if (/= (nth 0 strings) "")
  109.            (setq flag nil)
  110.         )
  111.      )
  112.      (WC_ ".NOCURSOR")
  113.      (if (or(= ret _ENTER)(= ret _SPACE))
  114.         (progn
  115.            (setq temp (nth 0 strings))
  116.            (if (not (findfile (strcat temp ".lsp")))
  117.               (progn
  118.                  (WC_ ".CLS")
  119.                  (WC_ ".MESSAGE" (strcat "File: " temp ".lsp not found!") 0)
  120.               )
  121.               (progn
  122.                  (command(load temp))
  123.                  (WC_ ".CLS")
  124.                  (WC_ ".MESSAGE" (strcat "The file "temp" has been reloaded.") 1)
  125.               )
  126.            )
  127.         )
  128.         (WC_ ".CLS")
  129.      )
  130.      (WC_ ".ONCURSOR")
  131.   )
  132.   (progn
  133.      (princ "\nNo KIT FOUND!");
  134.   )
  135. )
  136. (prin1)
  137. )
  138.   
  139. (if (not WC_)
  140.   (progn
  141.      (xload "_DEBUG_")
  142.      (if (/= (setq str(WC_ ".VERSION")) "I V1.5")
  143.         (progn
  144.            (princ "\nIncompatable KIT version!");
  145.            (xunload "_DEBUG_");
  146.         )
  147.         (eval(read(WC_ ".WCINIT")))
  148.      )
  149.   )
  150.   (progn
  151.      (WC_ ".message" " Type 'LOAD' to start " 0)
  152.      (eval(read(WC_ ".WCINIT")))
  153.   )
  154. )
  155. (setvar "cmdecho" 0)
  156. (command "undefine" "load")
  157. (prin1)
  158.   
  159.   
  160.   
  161.   
  162.   
  163.  
  164.