Jump to content

LISP to write command line history to file


Recommended Posts

Posted

Is there a way of writing a selected amount of the command line history to a file via a lisp routine?

 

An option to write analysis to file pops up when using the MASSPROP command (see attached screenshot). I wondered if it was possible to replicate something similar for lisp results that come up on the command line. massprop screenshot.jpg

 

Thanks in advance.

Posted

martyn , welcome to CADTutor :)

for displaying result can use textpage , princ , prin1 , vl-princ-to-string , strcat etc..

example:

(defun c:test (/ i)
 (textpage)
 (setq i 64)
 (repeat 26 (princ (strcat "\nascii " (itoa (setq i (1+ i)))" is "(chr i))))
 (princ)
 ) ;_ end of defun

 

variable last command line

(getvar "lastprompt")

we don't know what data you want to display in command line?

you can post your example too.

HTH

Posted

I am thinking that maybe something like this is what you are looking for.

 

;clears the log file
(defun clrlogfile ( / f)
 (setq f (open (getvar "LogFileName") "w"))
 (write-line "" f)
 (close f)
 )

(clrlogfile);clears the logfile

(setvar "logfilemode" 1);begin logging

;PRINT WHAT YOU WANT TO COMMAND LINE....

(setvar "logfilemode" 0);end logging

(startapp "Notepad" (getvar "LogFileName"));open it up in notepad

 

regards,

 

hippe013

Posted

Do you want a summary of commands used in a session and how long it took to do, we had a look at this to compare how many commands per staff per hours of work. Does lots of commands mean that operator is better ?

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