Lt Dan's legs Posted July 23, 2010 Share Posted July 23, 2010 (edited) Perfect example of what I'm looking for is: if you type in -insert it will remember the last block you've inserted and if you hit enter the routine continues with that block. I can't figure it out (defun c:test (/) (setq prmpt (getstring (strcat "\nWhat would you like to say? <" prmpt "> : "))) (alert prmpt) (princ) ) Edited July 23, 2010 by Lt Dan's legs Quote Link to comment Share on other sites More sharing options...
MSasu Posted July 23, 2010 Share Posted July 23, 2010 I think that this is what you are looking for (take care that a neutral answer - - for GETSTRING function is an empty string): (defun c:test ( / LastUsed ToUse ) (setq LastUsed "LastUsedBlock") ;name of last used block ;test is user answer by string or by <ENTER> (if (= (setq ToUse (getstring (strcat "\nWhat would you like to say? <" LastUsed "> : "))) "") (setq ToUse LastUsed) ;use default value ) (alert ToUse) (princ) ) Regards, PS. I’m afraid that thread’s title is not appropriate for your request… Quote Link to comment Share on other sites More sharing options...
David Bethel Posted July 23, 2010 Share Posted July 23, 2010 You might want to look into the sysvar "INSNAME". -David Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted July 23, 2010 Author Share Posted July 23, 2010 When I started this thread I was looking at a routine lee mac made for me. counting routine Maybe that's why I wasn't getting my result! Thank you for the response. I'll check this in a few minutes Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted July 23, 2010 Author Share Posted July 23, 2010 actually this is what I was looking for. Just needed to take my eyes off it for a while and look back (defun c:test (/ p prmpt) (if (NOT (setq p prmpt)) (SETQ P "\NTESTING")) (setq prmpt (getstring (strcat "\nWhat would you like to say? <" p "> : "))) (if (eq "" prmpt) (setq prmpt p)) (alert prmpt) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted July 23, 2010 Author Share Posted July 23, 2010 When I started this thread I was looking at a routine lee mac made for me. counting routine Maybe that's why I wasn't getting my result! Thank you for the response. I'll check this in a few minutes Let me reword that because it sounds like I'm blaming Lee for my problem.. I was looking at a LISP that Lee wrote and it had to do with numbering. I was looking at the wrong part of the routine to manipulate it. Thats why my title is itoa. Sorry Lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 23, 2010 Share Posted July 23, 2010 Let me reword that because it sounds like I'm blaming Lee for my problem.. I was looking at a LISP that Lee wrote and it had to do with numbering. I was looking at the wrong part of the routine to manipulate it. Thats why my title is itoa. Sorry Lee No worries man Another way to code it (I don't like the empty string return of getstring ) (defun c:test ( / tmp ) (alert (setq *x* (cond ( (eq "" (setq tmp (getstring t (strcat "\nAlert with <" (setq *x* (cond ( *x* ) ( "LeeMac" )) ) "> : " ) ) ) ) *x* ) ( tmp ) ) ) ) (princ) ) 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.