Manuel_Kunde Posted September 1, 2021 Share Posted September 1, 2021 Hi all, here is a snippet from a lisp. At the end of diffrent commands, I want to ask the user if he want to do something more. How can I write in the if-function that if Request is "No", the Lisp is finished? (initget "Yes No") (setq request (getkword "Want to do something more? [Yes/No] ") ) (if (wcmatch request "Yes") (alert "i will do some more commands..") ) (if (wcmatch request "No") (alert "the lisp is finished") ) Quote Link to comment Share on other sites More sharing options...
confutatis Posted September 1, 2021 Share Posted September 1, 2021 (edited) I have added strcase, so you can also answer in lower case. If you don't do if for both cases, the program only terminates when "N" is present. (initget (strcase "Y N")) (setq request (getkword "Want to do something more? [Yes/No] ")) (if (wcmatch request "N") (vl-exit-with-error (alert "the lisp is finished")) ) (alert "i will do some more commands..") Edited September 1, 2021 by confutatis 2 Quote Link to comment Share on other sites More sharing options...
lido Posted September 1, 2021 Share Posted September 1, 2021 Try this: (initget "Yes No") (while (= (getkword "\nInsert new command(s) [Yes/<No>]? ") "Yes") (initget "Yes No") ;;Your command(s) here (alert "Continue") ;;For test ) (alert "Bye") ;;For test Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 2, 2021 Share Posted September 2, 2021 nice acet function (setq yesno (acet-ui-message "Insert new command(s) [Yes/<No>]? " "" 4) ) 6 is yes 7 is no 2 Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted September 2, 2021 Author Share Posted September 2, 2021 6 hours ago, BIGAL said: nice acet function Okay, that's simple and nice. What does the number 4 mean? Is it possible to add a heading to the dialog box? Quote Link to comment Share on other sites More sharing options...
confutatis Posted September 2, 2021 Share Posted September 2, 2021 Add heading: (setq yesno (acet-ui-message "Insert new command(s) [Yes/<No>]? " "MESSAGE" 4)) Last number 1: Last number 2: Last number 3: Last number 4: Last number 5: Last number 6: 1 Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted September 2, 2021 Author Share Posted September 2, 2021 47 minutes ago, confutatis said: Add heading: (setq yesno (acet-ui-message "Insert new command(s) [Yes/<No>]? " "MESSAGE" 4)) I am excited, this is so amazing. Thank you for that. Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted September 2, 2021 Author Share Posted September 2, 2021 For someone else who wants to do the same: Base types 0 = Acet:OK 1 = Acet:OKCANCEL 2 = Acet:ABORTRETRYIGNORE 3 = Acet:YESNOCANCEL 4 = Acet:YESNO 5 = Acet:RETRYCANCEL Icons 16 = Acet:ICONSTOP 32 = Acet:ICONQUESTION 48 = Acet:ICONWARNING 64 = Acet:ICONINFORMATION Default buttons 0 = Acet:DEFBUTTON1 256 = Acet:DEFBUTTON2 512 = Acet:DEFBUTTON3 768 = Acet:DEFBUTTON4 Return Values Returns one of the following values: 1 = Acet:IDOK 2 = Acet:IDCANCEL 3 = Acet:IDABORT 4 = Acet:IDRETRY 5 = Acet:IDIGNORE 6 = Acet:IDYES 7 = Acet:IDNO 8 = Acet:IDCLOSE 9 = Acet:IDHELP 1 Quote Link to comment Share on other sites More sharing options...
tombu Posted September 2, 2021 Share Posted September 2, 2021 https://www.afralisp.net/archive/lisp/acet-utils.htm Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 2, 2021 Share Posted September 2, 2021 (edited) Also another is DOS-LIB has lots of good functions. My take on yes no look for multi radio buttons.lsp in Cadtutor Downloads. Edited September 2, 2021 by BIGAL Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted September 5, 2021 Author Share Posted September 5, 2021 On 9/3/2021 at 1:58 AM, BIGAL said: Also another is DOS-LIB has lots of good functions. My take on yes no look for multi radio buttons.lsp in Cadtutor Downloads. Dos lib is not quite easy to install. The multi-radio-buttons lisp is very good, for multiple queries. But the acet-function is easier for yes / no dialog boxes. Thanks for the help with this post. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 6, 2021 Share Posted September 6, 2021 A not really documented in Multi radio buttons is that the variable BUT holds the button number so a yes = 1 a No = 2. You don't have to use the string value. (ah:butts but "h" '("Yes or No" "Yes" "No")) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.