Hello,
My knowledge of lisp is nothing...so.
If it's possible, is anyone willing to show me a way to shorten this code with a loop?
Any help appreciated, Thanks.
Code:(defun c:EAB() (setq newfile111(getstring "\nFile name to open in z:\\AB\\xxx\\AB")) (setq newfile111(strcat "z:\\AB\\xxx\\AB" newfile111)) ;(command "qsave") (SETVAR "FILEDIA" 0) (SETQ FILE31 (FINDFILE (STRCAT NEWFILE111 "A" ".15" ".DWG"))) (SETQ FILE30 (FINDFILE (STRCAT NEWFILE111 "P" ".15" ".DWG"))) (SETQ FILE29 (FINDFILE (STRCAT NEWFILE111 "A" ".14" ".DWG"))) (SETQ FILE28 (FINDFILE (STRCAT NEWFILE111 "P" ".14" ".DWG"))) (SETQ FILE27 (FINDFILE (STRCAT NEWFILE111 "A" ".13" ".DWG"))) (SETQ FILE26 (FINDFILE (STRCAT NEWFILE111 "P" ".13" ".DWG"))) (SETQ FILE25 (FINDFILE (STRCAT NEWFILE111 "A" ".12" ".DWG"))) (SETQ FILE24 (FINDFILE (STRCAT NEWFILE111 "P" ".12" ".DWG"))) (SETQ FILE23 (FINDFILE (STRCAT NEWFILE111 "A" ".11" ".DWG"))) (SETQ FILE22 (FINDFILE (STRCAT NEWFILE111 "P" ".11" ".DWG"))) (SETQ FILE21 (FINDFILE (STRCAT NEWFILE111 "A" ".10" ".DWG"))) (SETQ FILE20 (FINDFILE (STRCAT NEWFILE111 "P" ".10" ".DWG"))) (SETQ FILE19 (FINDFILE (STRCAT NEWFILE111 "A" ".09" ".DWG"))) (SETQ FILE18 (FINDFILE (STRCAT NEWFILE111 "P" ".09" ".DWG"))) (SETQ FILE17 (FINDFILE (STRCAT NEWFILE111 "A" ".08" ".DWG"))) (SETQ FILE16 (FINDFILE (STRCAT NEWFILE111 "P" ".08" ".DWG"))) (SETQ FILE15 (FINDFILE (STRCAT NEWFILE111 "A" ".07" ".DWG"))) (SETQ FILE14 (FINDFILE (STRCAT NEWFILE111 "P" ".07" ".DWG"))) (SETQ FILE13 (FINDFILE (STRCAT NEWFILE111 "A" ".06" ".DWG"))) (SETQ FILE12 (FINDFILE (STRCAT NEWFILE111 "P" ".06" ".DWG"))) (SETQ FILE11 (FINDFILE (STRCAT NEWFILE111 "A" ".05" ".DWG"))) (SETQ FILE10 (FINDFILE (STRCAT NEWFILE111 "P" ".05" ".DWG"))) (SETQ FILE09 (FINDFILE (STRCAT NEWFILE111 "A" ".04" ".DWG"))) (SETQ FILE08 (FINDFILE (STRCAT NEWFILE111 "P" ".04" ".DWG"))) (SETQ FILE07 (FINDFILE (STRCAT NEWFILE111 "A" ".03" ".DWG"))) (SETQ FILE06 (FINDFILE (STRCAT NEWFILE111 "P" ".03" ".DWG"))) (SETQ FILE05 (FINDFILE (STRCAT NEWFILE111 "A" ".02" ".DWG"))) (SETQ FILE04 (FINDFILE (STRCAT NEWFILE111 "P" ".02" ".DWG"))) (SETQ FILE03 (FINDFILE (STRCAT NEWFILE111 "A" ".01" ".DWG"))) (SETQ FILE02 (FINDFILE (STRCAT NEWFILE111 "P" ".01" ".DWG"))) (SETQ FILE01 (FINDFILE (STRCAT NEWFILE111 "A" ".00" ".DWG"))) (SETQ FILE00 (FINDFILE (STRCAT NEWFILE111 "P" ".00" ".DWG"))) (SETQ FILE (FINDFILE (STRCAT NEWFILE111 "" ".DWG"))) (IF (/= FILE31 NIL) (PROGN (SETQ newfile111 FILE31) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE30 NIL) (PROGN (SETQ newfile111 FILE30) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE29 NIL) (PROGN (SETQ newfile111 FILE29) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE28 NIL) (PROGN (SETQ newfile111 FILE28) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE27 NIL) (PROGN (SETQ newfile111 FILE27) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE26 NIL) (PROGN (SETQ newfile111 FILE26) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE25 NIL) (PROGN (SETQ newfile111 FILE25) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE24 NIL) (PROGN (SETQ newfile111 FILE24) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE23 NIL) (PROGN (SETQ newfile111 FILE23) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE22 NIL) (PROGN (SETQ newfile111 FILE22) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE21 NIL) (PROGN (SETQ newfile111 FILE21) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE20 NIL) (PROGN (SETQ newfile111 FILE20) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE19 NIL) (PROGN (SETQ newfile111 FILE19) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE18 NIL) (PROGN (SETQ newfile111 FILE18) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE17 NIL) (PROGN (SETQ newfile111 FILE17) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE16 NIL) (PROGN (SETQ newfile111 FILE16) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE15 NIL) (PROGN (SETQ newfile111 FILE15) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE14 NIL) (PROGN (SETQ newfile111 FILE14) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE13 NIL) (PROGN (SETQ newfile111 FILE13) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE12 NIL) (PROGN (SETQ newfile111 FILE12) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE11 NIL) (PROGN (SETQ newfile111 FILE11) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE10 NIL) (PROGN (SETQ newfile111 FILE10) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE09 NIL) (PROGN (SETQ newfile111 FILE09) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE08 NIL) (PROGN (SETQ newfile111 FILE08) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE07 NIL) (PROGN (SETQ newfile111 FILE07) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE06 NIL) (PROGN (SETQ newfile111 FILE06) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE05 NIL) (PROGN (SETQ newfile111 FILE05) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE04 NIL) (PROGN (SETQ newfile111 FILE04) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE03 NIL) (PROGN (SETQ newfile111 FILE03) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE02 NIL) (PROGN (SETQ newfile111 FILE02) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE01 NIL) (PROGN (SETQ newfile111 FILE01) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE00 NIL) (PROGN (SETQ newfile111 FILE00) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (IF (/= FILE NIL) (PROGN (SETQ newfile111 FILE) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" newfile111 "\"")) (QUIT))) (SETQ DIALOG_FILE (getfiled "AB DRAWINGS" newfile111 "DWG" 4)) ;(SETQ DIALOG_FILE (STRCAT "z:\\AB\\xxx\\" DIALOG_FILE)) (command "vbastmt" (strcat "AcadApplication.Documents.Open " "\"" DIALOG_FILE "\"")) );END OF FUNCTION EAB