<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: getstring prompt in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640948#M232</link>
    <description>&lt;P&gt;Well, after all these years, I learned something new here.&lt;/P&gt;&lt;P&gt;The getstring returns only the "Y"&lt;/P&gt;&lt;P&gt;But the getkword returns the entire work "Yes" as it appears in the initget function&lt;/P&gt;</description>
    <pubDate>Tue, 20 May 2025 17:35:29 GMT</pubDate>
    <dc:creator>dvertz</dc:creator>
    <dc:date>2025-05-20T17:35:29Z</dc:date>
    <item>
      <title>getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640557#M222</link>
      <description>&lt;P&gt;Is there a way to use getstring and have a default that will also accept a null string?&lt;/P&gt;&lt;P&gt;For example, if issued the normal way as:&lt;/P&gt;&lt;P&gt;(setq pre (getstring "\nPrefix &amp;lt;C-&amp;gt;: "))&lt;/P&gt;&lt;P&gt;Then the normal way is check if the variable pre is null and if it is then set the variable pre to "C-1"&lt;/P&gt;&lt;P&gt;But what I am wanting to do is issue the prompt as:&lt;/P&gt;&lt;P&gt;(setq pre (getstring "\nPrefix: C- "))&lt;/P&gt;&lt;P&gt;Then if the C- is removed the variable pre would be a null string, but if not removed then the variable is filled with "C-"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 14:24:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640557#M222</guid>
      <dc:creator>dvertz</dc:creator>
      <dc:date>2025-05-20T14:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640583#M223</link>
      <description>&lt;P&gt;getkword with arbitrary input could help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(progn (initget 128) (getkword "\nPrefix &amp;lt;C-&amp;gt;: "))&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 14:34:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640583#M223</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2025-05-20T14:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640674#M224</link>
      <description>&lt;P&gt;Good Thought, but not quite there. When I enter that and just press enter, NIL is returned. I could process NIL and set the variable to "C-" but the result is the same as with getstring. So I thought maybe if I included "C-" in the initget like (initget 128 "C-") that it might return "C-", but it does not. I am thinking that what I want may not be able to be done. As the only thing I can think of would be to have the getstring issue the prompt and then a princ to add the "C-" as an answer. That way the "C-" could be deleted and a NULL string could be returned, but if the "C-" is left as the answer to getstring then the "c-" would be returned. However, a princ would not place the "C-" as answer to getstring until getstring IS answered.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 15:07:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640674#M224</guid>
      <dc:creator>dvertz</dc:creator>
      <dc:date>2025-05-20T15:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640697#M225</link>
      <description>&lt;P&gt;Lost, sorry.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One more tip, though,&lt;/P&gt;
