If you're only running it in the document you have open and not trying to feed it multiple drawing files then try just this:
(untested)
(Defun C:deleteAllPageSetupsExcept (names)
(vlax-for pc (vla-get-plotconfigurations (vla-get-activedocument (vlax-get-acad-object)))
(if (not (member (vla-get-name pc) names))
(vla-delete pc)
)
)
)
EDIT:
Maybe I should explain a little.
A) Typically, you would define a function that you plan on passing arguments to without the C:. C: is to define a command. A function is called with lisp. So, this lisp should be defined as a function (no "C:")
(Defun deleteallpagestupsexcept (names) ...
Then, in a command that the user would actually use you could do something like:
(Defun C:DeleteAllPageSetupsExcept ( / list)
(while UserEntersNames
(setq list (addname to list)
);while
;then pass the list to your function
(deleteallpatestupsexcept list)
);defun
(obviously pseudocode)
B) The "Too few Arguments" error was because the command/function thing was asking for 2 arguments (defun C:deleteAllPageSetupsExcept (doc names) "doc" and "names" If you were only passing it a list of names then there were too few arguments because you were missing doc. See:
https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-AutoLISP/file...
Hope that explains a little better.
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)