<?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: getkword not honoring keywords in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357229#M115428</link>
    <description>&lt;P&gt;This should work fine. Please check if the space in initget is really a plain space, not some special character (like hard-space).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.cadstudio.cz" target="_blank"&gt;www.cadstudio.cz&lt;/A&gt; &amp;nbsp;&lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Sep 2017 06:23:00 GMT</pubDate>
    <dc:creator>vladimir_michl</dc:creator>
    <dc:date>2017-09-06T06:23:00Z</dc:date>
    <item>
      <title>getkword not honoring keywords</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7356487#M115425</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to learn how to use the getkword function, and I can't figure out why it does not seem to allow me to select the keywords I set up with initget.&lt;/P&gt;&lt;P&gt;According to the getkword page on the Autodesk help pages, it should behave like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;(initget 1 &lt;SPAN&gt;"Yes No"&lt;/SPAN&gt;)&lt;/STRONG&gt;
nil

&lt;STRONG&gt;(setq x (getkword &lt;SPAN&gt;"Are you sure? (Yes or No) "&lt;/SPAN&gt;))&lt;/STRONG&gt;
Are you sure? (Yes or No) &lt;STRONG&gt;yes&lt;/STRONG&gt;
&lt;SPAN&gt;"Yes"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;What I am getting is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(initget 1 "Yes No")&lt;/P&gt;&lt;P&gt;nil&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(setq x (getkword "Are you sure (Yes or No) "))&lt;/P&gt;&lt;P&gt;Are you sure (Yes or No) Yes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid option keyword.&lt;/P&gt;&lt;P&gt;Are you sure (Yes or No) No&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid option keyword.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't find any help on this.&amp;nbsp; Any ideas why this is happening?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 22:32:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7356487#M115425</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-05T22:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: getkword not honoring keywords</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7356567#M115426</link>
      <description>&lt;P&gt;Getkword will work, many examples found by a search,&lt;/P&gt;
&lt;P&gt;Or someone will explain it all here, in a minute.&lt;/P&gt;
&lt;P&gt;My crew was a quicker version, so I used the grread method,&lt;/P&gt;
&lt;P&gt;which returns a logical T or nil, for true of false.&lt;/P&gt;
&lt;P&gt;This is a long version of it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;; input yes no AusCadd.com, SCG&lt;BR /&gt;&amp;nbsp;(defun I_YN (QSTR YNFLG / TF NF IT IG IK) ;&lt;BR /&gt;&amp;nbsp; (princ (strcat QSTR (if YNFLG " N or &amp;lt; Y &amp;gt; " " Y or &amp;lt; N &amp;gt; ")))&lt;BR /&gt;&amp;nbsp; (while (and (setq IT (car (setq IG (grread T)))) (/= 6 IT )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq IK (cadr IG)) ; key maybe&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (not (and (= 2 IT) (or&amp;nbsp;&amp;nbsp;&amp;nbsp; ; key board&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq NF (or (= 110 IK) (= 78 IK) ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq TF (or (= 121 IK) (= 89 IK) ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (= 13 IK)&amp;nbsp;&amp;nbsp; (= 32 IK) ) )&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (not (= IT 11)) ) ) ; end while&amp;nbsp; ; mou R&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (setq YNFLG (cond&amp;nbsp; (NF nil)&amp;nbsp; (TF t)&amp;nbsp; (t YNFLG) ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (princ (if YNFLG " Y " " N "))&amp;nbsp; YNFLG )&lt;BR /&gt;&amp;nbsp;; (setq Flag (I_YN " @ i_yn subr0 " nil))&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 23:08:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7356567#M115426</guid>
      <dc:creator>stevor</dc:creator>
      <dc:date>2017-09-05T23:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: getkword not honoring keywords</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7356609#M115427</link>
      <description>&lt;P&gt;(initget &amp;lt;whatever&amp;gt;) always returns nil, so don't worry about that. &amp;nbsp;If it really bothers you, or is part of a lengthy (and ...) then you can use (not (initget ...)).&lt;/P&gt;
&lt;P&gt;The rest of the behavior you supplied does not make sense. &amp;nbsp;It appears you were testing the exact example from the help on getkword.&lt;/P&gt;
&lt;P&gt;It "should" work exactly as advertised.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Were there other lines of code between the (initget) and the (getkword) that you omitted to post?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 23:30:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7356609#M115427</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-09-05T23:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: getkword not honoring keywords</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357229#M115428</link>
      <description>&lt;P&gt;This should work fine. Please check if the space in initget is really a plain space, not some special character (like hard-space).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.cadstudio.cz" target="_blank"&gt;www.cadstudio.cz&lt;/A&gt; &amp;nbsp;&lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 06:23:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357229#M115428</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2017-09-06T06:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: getkword not honoring keywords</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357402#M115429</link>
      <description>&lt;P&gt;To be honest, I'm experiencing the same issues as well. Didn't notice it before, but if you have different multiple initget statements only the first will be honored and persistent. I have not found a solution yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See example below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Command: (initget "Yes No")
nil

Command: (getkword "\nOption [Yes/No]: ")

Option [Yes/No]: y
"Yes"

Command: (initget "Stop Go")
nil

Command: (getkword "\nOption [Stop/Go]: ")

Option [Stop/Go]: s

Invalid option keyword.

Option [Stop/Go]: Stop

Invalid option keyword.

Option [Stop/Go]: Go

Invalid option keyword.

Option [Stop/Go]: y
"Yes"&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 07:57:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357402#M115429</guid>
      <dc:creator>DannyNL</dc:creator>
      <dc:date>2017-09-06T07:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: getkword not honoring keywords</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357838#M115430</link>
      <description>&lt;P&gt;I've found an older post describing exactly this problem. Although it shouldn't happen, it appears it is a commandline problem only. When using in a routine the keywords will be honored from the last initget.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the older post &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/sticky-initget-or-getkword-recognizing-only-the-first-initget/td-p/6409452" target="_blank"&gt;&amp;gt;&amp;gt;&amp;gt; Click Here &amp;lt;&amp;lt;&amp;lt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've checked with a small routine and then it works fine and as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:Test ()
   (initget 1 "Yes No")
   (setq T_Answer1 (getkword "\nSelect option [Yes/No]: "))
   (initget 1 "Stop Go")
   (setq T_Answer2 (getkword "\nSelect option [Stop/Go]: "))
   (princ (strcat "\nAnswer1: " T_Answer1 " / Answer2: " T_Answer2))
   (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 11:07:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getkword-not-honoring-keywords/m-p/7357838#M115430</guid>
      <dc:creator>DannyNL</dc:creator>
      <dc:date>2017-09-06T11:07:50Z</dc:date>
    </item>
  </channel>
</rss>

