anishtain4 Posted May 23, 2012 Posted May 23, 2012 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? Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 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. Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 Example: (setq oldCmdEcho (getvar "CMDECHO")) (setvar "CMDECHO" 0) ; your code goes here (setvar "CMDECHO" oldCmdEcho) Quote
Tharwat Posted May 23, 2012 Posted May 23, 2012 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 Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 You must be using command calls within your routine which you can not prevent them from being printed to the command line for sure Have you heard of CMDECHO and NOMUTT system variables?!? Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 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. Quote
Tharwat Posted May 23, 2012 Posted May 23, 2012 You're right again MSasu with cmdecho colud prevent the prints to the command line by any command call . Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 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. Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 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. Quote
pBe Posted May 23, 2012 Posted May 23, 2012 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. Quote
anishtain4 Posted May 23, 2012 Author Posted May 23, 2012 (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 May 23, 2012 by anishtain4 Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 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. Quote
anishtain4 Posted May 23, 2012 Author Posted May 23, 2012 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 Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 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. Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 (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 May 23, 2012 by SLW210 Quote
BlackBox Posted May 23, 2012 Posted May 23, 2012 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. Quote
anishtain4 Posted May 24, 2012 Author Posted May 24, 2012 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 Quote
MSasu Posted May 24, 2012 Posted May 24, 2012 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? Quote
anishtain4 Posted May 25, 2012 Author Posted May 25, 2012 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 Quote
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.