&lt;P&gt;(lisped "C-")&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 15:23:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640697#M225</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2025-05-20T15:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640716#M226</link>
      <description>&lt;P&gt;If I'm following you correctly, maybe something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(initget "Yes No")&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(setq pre (getstring "\nDo you want a Prefix of C- ? [Yes/No] &amp;lt;Y&amp;gt;"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(if (or (= pre "") (= pre "Y"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;(setq pre "C-")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;(setq pre nil)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 15:35:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640716#M226</guid>
      <dc:creator>DGCSCAD</dc:creator>
      <dc:date>2025-05-20T15:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640760#M227</link>
      <description>&lt;P&gt;Perfect, you got me there.&lt;/P&gt;&lt;P&gt;I used:&lt;/P&gt;&lt;P&gt;(initget "Yes No")&lt;BR /&gt;(setq pre (getstring "\nDo you want a Prefix of \"C-\"? [Yes]"))&lt;BR /&gt;(if (= pre "Y") (setq pre "C-"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results were:&lt;/P&gt;&lt;P&gt;Command: (setq pre (getstring "\nDo you want a Prefix of \"C-\"? [Yes]"))&lt;BR /&gt;Do you want a Prefix of "C-"? [Yes]V- (the "V-" was entered)&lt;BR /&gt;"V-"&lt;BR /&gt;Command: (setq pre (getstring "\nDo you want a Prefix of \"C-\"? [Yes]"))&lt;BR /&gt;Do you want a Prefix of "C-"? [Yes] (nothing was enter and just pressed enter)&lt;BR /&gt;""&lt;BR /&gt;Command: (setq pre (getstring "\nDo you want a Prefix of \"C-\"? [Yes]"))&lt;BR /&gt;Do you want a Prefix of "C-"? [Yes]Y (clicked the Yes)&lt;BR /&gt;"Y"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked perfectly, I am able to process all three answers.&lt;/P&gt;&lt;P&gt;I am curious why only the "Y" was returned instead of the whole word "Yes".&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 15:56:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640760#M227</guid>
      <dc:creator>dvertz</dc:creator>
      <dc:date>2025-05-20T15:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640763#M228</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Bonjour &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/393249"&gt;@dvertz&lt;/a&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;EM&gt;&lt;STRONG&gt;oops! When editing my post, some answers were posted. I’m not fast enough!&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;I am not sure to understand correctly your question.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;I propose that if press “return” at the prompt without giving an answer, you concatenate the prefix and the number 1.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-05-20_17-52-50.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1535433i72DE88C38BE87452/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2025-05-20_17-52-50.png" alt="2025-05-20_17-52-50.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Amicalement&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 15:59:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640763#M228</guid>
      <dc:creator>-didier-</dc:creator>
      <dc:date>2025-05-20T15:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640897#M229</link>
      <description>&lt;P&gt;Apparently, the INITGET isn't required, and I've also found something I didn't know when looking into this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using GETSTRING where GETKWORD would normally be used, if you supply brackets the first capitalized letter within the brackets is used as a selectable character and will return that as a string if selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (setq pre (getstring "\nDo you want a Prefix of \"C-\"? [ZeRo]"))&lt;BR /&gt;Do you want a Prefix of "C-"? [&lt;FONT color="#3366FF"&gt;Z&lt;/FONT&gt;eRo]Z&lt;BR /&gt;"Z"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (setq pre (getstring "\nDo you want a Prefix of \"C-\"? [zeRo]"))&lt;BR /&gt;Do you want a Prefix of "C-"? [ze&lt;FONT color="#3366FF"&gt;R&lt;/FONT&gt;o]R&lt;BR /&gt;"R"&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 18:19:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640897#M229</guid>
      <dc:creator>DGCSCAD</dc:creator>
      <dc:date>2025-05-20T18:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640925#M230</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/393249"&gt;@dvertz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am curious why only the "Y" was returned instead of the whole word "Yes".&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It uses the CAPITALIZED letters from the initget function.&amp;nbsp; Try this version and it'll return YES -- but you'll have to actually type YES (you don't have to type it in caps though).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(initget "YES NO")
(setq pre (getstring "\nDo you want a Prefix of C- ? [Yes/No] &amp;lt;Y&amp;gt;"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:25:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640925#M230</guid>
      <dc:creator>doni49</dc:creator>
      <dc:date>2025-05-20T17:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640942#M231</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/393249"&gt;@dvertz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;(setq pre (getstring "\nPrefix &amp;lt;C-&amp;gt;: "))&lt;/P&gt;
&lt;P&gt;Then the normal way is check if the variable pre is &lt;FONT color="#FF0000"&gt;null&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I am curious why only the "Y" was returned instead of the whole word "Yes".&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Bear in mind that unlike other&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt; (get...)&lt;/STRONG&gt; &lt;/FONT&gt;functions,&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt; (get&lt;FONT color="#0000FF"&gt;&lt;EM&gt;string&lt;/EM&gt;&lt;/FONT&gt;)&lt;/STRONG&gt; &lt;/FONT&gt;&lt;STRONG&gt;&lt;EM&gt;does not return &lt;FONT color="#FF0000"&gt;nil&lt;/FONT&gt; if you press Enter&lt;/EM&gt;&lt;/STRONG&gt;, but rather an empty text string&lt;STRONG&gt; ""&lt;/STRONG&gt;.&amp;nbsp; [I'm never quite sure when people use the word "null" whether they mean "nil."]&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;You would need to do the&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt; (initget)&lt;/STRONG&gt; &lt;/FONT&gt;again before each&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt; (get...)&lt;/STRONG&gt; &lt;/FONT&gt;function -- once at the top will not cover more than one of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640942#M231</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2025-05-20T17:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640948#M232</link>
      <description>&lt;P&gt;Well, after all these years, I learned something new here.&lt;/P&gt;&lt;P&gt;The getstring returns only the "Y"&lt;/P&gt;&lt;P&gt;But the getkword returns the entire work "Yes" as it appears in the initget function&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:35:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640948#M232</guid>
      <dc:creator>dvertz</dc:creator>
      <dc:date>2025-05-20T17:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640955#M233</link>
      <description>&lt;P&gt;I wouldn't bother with the Yes/No choice.&amp;nbsp; Does this do what you want?&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(setq pre (getstring "\nPrefix &amp;lt;C-&amp;gt;: "))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(if (= pre "") (setq pre "C-"))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:39:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640955#M233</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2025-05-20T17:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640956#M234</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;The null string is exactly what I wanted to have return when nothing is entered. I could have also used having it return NIL. With NIL I could assign the NULL string. The key was having the option of the default value of "C-". But yet also have an option of typing in a different value for example "V-". Just as DGCSCAD got me to.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:39:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640956#M234</guid>
      <dc:creator>dvertz</dc:creator>
      <dc:date>2025-05-20T17:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640968#M235</link>
      <description>&lt;P&gt;Kent,&lt;/P&gt;&lt;P&gt;As pointed out in post 1, it does not.&lt;/P&gt;&lt;P&gt;As pointed out in post 6 with the help of the forum, I got there.&lt;/P&gt;&lt;P&gt;Thanks though. I always appreciate all who help.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:46:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13640968#M235</guid>
      <dc:creator>dvertz</dc:creator>
      <dc:date>2025-05-20T17:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13641038#M236</link>
      <description>&lt;P&gt;one using cond&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setq pre (cond ((= "" (setq pre (getstring "\nEnter prefix {C}-: "))) "C-") (t (strcat pre "-"))))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 May 2025 18:31:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13641038#M236</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2025-05-20T18:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: getstring prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13641135#M237</link>
      <description>&lt;P&gt;Here's the getkword version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:test ()
  (initget 128)
  (setq o (cond ((getkword "\nPrefix &amp;lt;C-&amp;gt;: ")) ("C-")))
  (setq o (vl-string-trim "\"" o))
  (princ (strcat "Prefix: " o))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simple &amp;lt;enter&amp;gt; to get "C-"&lt;/P&gt;
&lt;P&gt;"" (double quotes) to get an empty string ""&lt;/P&gt;
&lt;P&gt;"C :"&amp;nbsp; - quotes have to be typed to set anything with a space.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 19:35:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getstring-prompt/m-p/13641135#M237</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2025-05-20T19:35:59Z</dc:date>
    </item>
  </channel>
</rss>

