Jump to content
bustr

; error: too many arguments

Recommended Posts

bustr

This is happening after I post the name of the lisp to the command line. I can't spot the error in it. It has always worked before. The lisp is supposed to search out text and attribute values and replace them. Can anyone spot the error?

 

(defun c:BUBBLER01 ()

 

(setq ss_blk (ssget "x" '((0 . "INSERT") (66 . 1))))

 

(if ss_blk

(progn

 

(setq lst_blk (sel2lst ss_blk))

 

(foreach en_blk lst_blk

 

(setq lst_atts (att2lst en_blk))

(setq str_line "")

(foreach en_atts lst_atts

(setq str_line (getval 1 en_atts))

(if (not (wcmatch str_line "*/*/*"))

(progn

 

(setq str_line (strchg str_line *01* * 5555501*))

(setq str_line (strchg str_line *02* * 5555502*))

(setq str_line (strchg str_line *03* * 5555503*))

(setq str_line (strchg str_line *04* * 5555504*))

(setq str_line (strchg str_line *05* * 5555505*))

(setq str_line (strchg str_line *06* * 5555506*))

(setq str_line (strchg str_line *07* * 5555507*))

(setq str_line (strchg str_line *08* * 5555508*))

(setq str_line (strchg str_line *09* * 5555509*))

(setq str_line (strchg str_line *10* * 5555510*))

(setq str_line (strchg str_line *11* * 5555511*))

(setq str_line (strchg str_line *12* * 5555512*))

(setq str_line (strchg str_line *13* * 5555513*))

(setq str_line (strchg str_line *14* * 5555514*))

(setq str_line (strchg str_line *15* * 5555515*))

(setq str_line (strchg str_line *16* * 5555516*))

(setq str_line (strchg str_line *17* * 5555517*))

(setq str_line (strchg str_line *18* * 5555518*))

(setq str_line (strchg str_line *19* * 5555519*))

(setq str_line (strchg str_line *20* * 5555520*))

(setq str_line (strchg str_line *21* * 5555521*))

(setq str_line (strchg str_line *22* * 5555522*))

(setq str_line (strchg str_line *23* * 5555523*))

(setq str_line (strchg str_line *24* * 5555524*))

(setq str_line (strchg str_line *25* * 5555525*))

(setq str_line (strchg str_line *26* * 5555526*))

(setq str_line (strchg str_line *27* * 5555527*))

(setq str_line (strchg str_line *28* * 5555528*))

(setq str_line (strchg str_line *29* * 5555529*))

(setq str_line (strchg str_line *30* * 5555530*))

(setq str_line (strchg str_line *31* * 5555531*))

(setq str_line (strchg str_line *32* * 5555532*))

(setq str_line (strchg str_line *33* * 5555533*))

(setq str_line (strchg str_line *34* * 5555534*))

(setq str_line (strchg str_line *35* * 5555535*))

(setq str_line (strchg str_line *36* * 5555536*))

(setq str_line (strchg str_line *37* * 5555537*))

(setq str_line (strchg str_line *38* * 5555538*))

(setq str_line (strchg str_line *39* * 5555539*))

(setq str_line (strchg str_line *40* * 5555540*))

(setq str_line (strchg str_line *41* * 5555541*))

(setq str_line (strchg str_line *42* * 5555542*))

(setq str_line (strchg str_line *43* * 5555543*))

(setq str_line (strchg str_line *44* * 5555544*))

(setq str_line (strchg str_line *45* * 5555545*))

(setq str_line (strchg str_line *46* * 5555546*))

(setq str_line (strchg str_line *47* * 5555547*))

(setq str_line (strchg str_line *48* * 5555548*))

(setq str_line (strchg str_line *49* * 5555549*))

(setq str_line (strchg str_line *50* * 5555550*))

(setq str_line (strchg str_line *51* * 5555551*))

(setq str_line (strchg str_line *52* * 5555552*))

(setq str_line (strchg str_line *53* * 5555553*))

(setq str_line (strchg str_line *54* * 5555554*))

(setq str_line (strchg str_line *55* * 5555555*))

(setq str_line (strchg str_line *56* * 5555556*))

(setq str_line (strchg str_line *57* * 5555557*))

(setq str_line (strchg str_line *58* * 5555558*))

(setq str_line (strchg str_line *59* * 5555559*))

(setq str_line (strchg str_line *60* * 5555560*))

(setq str_line (strchg str_line *61* * 5555561*))

(setq str_line (strchg str_line *62* * 5555562*))

(setq str_line (strchg str_line *63* * 5555563*))

(setq str_line (strchg str_line *64* * 5555564*))

(setq str_line (strchg str_line *65* * 5555565*))

(setq str_line (strchg str_line *66* * 5555566*))

(setq str_line (strchg str_line *67* * 5555567*))

(setq str_line (strchg str_line *68* * 5555568*))

(setq str_line (strchg str_line *69* * 5555569*))

(setq str_line (strchg str_line *70* * 5555570*))

(setq str_line (strchg str_line *71* * 5555571*))

(setq str_line (strchg str_line *72* * 5555572*))

(setq str_line (strchg str_line *73* * 5555573*))

(setq str_line (strchg str_line *74* * 5555574*))

(setq str_line (strchg str_line *75* * 5555575*))

(setq str_line (strchg str_line *76* * 5555576*))

(setq str_line (strchg str_line *77* * 5555577*))

 

(setval 1 str_line en_atts)

))))))

 

(setq ss_txtlines (ssget "x" '((0 . "TEXT"))))

 

(if ss_txtlines

(progn

 

(setq lst_txtlines (sel2lst ss_txtlines))

(setq str_line "")

 

(foreach en_txtlines lst_txtlines

 

(setq str_line (getval 1 en_txtlines))

(if (not (wcmatch str_line "*/*/*"))

(progn

 

(setq str_line (strchg str_line *01* * 5555501*))

(setq str_line (strchg str_line *02* * 5555502*))

(setq str_line (strchg str_line *03* * 5555503*))

(setq str_line (strchg str_line *04* * 5555504*))

(setq str_line (strchg str_line *05* * 5555505*))

(setq str_line (strchg str_line *06* * 5555506*))

(setq str_line (strchg str_line *07* * 5555507*))

(setq str_line (strchg str_line *08* * 5555508*))

(setq str_line (strchg str_line *09* * 5555509*))

(setq str_line (strchg str_line *10* * 5555510*))

(setq str_line (strchg str_line *11* * 5555511*))

(setq str_line (strchg str_line *12* * 5555512*))

(setq str_line (strchg str_line *13* * 5555513*))

(setq str_line (strchg str_line *14* * 5555514*))

(setq str_line (strchg str_line *15* * 5555515*))

(setq str_line (strchg str_line *16* * 5555516*))

(setq str_line (strchg str_line *17* * 5555517*))

(setq str_line (strchg str_line *18* * 5555518*))

(setq str_line (strchg str_line *19* * 5555519*))

(setq str_line (strchg str_line *20* * 5555520*))

(setq str_line (strchg str_line *21* * 5555521*))

(setq str_line (strchg str_line *22* * 5555522*))

(setq str_line (strchg str_line *23* * 5555523*))

(setq str_line (strchg str_line *24* * 5555524*))

(setq str_line (strchg str_line *25* * 5555525*))

(setq str_line (strchg str_line *26* * 5555526*))

(setq str_line (strchg str_line *27* * 5555527*))

(setq str_line (strchg str_line *28* * 5555528*))

(setq str_line (strchg str_line *29* * 5555529*))

(setq str_line (strchg str_line *30* * 5555530*))

(setq str_line (strchg str_line *31* * 5555531*))

(setq str_line (strchg str_line *32* * 5555532*))

(setq str_line (strchg str_line *33* * 5555533*))

(setq str_line (strchg str_line *34* * 5555534*))

(setq str_line (strchg str_line *35* * 5555535*))

(setq str_line (strchg str_line *36* * 5555536*))

(setq str_line (strchg str_line *37* * 5555537*))

(setq str_line (strchg str_line *38* * 5555538*))

(setq str_line (strchg str_line *39* * 5555539*))

(setq str_line (strchg str_line *40* * 5555540*))

(setq str_line (strchg str_line *41* * 5555541*))

(setq str_line (strchg str_line *42* * 5555542*))

(setq str_line (strchg str_line *43* * 5555543*))

(setq str_line (strchg str_line *44* * 5555544*))

(setq str_line (strchg str_line *45* * 5555545*))

(setq str_line (strchg str_line *46* * 5555546*))

(setq str_line (strchg str_line *47* * 5555547*))

(setq str_line (strchg str_line *48* * 5555548*))

(setq str_line (strchg str_line *49* * 5555549*))

(setq str_line (strchg str_line *50* * 5555550*))

(setq str_line (strchg str_line *51* * 5555551*))

(setq str_line (strchg str_line *52* * 5555552*))

(setq str_line (strchg str_line *53* * 5555553*))

(setq str_line (strchg str_line *54* * 5555554*))

(setq str_line (strchg str_line *55* * 5555555*))

(setq str_line (strchg str_line *56* * 5555556*))

(setq str_line (strchg str_line *57* * 5555557*))

(setq str_line (strchg str_line *58* * 5555558*))

(setq str_line (strchg str_line *59* * 5555559*))

(setq str_line (strchg str_line *60* * 5555560*))

(setq str_line (strchg str_line *61* * 5555561*))

(setq str_line (strchg str_line *62* * 5555562*))

(setq str_line (strchg str_line *63* * 5555563*))

(setq str_line (strchg str_line *64* * 5555564*))

(setq str_line (strchg str_line *65* * 5555565*))

(setq str_line (strchg str_line *66* * 5555566*))

(setq str_line (strchg str_line *67* * 5555567*))

(setq str_line (strchg str_line *68* * 5555568*))

(setq str_line (strchg str_line *69* * 5555569*))

(setq str_line (strchg str_line *70* * 5555570*))

(setq str_line (strchg str_line *71* * 5555571*))

(setq str_line (strchg str_line *72* * 5555572*))

(setq str_line (strchg str_line *73* * 5555573*))

(setq str_line (strchg str_line *74* * 5555574*))

(setq str_line (strchg str_line *75* * 5555575*))

(setq str_line (strchg str_line *76* * 5555576*))

(setq str_line (strchg str_line *77* * 5555577*))

 

(setval 1 str_line en_txtlines)

))))))

Share this post


Link to post
Share on other sites
Jef!

Hi Buster. Please use code tags.

 

On my side there is functions for which I don't have the definition (sel2lst, att2lst, getval, strchg, setval), so it is hard to debug a code without having it.

strchg also use a protected symbol which is *. If it meant as a string, it should be "*". If the idea is to pass the multiply operator, you have to use '*. Also good for the other arguments (like "*01*" and "5555501*")

 

Also note that even if it would be different symbols defined by your huge lists in between the progn statements

 

            (setq str_line (strchg str_line *01* * 5555501*))
           (setq str_line (strchg str_line *02* * 5555502*))
           (setq str_line (strchg str_line *03* * 5555503*))
           (setq str_line (strchg str_line *04* * 5555504*))
           (setq str_line (strchg str_line *05* * 5555505*))
           (setq str_line (strchg str_line *06* * 5555506*))
           (setq str_line (strchg str_line *07* * 5555507*))
           (setq str_line (strchg str_line *08* * 5555508*))
           (setq str_line (strchg str_line *09* * 5555509*))
           (setq str_line (strchg str_line *10* * 5555510*))
           (setq str_line (strchg str_line *11* * 5555511*))
           (setq str_line (strchg str_line *12* * 5555512*))
           (setq str_line (strchg str_line *13* * 5555513*))

 

for sure there would exist better alternatives (repeat, while, foreach). But as it seems, not only it would not be optimal, but if i interpret correctly "strchg" for stringchange, it seems you just change the value of the variable strline again and again maybe without doing anything with it?

Share this post


Link to post
Share on other sites
bustr

Still getting the same error

Share this post


Link to post
Share on other sites
bustr

Got rid of asteriks and added code and /code. Works now. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×