;Tip1704a: SUPERCLIP.LSP Super clip command (c)2001, Justin D. Andrews ;This file contains 2 programs: ; ;(CLIP) Wblocks out your choice of clip file (0-9). File is saved in C:\ CHANGE to suit ; directory as CLIP0-CLIP9. ;(PASTE) Inserts your choice of clip file (0-9). ; ;This program works similar to the CUTCLIP command. It allows you to quickly save out ;10 different files/blocks using CLIP. Any of these files/blocks can then be quickly ;inserted into your drawing using PASTE. The program can run with or without the dialog ;boxes. The toggle switch on the dialog boxes will turn off the dialog box (paste and ;clip dialog boxes can be turned off or on separately). When in the non-dialog box mode ;(or command line mode) you can turn on or off the dialog boxes by typing at the ;clip file selection prompt (directly after the command "clip" or "paste" is typed). ; : ;***The file superclip.dcl must be placed in your AutoCAD support directory.*** ;(example = C:/Program Files/AutoCAD R14/SUPPORT) ; ; ;*****FILE PATHS MUST BE VERIFIED. SEE MARKED SECTIONS BELOW.***** ; ; ;The program provides a optional description for each file/block. Because no preview ;is available with a file that is created with WBLOCK, this description will help identify ;the correct clip file (it is easy to forget which of the 10 files you used). The file ;description option is helpful when files will be used over a long time period. ; ;When the dialog boxes are active, the settings for the auto-EXPLODE and auto-OOPS options ;will be remembered even if AutoCAD is restarted. ; ;The following options can be customized through a setup option found in both programs ;(these options are found in the SETUP section when the dialog box is turned off). ; ; Clip dialog box toggle = ON or OFF ; Paste dialog box toggle = ON or OFF ; (*The following options are only used when the dialog box is turned off.*) ; File description option = ON or OFF ; Explode block when inserted = Ask-default ON, Ask-default OFF, Do not Ask-default ON, or ; Do not Ask-default OFF ; Leave selected objects in drawing = Ask-default ON, Ask-default OFF, Do not Ask-default ON, or ; Do not Ask-default OFF ; ; ;If you want to autoload this program place the following code in your acad.lsp or ;acadr14.lsp file. ; ;(remove semicolons) ;-------------------------------------------------- ; ;(autoload "SUPERCLIP" '("SCLIP" "PASTE")) ; ;-------------------------------------------------- ; ;****Optional**** ;If you want to use the CLIP and PASTE icons then paste the following code into your ;currently used *.mns file (example = C:/Program Files/AutoCAD R14/SUPPORT/acad.mns) ;It is easiest if you paste the text into the **TB__STANDARD_TOOLBAR ;then you can move the icons to any other toolbar using AutoCAD's toolbar customization ;options (right clicking on a icon). (Your *.mns file can be opened in Wordpad and the ;correct toolbar can be found using the FIND command - search for the above text ^ ) ; ;(remove semicolons) ;-------------------------------------------------- ; ;ID__S-CLIP [_Button("Super Clip-Clip", "clip.bmp", "clip.bmp")]^C^Cclip ;ID__S-PASTE [_Button("Super Clip-Paste", "paste.bmp", "paste.bmp")]^C^Cpaste ; ;-------------------------------------------------- ;The clip.bmp and paste.bmp files must be in a supported AutoCAD directory. ;************************************************************************************* ; CLIP ;************************************************************************************* ;------------------------------------------------------------------------------------- (defun C:WC (/ $ERROR OLDECHO OLDOSMODE LOG-CHECK SET-CHECK DIALOG-BOX FILE-SELECT SETUP-OPTIONS SET-SAVE DESCRIP-LIST DESCRIP-OPTION DESCRIP-ASSIGN OOPS-ASK FILE-CREATE OOPS-COMMAND CLIP-LOG CLIP-LOG0 CLIP-LOG1 CLIP-LOG2 CLIP-LOG3 CLIP-LOG4 CLIP-LOG5 CLIP-LOG6 CLIP-LOG7 CLIP-LOG8 CLIP-LOG9 CLIP-SET DIALOG-SWITCH-CLIP DIALOG-SWITCH-PASTE DESCRIP-SWITCH EXPLODE-SWITCH OOPS-SWITCH D-EXPLODE-SWITCH D-OOPS-SWITCH DIA-1 DIA--1 DESCRIP DIALOG-C LIST-REP TYPE--1 OPTION--1 CLIP-SET OOPS--1 FILE-TYPE FILE--1 POINT--1 SET--1) ;------------------------------------------------------------------------------------- (defun $ERROR (MSG /) (if (or (= MSG "Function cancelled") (/= MSG "quit / exit abort")) (princ (strcat "Error: " MSG "\n")) ) (command-s "_.undo" _"e" "_undo" "") (setvar "cmdecho" OLDECHO) (setvar "osmode" OLDOSMODE) (setq *ERROR* OLD_ERR OLDECHO NIL ) (princ) ) ;------------------------------------------------------------------------------------- (defun LOG-CHECK () (setq CLIP-LOG (findfile (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt"))) ;;modify to suit ;;;*Verify path* (if (= CLIP-LOG NIL) (progn (setq CLIP-LOG (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (close CLIP-LOG) ) ) (setq CLIP-LOG (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt") ;;modify to suit "r")) ;;;*Verify path* (setq CLIP-LOG1 (read-line CLIP-LOG)) (setq CLIP-LOG2 (read-line CLIP-LOG)) (setq CLIP-LOG3 (read-line CLIP-LOG)) (setq CLIP-LOG4 (read-line CLIP-LOG)) (setq CLIP-LOG5 (read-line CLIP-LOG)) (setq CLIP-LOG6 (read-line CLIP-LOG)) (setq CLIP-LOG7 (read-line CLIP-LOG)) (setq CLIP-LOG8 (read-line CLIP-LOG)) (setq CLIP-LOG9 (read-line CLIP-LOG)) (setq CLIP-LOG0 (read-line CLIP-LOG)) (close CLIP-LOG) ) ;------------------------------------------------------------------------------------- (defun SET-CHECK () (setq CLIP-SET (findfile (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt"))) ;;modify to suit ;;;*Verify path* (if (= CLIP-SET NIL) (progn (setq CLIP-SET (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line "ON" CLIP-SET) (write-line "ON" CLIP-SET) (write-line "ON" CLIP-SET) (write-line "Ask-Default YES" CLIP-SET) (write-line "Ask-Default YES" CLIP-SET) (write-line "explode-on" CLIP-SET) (write-line "oops-on" CLIP-SET) (close CLIP-SET) ) ) (setq CLIP-SET (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt") ;;modify to suit "r")) ;;;*Verify path* (setq DIALOG-SWITCH-CLIP (read-line CLIP-SET)) (setq DIALOG-SWITCH-PASTE (read-line CLIP-SET)) (setq DESCRIP-SWITCH (read-line CLIP-SET)) (setq EXPLODE-SWITCH (read-line CLIP-SET)) (setq OOPS-SWITCH (read-line CLIP-SET)) (setq D-EXPLODE-SWITCH (read-line CLIP-SET)) (setq D-OOPS-SWITCH (read-line CLIP-SET)) (close CLIP-SET) ) ;------------------------------------------------------------------------------------- (defun DIALOG-BOX () (setq DIA-1 (load_dialog "superclip.dcl")) (if (not (new_dialog "sclipclip" DIA-1)) (exit) ) (set_tile "descrip1" CLIP-LOG1) (set_tile "descrip2" CLIP-LOG2) (set_tile "descrip3" CLIP-LOG3) (set_tile "descrip4" CLIP-LOG4) (set_tile "descrip5" CLIP-LOG5) (set_tile "descrip6" CLIP-LOG6) (set_tile "descrip7" CLIP-LOG7) (set_tile "descrip8" CLIP-LOG8) (set_tile "descrip9" CLIP-LOG9) (set_tile "descrip0" CLIP-LOG0) (if (= D-OOPS-SWITCH "oops-on") (set_tile "oops-on" "1") ) (if (= D-OOPS-SWITCH "oops-off") (set_tile "oops-off" "1") ) (action_tile "dia-switch-clip" "(setq DIA--1 $value)") (action_tile "1" "(setq TYPE--1 $key)") (action_tile "2" "(setq TYPE--1 $key)") (action_tile "3" "(setq TYPE--1 $key)") (action_tile "4" "(setq TYPE--1 $key)") (action_tile "5" "(setq TYPE--1 $key)") (action_tile "6" "(setq TYPE--1 $key)") (action_tile "7" "(setq TYPE--1 $key)") (action_tile "8" "(setq TYPE--1 $key)") (action_tile "9" "(setq TYPE--1 $key)") (action_tile "0" "(setq TYPE--1 $key)") (action_tile "description" "(setq DESCRIP $value)") (action_tile "oops-on" "(setq D-OOPS-SWITCH $key)") (action_tile "oops-off" "(setq D-OOPS-SWITCH $key)") (action_tile "accept" "(done_dialog)") (action_tile "cancel" "(setq DIALOG-C $value)") (start_dialog) (unload_dialog DIA-1) (if (= DIALOG-C "1") (exit) ) (if (= DIA--1 "1") (setq DIALOG-SWITCH-CLIP "OFF") ) (if (= DIA--1 "0") (setq DIALOG-SWITCH-CLIP "ON") ) (SET-SAVE) ) ;------------------------------------------------------------------------------------- (defun FILE-SELECT () (setq LIST-REP 1) (while (= LIST-REP 1) (initget 1 "1 2 3 4 5 6 7 8 9 0 ? setup") ;;File selection (prompt "\nType to view a list of file descriptions. *Type to enter setup*") (setq TYPE--1 (getkword "\nType the number of the clip file [Clip/WBLOCK]: (1,2,3,4,5,6,7,8,9,0) ")) (graphscr) (if (and (/= TYPE--1 "?") (/= TYPE--1 "setup")) (setq LIST-REP 0) ) (SETUP-OPTIONS) (SET-SAVE) (DESCRIP-LIST) ) ) ;------------------------------------------------------------------------------------- (defun SETUP-OPTIONS () (if (= TYPE--1 "setup") (progn (setq OPTION--1 0) (while (/= OPTION--1 NIL) (textscr) (prompt "\n\n\n ***SuperClip Setup Options***\n") (prompt "\nYou can change the following options:\n") (prompt "\n<1> Clip dialog box toggle - ") (prompt DIALOG-SWITCH-CLIP) (prompt "\n<2> Paste dialog box toggle - ") (prompt DIALOG-SWITCH-PASTE) (prompt "\n\n *The following options are only used when the dialog box is turned off.*\n") (prompt "\n<3> File description option - ") (prompt DESCRIP-SWITCH) (prompt "\n<4> Explode block when inserted (auto EXPLODE) - ") (prompt EXPLODE-SWITCH) (prompt "\n<5> Leave selected objects in drawing (auto OOPS) - ") (prompt OOPS-SWITCH) (initget "1 2 3 4 5") (setq OPTION--1 (getkword "\n\nEnter the number of the option you want to change ( exit setup): ")) (if (= OPTION--1 "1") (progn (initget 1 "on off") (setq DIALOG-SWITCH-CLIP (strcase (getkword "\nClip dialog box toggle - next use (ON/OFF): "))) ) ) (if (= OPTION--1 "2") (progn (initget 1 "on off") (setq DIALOG-SWITCH-PASTE (strcase (getkword "\nPaste dialog box toggle - next use (ON/OFF): "))) ) ) (if (= OPTION--1 "3") (progn (initget 1 "on off") (setq DESCRIP-SWITCH (strcase (getkword "\nFile description option (ON/OFF): "))) ) ) (if (= OPTION--1 "4") (progn (initget 1 "1 2 3 4") (setq EXPLODE-SWITCH (getkword "\nAuto EXPLODE (1=ASK-YES, 2=ASK-NO, 3=NO ASK-YES or 4=NO ASK-NO): ")) (if (= EXPLODE-SWITCH "1") (setq EXPLODE-SWITCH "Ask-Default YES") ) (if (= EXPLODE-SWITCH "2") (setq EXPLODE-SWITCH "Ask-Default NO") ) (if (= EXPLODE-SWITCH "3") (setq EXPLODE-SWITCH "Do not Ask-Default YES") ) (if (= EXPLODE-SWITCH "4") (setq EXPLODE-SWITCH "Do not Ask-Default NO") ) ) ) (if (= OPTION--1 "5") (progn (initget 1 "1 2 3 4") (setq OOPS-SWITCH (getkword "\nAuto OOPS (1=ASK-YES, 2=ASK-NO, 3=NO ASK-YES or 4=NO ASK-NO): ")) (if (= OOPS-SWITCH "1") (setq OOPS-SWITCH "Ask-Default YES") ) (if (= OOPS-SWITCH "2") (setq OOPS-SWITCH "Ask-Default NO") ) (if (= OOPS-SWITCH "3") (setq OOPS-SWITCH "Do not Ask-Default YES") ) (if (= OOPS-SWITCH "4") (setq OOPS-SWITCH "Do not Ask-Default NO") ) ) ) ) (graphscr) ) ) ) ;------------------------------------------------------------------------------------- (defun SET-SAVE () (setq CLIP-SET (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line DIALOG-SWITCH-CLIP CLIP-SET) (write-line DIALOG-SWITCH-PASTE CLIP-SET) (write-line DESCRIP-SWITCH CLIP-SET) (write-line EXPLODE-SWITCH CLIP-SET) (write-line OOPS-SWITCH CLIP-SET) (write-line D-EXPLODE-SWITCH CLIP-SET) (write-line D-OOPS-SWITCH CLIP-SET) (close CLIP-SET) ) ;------------------------------------------------------------------------------------- (defun DESCRIP-LIST () (if (= TYPE--1 "?") (progn (textscr) (prompt "\n\n ***Clip File Descriptions***\n") (if (= DESCRIP-SWITCH "OFF") (prompt "\n (File Description has been DISABLED)\n") ) (prompt "\nFile 1: ") (prompt CLIP-LOG1) (prompt "\nFile 2: ") (prompt CLIP-LOG2) (prompt "\nFile 3: ") (prompt CLIP-LOG3) (prompt "\nFile 4: ") (prompt CLIP-LOG4) (prompt "\nFile 5: ") (prompt CLIP-LOG5) (prompt "\nFile 6: ") (prompt CLIP-LOG6) (prompt "\nFile 7: ") (prompt CLIP-LOG7) (prompt "\nFile 8: ") (prompt CLIP-LOG8) (prompt "\nFile 9: ") (prompt CLIP-LOG9) (prompt "\nFile 0: ") (prompt CLIP-LOG0) (prompt "\n\n") ) ) ) ;------------------------------------------------------------------------------------- (defun DESCRIP-OPTION () (if (= DESCRIP-SWITCH "ON") (progn (if (= TYPE--1 "1") (setq DESCRIP CLIP-LOG1) ) (if (= TYPE--1 "2") (setq DESCRIP CLIP-LOG2) ) (if (= TYPE--1 "3") (setq DESCRIP CLIP-LOG3) ) (if (= TYPE--1 "4") (setq DESCRIP CLIP-LOG4) ) (if (= TYPE--1 "5") (setq DESCRIP CLIP-LOG5) ) (if (= TYPE--1 "6") (setq DESCRIP CLIP-LOG6) ) (if (= TYPE--1 "7") (setq DESCRIP CLIP-LOG7) ) (if (= TYPE--1 "8") (setq DESCRIP CLIP-LOG8) ) (if (= TYPE--1 "9") (setq DESCRIP CLIP-LOG9) ) (if (= TYPE--1 "0") (setq DESCRIP CLIP-LOG0) ) (prompt "\nOld clip file-") (prompt TYPE--1) (prompt " description: ") (prompt DESCRIP) (setq DESCRIP (getstring t "\nType a short description ( to skip): ")) ) ) ) ;------------------------------------------------------------------------------------- (defun DESCRIP-ASSIGN () (if (= DESCRIP-SWITCH "OFF") (setq DESCRIP "-") ) (if (or (= DESCRIP "") (= DESCRIP NIL)) (setq DESCRIP "-") ) (if (= TYPE--1 "1") (setq CLIP-LOG1 DESCRIP) ) (if (= TYPE--1 "2") (setq CLIP-LOG2 DESCRIP) ) (if (= TYPE--1 "3") (setq CLIP-LOG3 DESCRIP) ) (if (= TYPE--1 "4") (setq CLIP-LOG4 DESCRIP) ) (if (= TYPE--1 "5") (setq CLIP-LOG5 DESCRIP) ) (if (= TYPE--1 "6") (setq CLIP-LOG6 DESCRIP) ) (if (= TYPE--1 "7") (setq CLIP-LOG7 DESCRIP) ) (if (= TYPE--1 "8") (setq CLIP-LOG8 DESCRIP) ) (if (= TYPE--1 "9") (setq CLIP-LOG9 DESCRIP) ) (if (= TYPE--1 "0") (setq CLIP-LOG0 DESCRIP) ) ) ;------------------------------------------------------------------------------------- (defun OOPS-ASK () (initget "Yes No") (if (= OOPS-SWITCH "Ask-Default YES") (progn (setq OOPS--1 (strcase (getstring "\nLeave selected objects in drawing [OOPS] (Y or N)? "))) (if (= OOPS--1 "") (setq OOPS--1 "Y") ) ) ) (if (= OOPS-SWITCH "Ask-Default NO") (progn (setq OOPS--1 (strcase (getstring "\nLeave selected objects in drawing [OOPS] (Y or N)? "))) (if (= OOPS--1 "") (setq OOPS--1 "N") ) ) ) ) ;------------------------------------------------------------------------------------- (defun FILE-CREATE () (if (/= SET--1 NIL) (progn (setq CLIP-LOG (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line CLIP-LOG1 CLIP-LOG) (write-line CLIP-LOG2 CLIP-LOG) (write-line CLIP-LOG3 CLIP-LOG) (write-line CLIP-LOG4 CLIP-LOG) (write-line CLIP-LOG5 CLIP-LOG) (write-line CLIP-LOG6 CLIP-LOG) (write-line CLIP-LOG7 CLIP-LOG) (write-line CLIP-LOG8 CLIP-LOG) (write-line CLIP-LOG9 CLIP-LOG) (write-line CLIP-LOG0 CLIP-LOG) (close CLIP-LOG) (if (= TYPE--1 "1") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP1.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "2") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP2.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "3") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP3.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "4") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP4.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "5") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP5.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "6") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP6.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "7") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP7.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "8") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP8.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "9") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP9.dwg")) ;;modify to suit ;;;*Verify path* ) (if (= TYPE--1 "0") (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP0.dwg")) ;;modify to suit ;;;*Verify path* ) (setq FILE--1 (findfile FILE-TYPE)) (if (= FILE--1 NIL) (command-s "_.WBLOCK" FILE-TYPE "" POINT--1 SET--1 "") ) (if (/= FILE--1 NIL) (command-s "_.WBLOCK" FILE-TYPE "_Y" "" POINT--1 SET--1 "") ) ) ) ) ;------------------------------------------------------------------------------------- (defun OOPS-COMMAND () (if (or (= OOPS--1 "Y") (= OOPS--1 "YES")) (command-s "_.OOPS") ) (if (and (= OOPS-SWITCH "Do not Ask-Default YES") (= DIALOG-SWITCH-CLIP "OFF")) (command-s "_.OOPS") ) (if (and (= D-OOPS-SWITCH "oops-on") (= DIALOG-SWITCH-CLIP "ON")) (command-s "_.OOPS") ) ) ;------------------------------------------------------------------------------------- ; ; Main body of program. ; ;------------------------------------------------------------------------------------- (command-s "_.undo" "_be") (setq OLDECHO (getvar "cmdecho") OLDOSMODE (getvar "osmode") OLD_ERR *ERROR* *ERROR* $ERROR ) (setvar "cmdecho" 0) (setvar "osmode" 0) ;------------------------------------------------------------------------------------- (prompt "\n*SuperClip - The 10 File Clipboard* 1999 Justin Andrews\n") (LOG-CHECK) (SET-CHECK) (if (= DIALOG-SWITCH-CLIP "ON") (DIALOG-BOX) ) (if (and (= DIALOG-SWITCH-CLIP "OFF") (/= DIA--1 "1")) (progn (FILE-SELECT) (DESCRIP-OPTION) (OOPS-ASK) ) ) (if (/= TYPE--1 NIL) (progn (initget 1) (setq POINT--1 (getpoint "\nInsertion base point: ")) (setq SET--1 (ssget)) ;;Object(s) selection (if (= SET--1 NIL) (prompt "\n*No obects were selected, clip file not created*") ) (DESCRIP-ASSIGN) (FILE-CREATE) (OOPS-COMMAND) ) ) (if (= TYPE--1 NIL) (prompt "\n*No clip file selected*\n") ) ;------------------------------------------------------------------------------------- (command-s "_.undo" "_e") (setq *ERROR* OLD_ERR OLD_ERR NIL) (setvar "cmdecho" OLDECHO) (setvar "osmode" OLDOSMODE) (princ) ) ;************************************************************************************* ; PASTE ;************************************************************************************* ;------------------------------------------------------------------------------------- (defun C:WP (/ $ERROR OLDECHO OLDATTREQ LOG-CHECK SET-CHECK DIALOG-BOX PURGE-FILES SETUP-OPTIONS SET-SAVE DESCRIP-LIST FILE-SELECT FILE-CHECK LAST--1 BLOCK-ALERT EXPLODE-ASK FILE-INSERT EXPLODE-COMMAND CLIP-LOG CLIP-LOG0 CLIP-LOG1 CLIP-LOG2 CLIP-LOG3 CLIP-LOG4 CLIP-LOG5 CLIP-LOG6 CLIP-LOG7 CLIP-LOG8 CLIP-LOG9 CLIP-SET DIALOG-SWITCH-CLIP DIALOG-SWITCH-PASTE DESCRIP-SWITCH EXPLODE-SWITCH OOPS-SWITCH D-EXPLODE-SWITCH D-OOPS-SWITCH DIA-1 DIA--1 TYPE--1 DIALOG-C OPTION--1 CLIP-SET LIST-REP FILE-TYPE BLOCK--1 ALERT-MESS1 FILE--1 BLOCK-CHECK ALERT-MESS2 GO-AHEAD EXPL--1) ;------------------------------------------------------------------------------------- (defun $ERROR (MSG /) (if (or (= MSG "Function cancelled") (/= MSG "quit / exit abort")) (princ (strcat "Error: " MSG "\n")) ) (command-s "_.undo" "_e" "_undo" "") (setvar "cmdecho" OLDECHO) (setvar "attreq" OLDATTREQ) (setq *ERROR* OLD_ERR OLDECHO NIL ) (princ) ) ;------------------------------------------------------------------------------------- (defun LOG-CHECK () (setq CLIP-LOG (findfile (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt"))) ;;modify to suit ;;;*Verify path* (if (= CLIP-LOG NIL) (progn (setq CLIP-LOG (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (write-line "-" CLIP-LOG) (close CLIP-LOG) ) ) (setq CLIP-LOG (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-log.txt") ;;modify to suit "r")) ;;;*Verify path* (setq CLIP-LOG1 (read-line CLIP-LOG)) (setq CLIP-LOG2 (read-line CLIP-LOG)) (setq CLIP-LOG3 (read-line CLIP-LOG)) (setq CLIP-LOG4 (read-line CLIP-LOG)) (setq CLIP-LOG5 (read-line CLIP-LOG)) (setq CLIP-LOG6 (read-line CLIP-LOG)) (setq CLIP-LOG7 (read-line CLIP-LOG)) (setq CLIP-LOG8 (read-line CLIP-LOG)) (setq CLIP-LOG9 (read-line CLIP-LOG)) (setq CLIP-LOG0 (read-line CLIP-LOG)) (close CLIP-LOG) ) ;------------------------------------------------------------------------------------- (defun SET-CHECK () (setq CLIP-SET (findfile (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt"))) ;;modify to suit ;;;*Verify path* (if (= CLIP-SET NIL) (progn (setq CLIP-SET (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line "ON" CLIP-SET) (write-line "ON" CLIP-SET) (write-line "ON" CLIP-SET) (write-line "Ask-Default YES" CLIP-SET) (write-line "Ask-Default YES" CLIP-SET) (write-line "explode-on" CLIP-SET) (write-line "oops-on" CLIP-SET) (close CLIP-SET) ) ) (setq CLIP-SET (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt") ;;modify to suit "r")) ;;;*Verify path* (setq DIALOG-SWITCH-CLIP (read-line CLIP-SET)) (setq DIALOG-SWITCH-PASTE (read-line CLIP-SET)) (setq DESCRIP-SWITCH (read-line CLIP-SET)) (setq EXPLODE-SWITCH (read-line CLIP-SET)) (setq OOPS-SWITCH (read-line CLIP-SET)) (setq D-EXPLODE-SWITCH (read-line CLIP-SET)) (setq D-OOPS-SWITCH (read-line CLIP-SET)) (close CLIP-SET) ) ;------------------------------------------------------------------------------------- (defun DIALOG-BOX () (setq DIA-1 (load_dialog "superclip.dcl")) (if (not (new_dialog "sclippaste" DIA-1)) (exit) ) (set_tile "descrip1" CLIP-LOG1) (set_tile "descrip2" CLIP-LOG2) (set_tile "descrip3" CLIP-LOG3) (set_tile "descrip4" CLIP-LOG4) (set_tile "descrip5" CLIP-LOG5) (set_tile "descrip6" CLIP-LOG6) (set_tile "descrip7" CLIP-LOG7) (set_tile "descrip8" CLIP-LOG8) (set_tile "descrip9" CLIP-LOG9) (set_tile "descrip0" CLIP-LOG0) (if (= D-EXPLODE-SWITCH "explode-on") (set_tile "explode-on" "1") ) (if (= D-EXPLODE-SWITCH "explode-off") (set_tile "explode-off" "1") ) (action_tile "dia-switch-paste" "(setq DIA--1 $value)") (action_tile "1" "(setq TYPE--1 $key)") (action_tile "2" "(setq TYPE--1 $key)") (action_tile "3" "(setq TYPE--1 $key)") (action_tile "4" "(setq TYPE--1 $key)") (action_tile "5" "(setq TYPE--1 $key)") (action_tile "6" "(setq TYPE--1 $key)") (action_tile "7" "(setq TYPE--1 $key)") (action_tile "8" "(setq TYPE--1 $key)") (action_tile "9" "(setq TYPE--1 $key)") (action_tile "0" "(setq TYPE--1 $key)") (action_tile "explode-on" "(setq D-EXPLODE-SWITCH $key)") (action_tile "explode-off" "(setq D-EXPLODE-SWITCH $key)") (action_tile "accept" "(done_dialog)") (action_tile "cancel" "(setq DIALOG-C $value)") (start_dialog) (unload_dialog DIA-1) (if (= DIALOG-C "1") (exit) ) (if (= DIA--1 "1") (setq DIALOG-SWITCH-PASTE "OFF") ) (if (= DIA--1 "0") (setq DIALOG-SWITCH-PASTE "ON") ) (SET-SAVE) ) ;------------------------------------------------------------------------------------- (defun PURGE-FILES () (command-s "_.purge" "_b" "clip1,clip2,clip3,clip4,clip5,clip6,clip7,clip8,clip9,clip0" "_n") (prompt "\nPurging unused clip files from drawing.\n") ) ;------------------------------------------------------------------------------------- (defun SETUP-OPTIONS () (if (= TYPE--1 "setup") (progn (setq OPTION--1 0) (while (/= OPTION--1 NIL) (textscr) (prompt "\n\n\n ***SuperClip Setup Options***\n") (prompt "\nYou can change the following options:\n") (prompt "\n<1> Clip dialog box toggle - ") (prompt DIALOG-SWITCH-CLIP) (prompt "\n<2> Paste dialog box toggle - ") (prompt DIALOG-SWITCH-PASTE) (prompt "\n\n *The following options are only used when the dialog box is turned off.*\n") (prompt "\n<3> File description option - ") (prompt DESCRIP-SWITCH) (prompt "\n<4> Explode block when inserted (auto EXPLODE) - ") (prompt EXPLODE-SWITCH) (prompt "\n<5> Leave selected objects in drawing (auto OOPS) - ") (prompt OOPS-SWITCH) (initget "1 2 3 4 5") (setq OPTION--1 (getkword "\n\nEnter the number of the option you want to change ( exit setup): ")) (if (= OPTION--1 "1") (progn (initget 1 "on off") (setq DIALOG-SWITCH-CLIP (strcase (getkword "\nClip dialog box toggle - next use (ON/OFF): "))) ) ) (if (= OPTION--1 "2") (progn (initget 1 "on off") (setq DIALOG-SWITCH-PASTE (strcase (getkword "\nPaste dialog box toggle - next use (ON/OFF): "))) ) ) (if (= OPTION--1 "3") (progn (initget 1 "on off") (setq DESCRIP-SWITCH (strcase (getkword "\nFile description option (ON/OFF): "))) ) ) (if (= OPTION--1 "4") (progn (initget 1 "1 2 3 4") (setq EXPLODE-SWITCH (getkword "\nAuto EXPLODE (1=ASK-YES, 2=ASK-NO, 3=NO ASK-YES or 4=NO ASK-NO): ")) (if (= EXPLODE-SWITCH "1") (setq EXPLODE-SWITCH "Ask-Default YES") ) (if (= EXPLODE-SWITCH "2") (setq EXPLODE-SWITCH "Ask-Default NO") ) (if (= EXPLODE-SWITCH "3") (setq EXPLODE-SWITCH "Do not Ask-Default YES") ) (if (= EXPLODE-SWITCH "4") (setq EXPLODE-SWITCH "Do not Ask-Default NO") ) ) ) (if (= OPTION--1 "5") (progn (initget 1 "1 2 3 4") (setq OOPS-SWITCH (getkword "\nAuto OOPS (1=ASK-YES, 2=ASK-NO, 3=NO ASK-YES or 4=NO ASK-NO): ")) (if (= OOPS-SWITCH "1") (setq OOPS-SWITCH "Ask-Default YES") ) (if (= OOPS-SWITCH "2") (setq OOPS-SWITCH "Ask-Default NO") ) (if (= OOPS-SWITCH "3") (setq OOPS-SWITCH "Do not Ask-Default YES") ) (if (= OOPS-SWITCH "4") (setq OOPS-SWITCH "Do not Ask-Default NO") ) ) ) ) (graphscr) ) ) ) ;------------------------------------------------------------------------------------- (defun SET-SAVE () (setq CLIP-SET (open (strcat (getvar "MYDOCUMENTSPREFIX") "\\Clip-set.txt") ;;modify to suit "w")) ;;;*Verify path* (write-line DIALOG-SWITCH-CLIP CLIP-SET) (write-line DIALOG-SWITCH-PASTE CLIP-SET) (write-line DESCRIP-SWITCH CLIP-SET) (write-line EXPLODE-SWITCH CLIP-SET) (write-line OOPS-SWITCH CLIP-SET) (write-line D-EXPLODE-SWITCH CLIP-SET) (write-line D-OOPS-SWITCH CLIP-SET) (close CLIP-SET) ) ;------------------------------------------------------------------------------------- (defun DESCRIP-LIST () (if (= TYPE--1 "?") (progn (textscr) (prompt "\n\n ***Clip File Descriptions***\n") (if (= DESCRIP-SWITCH "OFF") (prompt "\n (File Description has been DISABLED)\n") ) (prompt "\nFile 1: ") (prompt CLIP-LOG1) (prompt "\nFile 2: ") (prompt CLIP-LOG2) (prompt "\nFile 3: ") (prompt CLIP-LOG3) (prompt "\nFile 4: ") (prompt CLIP-LOG4) (prompt "\nFile 5: ") (prompt CLIP-LOG5) (prompt "\nFile 6: ") (prompt CLIP-LOG6) (prompt "\nFile 7: ") (prompt CLIP-LOG7) (prompt "\nFile 8: ") (prompt CLIP-LOG8) (prompt "\nFile 9: ") (prompt CLIP-LOG9) (prompt "\nFile 0: ") (prompt CLIP-LOG0) (prompt "\n\n") ) ) ) ;------------------------------------------------------------------------------------- (defun FILE-SELECT () (setq LIST-REP 1) (while (= LIST-REP 1) (initget 1 "1 2 3 4 5 6 7 8 9 0 ? setup") ;;File selection (prompt "\nType to view a list of file descriptions. *Type to enter setup*") (setq TYPE--1 (getkword "\nType the number of the clip file [Paste/INSERT]: (1,2,3,4,5,6,7,8,9,0) ")) (graphscr) (if (and (/= TYPE--1 "?") (/= TYPE--1 "setup")) (setq LIST-REP 0) ) (SETUP-OPTIONS) (SET-SAVE) (DESCRIP-LIST) ) ) ;------------------------------------------------------------------------------------- (defun FILE-CHECK () (if (= TYPE--1 "1") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP1.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip1") ) ) (if (= TYPE--1 "2") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP2.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip2") ) ) (if (= TYPE--1 "3") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP3.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip3") ) ) (if (= TYPE--1 "4") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP4.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip4") ) ) (if (= TYPE--1 "5") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP5.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip5") ) ) (if (= TYPE--1 "6") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP6.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip6") ) ) (if (= TYPE--1 "7") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP7.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip7") ) ) (if (= TYPE--1 "8") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP8.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip8") ) ) (if (= TYPE--1 "9") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP9.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip9") ) ) (if (= TYPE--1 "0") (progn (setq FILE-TYPE (strcat (getvar "MYDOCUMENTSPREFIX") "\\CLIP0.dwg")) ;;modify to suit ;;;*Verify path* (setq BLOCK--1 "clip0") ) ) (setq FILE--1 (findfile FILE-TYPE)) ;;Checks for existing file (if (= FILE--1 NIL) (progn (setq ALERT--MESS1 (strcat "Clip file (" BLOCK--1 ") does not exist!")) (alert ALERT--MESS1) (exit) ) ) ) ;------------------------------------------------------------------------------------- (defun BLOCK-ALERT () (setq BLOCK-CHECK (tblsearch "block" BLOCK--1)) (if (/= BLOCK-CHECK NIL) (progn (setq ALERT--MESS2 (strcat "Clip file (" BLOCK--1 ") already exists in the drawing!")) (alert ALERT--MESS2) (initget "Yes No") (prompt "\nTo avoid this problem: explode or erase existing clip file/block(s).") (prompt "\n***Inserting this file will insert the block which is already in the drawing***") (setq GO-AHEAD (strcase (getstring "\nDo you want to insert the old block (Y or N)? "))) (if (or (= GO-AHEAD "") (= GO-AHEAD "YES")) (setq GO-AHEAD "Y") ) ) ) ) ;------------------------------------------------------------------------------------- (defun EXPLODE-ASK () (initget "Yes No") (if (= EXPLODE-SWITCH "Ask-Default YES") (progn (setq EXPL--1 (strcase (getstring "\nDo you want to exploded this block after insertion (Y or N)? "))) (if (= EXPL--1 "") (setq EXPL--1 "Y") ) ) ) (if (= EXPLODE-SWITCH "Ask-Default NO") (progn (setq EXPL--1 (strcase (getstring "\nDo you want to exploded this block after insertion (Y or N)? "))) (if (= EXPL--1 "") (setq EXPL--1 "N") ) ) ) ) ;------------------------------------------------------------------------------------- (defun FILE-INSERT () (setvar "cmdecho" 1) (command-s "_.-insert" FILE--1 PAUSE PAUSE PAUSE PAUSE) (setvar "cmdecho" 0) (setq LAST--1 (entlast)) ) ;------------------------------------------------------------------------------------- (defun EXPLODE-COMMAND () (if (or (= EXPL--1 "Y") (= EXPL--1 "YES")) (command-s "_.EXPLODE" LAST--1) ) (if (and (= EXPLODE-SWITCH "Do not Ask-Default YES") (= DIALOG-SWITCH-PASTE "OFF")) (command-s "_.EXPLODE" LAST--1) ) (if (and (= D-EXPLODE-SWITCH "explode-on") (= DIALOG-SWITCH-PASTE "ON")) (command-s "_.EXPLODE" LAST--1) ) ) ;------------------------------------------------------------------------------------- ; Main body of program. ;------------------------------------------------------------------------------------- (command-s "_.undo" "_be") (setq OLDECHO (getvar "cmdecho") OLDATTREQ (getvar "attreq") OLD_ERR *ERROR* *ERROR* $ERROR ) (setvar "cmdecho" 0) (setvar "attreq" 0) ;------------------------------------------------------------------------------------- (prompt "\n*SuperClip - The 10 File Clipboard* 1999 Justin Andrews\n") (LOG-CHECK) (SET-CHECK) (if (= DIALOG-SWITCH-PASTE "ON") (progn (DIALOG-BOX) (if (/= TYPE--1 NIL) (progn (PURGE-FILES) (FILE-CHECK) (BLOCK-ALERT) (if (/= FILE--1 NIL) (if (or (= GO-AHEAD NIL) (= GO-AHEAD "Y")) (progn (FILE-INSERT) (EXPLODE-COMMAND) ) ) ) ) ) ) ) (if (and (= DIALOG-SWITCH-PASTE "OFF") (/= DIA--1 "1")) (progn (PURGE-FILES) (FILE-SELECT) (FILE-CHECK) (BLOCK-ALERT) (if (/= FILE--1 NIL) (if (or (= GO-AHEAD NIL) (= GO-AHEAD "Y")) (progn (EXPLODE-ASK) (FILE-INSERT) (EXPLODE-COMMAND) ) ) ) ) ) (if (= TYPE--1 NIL) (prompt "\n*No clip file selected*\n") ) ;------------------------------------------------------------------------------------- (command-s "_.undo" "_e") (setq *ERROR* OLD_ERR OLD_ERR NIL) (setvar "cmdecho" OLDECHO) (setvar "attreq" OLDATTREQ) (princ) )