Author Topic: Text counting routine  (Read 3581 times)

0 Members and 1 Guest are viewing this topic.

AVillage-1

  • Guest
Text counting routine
« on: October 13, 2008, 05:15:18 PM »
Hello everyone,

I have lurked for quite a while; and learned a lot from all of you, and I want to first say thanks!

I think I have finally written a program that really could be useful to others.  I looked around and found a couple text counting routines out there but none seem to fit my needs; I have blocks pre-filled with -XXXX etc... from a client (so they can't be changed).  The ones I found, like Alpha-num.lsp, place new text, so I hacked this one together.

I hope you like; it's very rough at the moment and that's why I am here; for the life of me I cannot think up a way for it to increment multiple places in the entered string.

I am trying for something like this:
Entered string: TD[A][1;1]-[1;5]
Results: TDA1-1, TDB2-5, TDC3-10 etc.

Currently what works:
Entered String: TD[1] = TD1, TD2, TD3 etc...
Entered String: TD[1;1] = TD1, TD2, TD3 etc...
Entered String: TD[10;-1] = TD10, TD9, TD8 etc...
Entered String: TD[-5;1] = TD-5, TD-4, TD-3 etc...
Entered String: TD[-1;-1] = TD-1, TD-2, TD-3 etc...
Entered String: TD[A] = TDA, TDB, TDC etc...
Entered String: TD[A;1] = TDA, TDB, TDC etc...
Entered String: TD[F;-1] = TDF, TDE, TDC etc...
Entered String: TD[-A;1] = quietly goes poo

Phew, I didn't realize how exhausting that all was until I listed it here.

AVillage-1; I am the One!






 

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text counting routine
« Reply #1 on: October 13, 2008, 06:22:10 PM »
Welcome out of the shadows. :)

If no one gives you the answer I'll see what I can do tomorrow.
That looks like a tricky one though.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AVillage-1

  • Guest
Re: Text counting routine
« Reply #2 on: October 14, 2008, 10:49:57 AM »
I had a revelation last night and believe I have it figured out.

It now makes the list first with 8 or X selected text depending on what it has.

I duplicated the FIND_FIRST [] and reversed it to make a FIND_LAST []

It reads the first entry in the list and processes it to find the last set of brackets first then splits the value it into string-left NUM string-right and rebuilds the list. 

(("Enter text value here [1;1]-[2;2]")
 ("Enter text value here [1;1]-[2;2]")
 ("Enter text value here [1;1]-[2;2]"))

Becomes:
(("Enter text value here [1;1]-2")
 ("Enter text value here [1;1]-4")
 ("Enter text value here [1;1]-6"))

Then repeats until no more brackets are found.
(("Enter text value here 1-2")
 ("Enter text value here 2-4")
 ("Enter text value here 3-6"))

I start at the end so it doesn't matter if the length of the string changes due to 1, 10, 100, 1000 increments.

I will work on it and re-post but please feel free if you can see a way to make it better.

Sometimes sharing it with others changes my thought process.  :laugh:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text counting routine
« Reply #3 on: October 14, 2008, 11:06:30 AM »
Glad you have made progress.

You may find this of interest:
http://www.theswamp.org/index.php?topic=518.0
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AVillage-1

  • Guest
Re: Text counting routine
« Reply #4 on: June 10, 2009, 12:27:14 PM »
It has been a while since my original question and at last I have a working program, but as far as the useability turned out; it's a complete failure, 90% of my coworkers find it too confusing or complicated to use and are scared away.

I will share it with you all, as it's at least a different way of viewing the problem of text counting, and may be useful to others in the future.

Hope you like and if it doesn't work please let me know so I can work the bugs out!

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text counting routine
« Reply #5 on: June 10, 2009, 12:34:27 PM »
I get this on ACAD 2010 (Student Ver):

Quote
Command: atnum
; error: bad argument type: stringp nil

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Text counting routine
« Reply #6 on: June 10, 2009, 01:12:09 PM »
It has been a while since my original question and at last I have a working program...

I get this on ACAD 2010 (Student Ver):

Quote
Command: atnum
; error: bad argument type: stringp nil

<insert muted trumpet's sad wah-wah here...>   :roll: :-D
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text counting routine
« Reply #7 on: June 10, 2009, 01:43:53 PM »
^^ hahah this made me laugh  :lol:

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text counting routine
« Reply #8 on: June 10, 2009, 01:53:50 PM »
... 90% of my coworkers find it too confusing or complicated to use and are scared away....

I understand what you mean AVillage, I used to sometimes write LISP programs that I thought my colleagues would benefit from, but, when shown the finished product, they would just stick to the manual method.. too scared to dabble in LISP...   :|

AVillage-1

  • Guest
Re: Text counting routine
« Reply #9 on: June 10, 2009, 02:15:02 PM »
I didn't realize student versions would run lisp.  Unfortunately I only have 2008 to work from so I can not test that error out directly :-( I gather it happens as soon as you start the program, do you get to the dialog box at all?


Its not the lisp that they are afraid of its just too complicated of a user interface.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text counting routine
« Reply #10 on: June 10, 2009, 02:16:52 PM »
The Dialog Box flashes into view, then disappears immediately when the error appears - I'll have a quick look through your LISP, see if I see anything immediate  :-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Text counting routine
« Reply #11 on: June 10, 2009, 02:49:15 PM »
The Dialog Box flashes into view, then disappears immediately when the error appears - I'll have a quick look through your LISP, see if I see anything immediate  :-)

It's most likely one of the calls to ' set_tile ', which is expecting a string.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.