Jump to content

How to overwrite last line in command prompt?


M76

Recommended Posts

I can't believe this hasn't come up yet, maybe I was searching with the wrong keywords.

 

What I'd like to do is to display progress of a lisp application on the command prompt, but each (prompt, or (princ command bumps the last message up a line, and when there are 1000 elements to be processed that would produce 1000 lines in the text window. Is there a way to clear the last line? Or if that's not possible, clear the text window completely.

 

thanks

Link to comment
Share on other sites

Hi

 

The return character, "\r", can be used when issuing the prompt functions to clear the current line

 

 

(defun c:test ()

 (write-line "Test function") 

 (setq i 0)
 
 (repeat 100
   (setq PromptMessage (strcat "[color="Red"][b]\r[/b][/color] Counter [" (rtos i 2 0) "]"))
   (princ PromptMessage)
   (setq i (1+ i))
   (command "delay" 20)
   )

 (write-line "End of function")
 )

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