Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Starting String with Space in Getstring

7 REPLIES 7
Reply
Message 1 of 8
jmay1
758 Views, 7 Replies

Starting String with Space in Getstring

I have written a lisp routine to replace specified text with new text in single or multiple instances. I want the new text to start with a space, but getstring won't allow me to start with a space. I am using the argument 'T' to let me use spaces, but it just won't let me start with a space.
Anyone know how?
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: jmay1

works here

Command: (getstring t "\nenter text:")
enter text: asdf asdf sad
" asdf asdf sad"

--
Daron
Hold on to nothin' and hold it tight.
Message 3 of 8
jmay1
in reply to: jmay1

Thank you,
That works on the AutoCAD command line, but what about in the visual lisp console.
What am I missing?
Message 4 of 8
Anonymous
in reply to: jmay1

works here too. not sure what might be happening at your end.

_$ (setq STR (getstring t "\nEnter text:"))
" hello everyone :o)"
_$ STR
" hello everyone :o)"
_$

--
Daron
Hold on to nothin' and hold it tight.
Message 5 of 8
jmay1
in reply to: jmay1

Thanks for the help.
I tried all this in AutoCAD 2007 and everything worked fine.
2008 won't let me put the space first.
I loaded the service pack and that didn't help.
What version are you using?
Andy
Message 6 of 8
Anonymous
in reply to: jmay1

2008 w/SP1

--
Daron
Hold on to nothin' and hold it tight.



wrote in message news:5911676@discussion.autodesk.com...
Thanks for the help.
I tried all this in AutoCAD 2007 and everything worked fine.
2008 won't let me put the space first.
I loaded the service pack and that didn't help.
What version are you using?
Andy
Message 7 of 8
Anonymous
in reply to: jmay1

Works here at command line and in VLIDE with
(setq STR (getstring T "Enter text: "))

ACA 2008 SP1

Daron Denton wrote:
> 2008 w/SP1
>
Message 8 of 8
Kent1Cooper
in reply to: jmay1


@jmay1 wrote:
.... getstring won't allow me to start with a space. I am using the argument 'T' to let me use spaces, but it just won't let me start with a space.
Anyone know how?

[Resurrecting an old thread, but it was exactly what I was Searching for.]

 

I am finding the same problem in 2015 with dynamic entry out in the drawing by the crosshairs.  It won't allow a single space [which is what I have designated to mean "none"], nor will it keep either leading or trailing spaces [it does keep the rest], though it will allow internal spaces within the string.  If I go down to the Command: line, it works fine, even if I just move the cursor there without actually picking in it -- it's only by the crosshairs out in the drawing that it doesn't work.

 

The workaround is to turn Dynamic Prompts off [DYNPROMPT System Variable = 0], even if only for the duration of the (getstring) function.  Then what's typed goes in at the Command: line [without needing the cursor moved there first], instead of out there in the Dynamic spot, and all works as expected.  [Turning DYNMODE off works, too, but that turns off more aspects than needed for this issue.]

 

It should work as expected regardless of where you enter the string, so I consider this a bug, but until they fix it, there is at least a way to get around the problem.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost