Author Topic: Can Spaces be used in "GETSTRING"?  (Read 5812 times)

0 Members and 1 Guest are viewing this topic.

A_LOTA_NOTA

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #15 on: August 03, 2007, 03:43:47 PM »
Texteval??

set to "0"
« Last Edit: August 03, 2007, 03:45:03 PM by A_LOTA_NOTA »

A_LOTA_NOTA

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #16 on: August 03, 2007, 03:51:13 PM »
What happens if you press !T at the command line?

I suspect you are not doing something correctly as AutoCAD always interprets the space as a string if you are using the T in the getstring command.

It works perfectly for me here ... perhaps you are making your variable S local to some code ... it is really hard to guess what could be wrong without a little help from you, other than "it don't work". ... maybe a copyclip from the command line, the code you are trying to put it in, a screen shot, something ... anything ... will be better than nothing.

I it enter "!T" it returns "T".

I pasted the code that Matt posted in to Visual LISP. I ran the code and when I enter " 1234" when promted the "Alert Box" is blank. But if I enter " A1234" it works fine.
« Last Edit: August 03, 2007, 03:58:12 PM by A_LOTA_NOTA »

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Can Spaces be used in "GETSTRING"?
« Reply #17 on: August 03, 2007, 04:12:21 PM »
Ok .. now we are getting somewhere ... I think ...

on the command line, enter !getstring .. paste the results
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

A_LOTA_NOTA

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #18 on: August 03, 2007, 04:13:32 PM »
Ok .. now we are getting somewhere ... I think ...

on the command line, enter !getstring .. paste the results

Command: !GETSTRING
#<SUBR @05fbf658 GETSTRING>

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Can Spaces be used in "GETSTRING"?
« Reply #19 on: August 03, 2007, 04:19:57 PM »
Ok, lets look at what we know:
getstring is the default AutoCAD, i.e. not overwritten by a custom routine
T is indeed True
getstring returns correctly when value is not a number
getstring interprets spaces correctly
code is NOT part of a larger project (or is it)
S is not a global variable to another program (or is it)

Everything tells me that this should be operating as it is supposed to, and my gut instinct tells me that there is something amis, if you can indeed type the code at the command line and it works fine, but cannot load it through the IDE and have it work properly.

All sources of error have been eliminated so far as I can tell, so we must look at the other aspects, i.e. such as YOUR copy of the code you are trying to get to work from the IDE.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

A_LOTA_NOTA

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #20 on: August 03, 2007, 04:24:29 PM »
This is the code I have in the IDE....

(defun C:test ( / )
   (setq s (getstring T "What's your full name? "))
   (alert s)
   (princ)
)

I can copy the "getstring" line & past it at the command line & it works good. If I run it as posted above it will freeze ACAD for a few seconds.

What is the purpose of the ( / ) when no variables are listed?
« Last Edit: August 03, 2007, 04:31:33 PM by A_LOTA_NOTA »

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Can Spaces be used in "GETSTRING"?
« Reply #21 on: August 03, 2007, 04:32:31 PM »
strange, it seems to work fine for me either way
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

A_LOTA_NOTA

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #22 on: August 03, 2007, 04:54:05 PM »
strange, it seems to work fine for me either way

Thanks for the help. I would never intentionally put a leading space, but just wanted to make sure the program would handle if it is needed. That is the only reason I noticed the problem to begin with.
« Last Edit: August 03, 2007, 05:08:28 PM by A_LOTA_NOTA »

CADaver

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #23 on: August 03, 2007, 05:52:08 PM »
strange, it seems to work fine for me either way
and me

hmspe

  • Bull Frog
  • Posts: 362
Re: Can Spaces be used in "GETSTRING"?
« Reply #24 on: August 04, 2007, 11:20:19 AM »
Maybe the next question should be, "What version of Autocad are you running?"  Then, "Do you have more than one computer with Autocad loaded?"  If so, "Does the code work on the other computers?"

FWIW, the code in the 12:24:29pm post works perfectly for me under R2004.

Martin
"Science is the belief in the ignorance of experts." - Richard Feynman

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Can Spaces be used in "GETSTRING"?
« Reply #25 on: August 04, 2007, 02:03:57 PM »
I tried the code on R2000 and R2007, both work perfectly
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

A_LOTA_NOTA

  • Guest
Re: Can Spaces be used in "GETSTRING"?
« Reply #26 on: August 06, 2007, 01:21:42 PM »
Maybe the next question should be, "What version of Autocad are you running?"  Then, "Do you have more than one computer with Autocad loaded?"  If so, "Does the code work on the other computers?"

FWIW, the code in the 12:24:29pm post works perfectly for me under R2004.

Martin

I tried it on another computer & it worked fine. But on this one it has problems.