Cad64 发表于 2022-7-6 12:06:21

Thanks guys.
 
Alan yours worked fine.
 
Lee, I loaded yours and tried to run it but it failed, saying "the operation has been cancelled". Probably just missing a parentheses or something?

Lee Mac 发表于 2022-7-6 12:09:44

All works fine for me Rod.
 
Bear in mind that mine and Alan's share a global that is of different data type in each case, so don't test one after the other.
 
Open a new drawing before testing mine/his.

alanjt 发表于 2022-7-6 12:12:56

 
 
Much nicer. However, I think you'll have problems if you hit enter at the getstring prompt since it will return "" instead of nil.
 
Maybe something like this...

(setq gStr (lambda (/ s)            (if (eq ""                      (setq s (getstring (strcat "\nSpecify Starting Number: ")))                  ) ;_ eq                *start                s            ) ;_ if            ) ;_ lambda ) ;_ setq

alanjt 发表于 2022-7-6 12:15:50

 
 
Type: (setq *start nil) then test.
 
I wasn't thinking broad enough. Mine would only correct something like 6 to 06 but ignore something like 006.

Lee Mac 发表于 2022-7-6 12:17:58

Good point about the getstring - that construct was a remnant of the getint prompt... - code updated.

Cad64 发表于 2022-7-6 12:20:45

Ok, I tried it in a new drawing and discovered two problems.
 
As Alan stated, if you hit enter at the command prompt, nothing happens. It won't accept the default shown in brackets. And also, once you get to 09, if you click on the next block in succession, it won't change to 10, it just stops working.

Cad64 发表于 2022-7-6 12:25:45

Ok, the updated code fixed the first problem of hitting enter at the command prompt, but the second problem still exists. You can't continue auto-numbering past 09. The routine just quits.

Lee Mac 发表于 2022-7-6 12:29:28

Another silly mistake- cheers Rod - I think I kinda rushed this one...
 
Code updated.

Cad64 发表于 2022-7-6 12:31:40

Ok, it's working now. Thanks again for your help.

Lee Mac 发表于 2022-7-6 12:35:35

 
Glad we got there in the end... can't believe the amount of mistakes in my first code... unbelieveable
页: 1 [2]
查看完整版本: Modify current routine-block a