Lisp file stringp 81 issue when trying to reuse the file

Lisp file stringp 81 issue when trying to reuse the file

ryanrettig
Contributor Contributor
529 Views
6 Replies
Message 1 of 7

Lisp file stringp 81 issue when trying to reuse the file

ryanrettig
Contributor
Contributor

I have a lisp file that is a variation of the renumber (renum) lisp file. I use this for updating things like speaker chains. example being the first in a chain being 101A, then 101B etc. The issue is when I go to the next speaker chain and restart the file it crashes and gives the stringp 81 issue. I have included a copy of the LISP file and the blocks I typically use this with.lisp.png

0 Likes
Accepted solutions (1)
530 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor

line 42 rra:Start is defined as a number:

  (if (not rra:Start) (setq rra:Start 65)); capital A
line 56 fails because rra:Start is coded as a string:
 (setq rra:Start (ascii rra:Start)); else
try changing this to:
    (setq rra:Start (ascii rltrStart)); else

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

My guess:  Your (ascii rra:Start) just above the exception message should be using the User's anything-other-than-Enter input, i.e. (ascii rltrStart).

Kent Cooper, AIA
Message 4 of 7

ryanrettig
Contributor
Contributor

t


@paullimapa wrote:

line 42 rra:Start is defined as a number:

  (if (not rra:Start) (setq rra:Start 65)); capital A
line 56 fails because rra:Start is coded as a string:
 (setq rra:Start (ascii rra:Start)); else
try changing this to:
 (setq rra:Start (itoa rra:Start)); else

you had suggested to change (ascii rra:Start)); else

to (itoa rra:Start)); else. this gave the same result of the file crash but a different error. I now receive fixnump: nill with line 57 highlighted. I am not very well versed in LISP so this is a learning curve for me. This file originally instead of the letters would start at whatever number you input and count up from there. This is an attempt to adapt that same file to use letters instead. 

0 Likes
Message 5 of 7

paullimapa
Mentor
Mentor

I agree with @Kent1Cooper 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 7

ryanrettig
Contributor
Contributor

Thank you, I went back and made the adjustment, looked back through the code previous to it and makes complete sense. the if statement has rltrStart but I was missing it in the else statement. Tested and works. 

0 Likes
Message 7 of 7

Kent1Cooper
Consultant
Consultant

It also occurs to me that you might want to add a check on whether the string the User entered for the rltrStart variable is only one character.  The (ascii) function will accept a longer string, but it will return the ASCII value for only the first character in it.  If the User bumped two keys accidentally, the one they intended might not be the first one that registered, so they could get unintended results.

Kent Cooper, AIA
0 Likes