echo off in VB

echo off in VB

Anonymous
Not applicable
1,102 Views
10 Replies
Message 1 of 11

echo off in VB

Anonymous
Not applicable
In lisp when "command" function is used "cmdecho" variable turns on or off
the command line "messages". In VBA, however, this variable does nothing.
I'm using SendCommand method in VBA and setting up the "cmdecho" variable
does not affect the command line "echoes" anyway. Is there any other
"variable" that can be used in VBA for similar purpose?
Thanks,
0 Likes
1,103 Views
10 Replies
Replies (10)
Message 2 of 11

Ed__Jobe
Mentor
Mentor
Probably because the SendCommand method is asyncrnous and will run after your vba finishes, thus, you don't see any effect. Try using ThisDrawing.SetVariable instead.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 11

Anonymous
Not applicable
The only way not to see anything is to avoid the SendCommand function and use the object adding/modifying methods -- however, you can clean up what is written to the command line by getting rid of the prompts by setting NOMUTT to 1.

For Example:

Thisdrawing.SendCommand "line" & vbcr & "0,0,0" & vbcr & "999,999,0" & vbcr & vbcr

... will display as:

line
0,0,0
999,999,0

... just remember to turn it back on when done (kinda hard to use commands when you don't know what AutoCAD is asking).

HTH - Lanny
0 Likes
Message 4 of 11

Anonymous
Not applicable
The best thing is to only use SendCommand as a last resort only when absolutely necessary.

Regards - Nathan
0 Likes
Message 5 of 11

Anonymous
Not applicable
I've never done this before, but couldn't you set cmdecho to 0, then use SendCommand, but send it as a small lisp routine that does what you want?
0 Likes
Message 6 of 11

Ed__Jobe
Mentor
Mentor
The problem is not what SendCommand sends, but using SendCommand. Your vba would execute and then when its done, cmdecho would toggle on/off.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 7 of 11

Anonymous
Not applicable
So just to clarify, if it were to be toggled off before you did anything in vba, you wouldn't have a problem?
0 Likes
Message 8 of 11

Anonymous
Not applicable
CMDECHO has no affect on echoing of prompts
and input from SendCommand(). It doesn't matter
when you turn it off.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5521205@discussion.autodesk.com...
So just to clarify, if it were to be toggled off before you did anything in vba, you wouldn't have a problem?
0 Likes
Message 9 of 11

Anonymous
Not applicable
Well that's what i would have thought. I would relate SendCommand() to actually typing in the command manually.
0 Likes
Message 10 of 11

Ed__Jobe
Mentor
Mentor
Sorry, my mind was on a single track. But even if cmdecho did affect echoing of SendCommand, because SendCommand is asyncronous, it would not have solved the original problem. The OP was apparently using SendCommand do do many things, not just set a sysvar. So this could be a lesson on using SendCommand to set any sysvar.

What should happen:
Turn sysvar off
process
Turn sysvar on

What was happening:
process
vba finishes
SendCommand begins
Turn sysvar off
Turn sysvar on

Lesson: use SetVariable(), not SendCommand

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 11 of 11

Anonymous
Not applicable
Thank you guys, I've got enough information I needed.

wrote in message news:5523057@discussion.autodesk.com...
Sorry, my mind was on a single track. But even if cmdecho did affect echoing
of SendCommand, because SendCommand is asyncronous, it would not have solved
the original problem. The OP was apparently using SendCommand do do many
things, not just set a sysvar. So this could be a lesson on using
SendCommand to set any sysvar.

What should happen:
Turn sysvar off
process
Turn sysvar on

What was happening:
process
vba finishes
SendCommand begins
Turn sysvar off
Turn sysvar on

Lesson: use SetVariable(), not SendCommand
0 Likes