Jump to content

VBA Hold Command


Olhado_

Recommended Posts

So, I heard about this command in passing and could not really ask up about it at the time, for many reasons; but I heard there is a command that will hold up VBA, until AutoCAD (or any program) has had time to physically catch up.

 

The problem is I do not really know how it is spelled, so looking it up on Google is a little difficult. I hope someone here can help.

 

The command sounds something like, inquences.

 

Does this sound like a command anyone has heard of? I am not looking for any code to be written, just help finding a command that exist; but I cannot spell it and so cannot really find it on the Internet. :unsure:

 

Thank you.

-Chris

Link to comment
Share on other sites

I'm guessing you are refering to DoEvents (or Do Events - not sure). Similar to the NO OP in 6502 code (showing my age) this does nothing, but while doing nothing the processor can go off and see if nothing else needs doing. You can put multiple DoEvents in a row if your code needs it.

Link to comment
Share on other sites

Thank you, it may or may not be the command that initiated this post; but it works none the less.

 

And I am finding it works really well in a conditional loop. :)

Link to comment
Share on other sites

The DoEvents function surrenders timeslices of the CPU to other processes, allowing them to catch up. if everything is being done from inside of VBA, then doevents is not necessary, because VBA itself will wait until whatever VBA command is run, before it runs the next VBA command in your code.

 

Its a little different if you are waiting on a SendCommand, a Lisp Routine, or something even running outside of acad. Generally, tho, a doevents doesnt actually do much good for those other running (acad) processes, because it doesnt really know when they are done running.

 

Sure, you sprinkle a bunch of Doevents in your code and it seems to work.. but all you are doing in most cases is *slowing down* your vba code in *hopes* that the other processes catch up. Putting a second lop that, say, checks your email, or counts to a million, etc, could do much the same.

 

Ive found the best way to deal with situations like this is to avoid having to use DoEvents to begin with.. much like using GOTO .. there are usually other ways to code something.

 

Also, I think the command ("inquences") you were referring to, is the "IsQuiescent" command. Basically, it is the "IsQuiet" command. It lets you know that acad is not doing anything at the moment, and that your command is ready to be run.

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