- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi good People!
I have rather ease problem, but still I cant get it done - Lisp deletes all Layouts from L.txt file(which I create from excel) but he also deletes some layouts that are not in the L.txt.. Weird, but I decided to precisely give "him" the names of Layouts that he will not delete... I would say that rather simple IF Statement will solve this, but still I dont know Lisp enough to make it work...already tried to cut some Lisps and add here, but after 3h I give up
-------CODE---------
(defun c:DeleteLayoutsNEW ( / fn fp lst l)
(setq exceptions ("Deckblatt" "Layout1" "Layout2" ....) ; the list of all Layouts that we will NOT delete
(setq fn (findfile "L.txt"))
;; Open the file and create an empty list
(setq fp (open fn "r") lst '())
;; Iterate the file, writing each line to the list
(while (setq l (read-line fp))
(setq lst (cons l lst))
)
;; Close the file.
(close fp)
(foreach x lst
(if (not ??? (strcase x) exceptions ))
);IF
(command "-LAYOUT" "D" x)
);foreach
);if
(princ)
);defun
Solved! Go to Solution.