Jump to content

Recommended Posts

Posted

Is there a way a function don't return anything?

 

I'm using some DCL and when the user clicks on the any button some actions take place but I don't want to echo anything on commandline, not even (princ).

Is there any way to do that?

Posted

Seems that you are talking of two different things. For a function to don't return, then end it with a call of PRINC function. To suppress the echo on command prompt then you should check the CMDECHO system variable; for some special cases there is NOMUTT system variable.

Posted

Example:

(setq oldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
; your code goes here
(setvar "CMDECHO" oldCmdEcho)

Posted

 

I'm using some DCL and when the user clicks on the any button some actions take place but I don't want to echo anything on commandline, not even (princ).

Is there any way to do that?

 

You must be using command calls within your routine which you can not prevent them from being printed to the command line for sure :P

Posted
You must be using command calls within your routine which you can not prevent them from being printed to the command line for sure :P

Have you heard of CMDECHO and NOMUTT system variables?!?

Posted

Since OP mentioned also a DCL interface, there is a potential issue if the command calls are done while the dialog is active - but this don't seems to be the case since he/she is complaining about the echo on prompter.

Posted

You're right again MSasu with cmdecho colud prevent the prints to the command line by any command call .:oops:

Posted
with cmdecho colud prevent the prints to the command line by any command call

In fact does not work for all commands; there are some echoes on prompter that cannot be avoided - one example is the results report of PURGE command.

Posted

The said shortcut, or COMMANDLINEHIDE command, will just hide the prompter, the echo from AutoLISP will still be there.

 

Even if one had using the crosshair’s input prompter, I still think that is a good idea to preserve the command line visible since many commands had useful informational prompters and also for errors feedback.

Posted
The said shortcut, or COMMANDLINEHIDE command, will just hide the prompter, the echo from AutoLISP will still be there.

 

Even if one had using the crosshair’s input prompter, I still think that is a good idea to preserve the command line visible since many commands had useful informational prompters and also for errors feedback.

 

I know MSsau, just fooling around is all. ;)

Posted (edited)

I know about cmdecho, but that's a command by itself, isn't it?

for a simple example assume that when you click on a button on the DCL form a variable value should be changed, so the original function will be:

(defun dclcall()
    (setq try 1)
)

obviously this returns 1 on the command line, now if you try cmdecho as:

(defun dclcall()
 (setvar "cmdecho" 0)
 (setq try 1)
 (setvar "cmdecho" 1)
)

then the function returns 1 on the command line, so this is not the solution.

 

The case is that I have many buttons and user sets a configuration by clicking on them, I don't want to shift the command history for him/her

Edited by anishtain4
Posted

You need to clarify what you are looking for:

 

1. don't want your function to return on command prompt?

(defun dclcall()
(setq try 1)
(princ)
)

Or,

 

2. don't want echos of function actions on command prompt?

(defun dclcall( / oldCmdEcho )
(setq oldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "_LINE" '(0 0) '(1 1) "")
(command "_CIRCLE" '(2 2) 3)
(setvar "CMDECHO" oldCmdEcho)
(princ)
)

Not in the end, please edit your post to add code tags on your example. Thank you.

Posted

well that would be the last line of my previous post, (prince) will move up the command line by one white line, when the user is clicking on many buttons a lot of these lines will be added. Of course this is not a critical issue, just to make the routine more user friendly

Posted

The empty lines will be visible only when you will press to activate the text window - on regular command prompt those will be collapsed, therefore not visible. If those lines are bothering you, then I'm really not sure that there is a solution to get rid of them.

Posted (edited)

One workaround will be to replace that empty line with an info prompter on routine's action - this will also provide your users with a history to review:

(defun dclcall( / oldCmdEcho )
(setq oldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "_LINE" '(0 0) '(1 1) "")
(setvar "CMDECHO" oldCmdEcho)
"One slopped line drawn."
)

Edited by SLW210
Posted

FWIW -

 

I often use CmdEcho, and NoMutt sysvars to manage to command line output during a routine. Also, when purposefully sending info to the command line for the user's benefit, I either use Princ, or Prompt as applicable, often times with Terpri.

Posted
One workaround will be to replace that empty line with an info prompter on routine's action - this will also provide your users with a history to review:

(defun dclcall( / oldCmdEcho )
(setq oldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "_LINE" '(0 0) '(1 1) "")
(setvar "CMDECHO" oldCmdEcho)
"One slopped line drawn."
)

 

well in the office (2010) this empty line is visible. Yep, that the idea, restating configured instead of empty line

Posted
well in the office (2010) this empty line is visible.

Not sure that understood that - are you exporting the command line history to Word or Excel?

Posted

oh, not by office I meant the office I'm working in, not MS Office. Guess I keep going with instant report of the action

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