@johnw wrote:
The command worked once I removed the spaces on each side of the DASH!!!! It would be nice if the command would also recognize if there were spaces on each side of the dash as well, a space on one side of the dash or the other, just in case someone didn't follow procedure, if that's not too difficult to accomplish. Thank you.
Sure, Tell me, are there any other layout tab names that we need to consider ? a name that could be mistaken as a hit, something like "This-A" or "That-B", we can include this as part of this as suggested by@ВeekeeCZ
(setq never "COVID-19,TR-1,THIS-A,MOSTPRECIOUS,THAT-B,DELTA VARIANT")
or any other conditions that you may think of.
Times up 🙂
(Defun c:Delabc (/ opt msg never f)
(setq never "COVID-19,TR-1,THIS-A,MOSTPRECIOUS,THAT-B,DELTA VARIANT")
(initget 1 "A B C")
(setq msg "\nDelete "
opt (getkword
"\nChoose option [A | Delete B & C/B | Delete A & C/C | Delete A & B]: "
)
)
(Setq f (Cdr (assoc opt '(("A" "B" "C") ("B" "A" "C") ("C" "A" "B")))))
(setvar 'ctab "Model")
(foreach lay (Layoutlist) ;<-this is where the layout names are listed
(cond
((wcmatch lay never))
((vl-some '(lambda (p)
(if (wcmatch lay (Strcat p (car f) "," p (Cadr f) )) p))
'("*-" "*- "))
(command "_Layout" "_delete" lay)
)
)
)
(princ)
)