Jump to content

Itoa...


Lt Dan's legs

Recommended Posts

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 :oops:

 

(defun c:test (/)
 (setq prmpt (getstring (strcat "\nWhat would you like to say? <" prmpt "> : ")))
 (alert prmpt)
 (princ)
 )

Edited by Lt Dan's legs
Link to comment
Share on other sites

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…

Link to comment
Share on other sites

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! :oops:

 

Thank you for the response. I'll check this in a few minutes

Link to comment
Share on other sites

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)
 )

Link to comment
Share on other sites

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! :oops:

 

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

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...