What is this code and how can I insert a pause or sleep command?


Can someone tell me if they recognize this code?*
Sub Main
	SendKeys "v"
	SendSystemKeys "{Ctrl+l}"
	SendKeys "0"
	SendSystemKeys "{Right}"
End Sub

Open in new window

Is it Visual Basic?
If not, can you tell me what it is called?
Also, can you tell me how to insert a pause or sleep?

I am familiar with a scripting language called AutoHotkey (AHK). When creating a script in AHK, I can insert a pause by entering the word "Sleep" followed by some number of milliseconds. So for example, with the following script:
    MouseMove, 400, 600

Open in new window

, when the F1 key is pressed, the mouse cursor is immediately moved to x = 400, y = 600 and this is immediately followed by a mouseclick.

However, if the same script is modified by inserting a "Sleep" command:
    MouseMove, 400, 600
    Sleep, 2300

Open in new window

then the resulting action (when the F1 key is pressed) is identical to above but with a 2.3 second pause between the mouse movement and the click.

So what I'm trying to figure out is how to insert a similar pause or sleep in the code shown at the beginning of this question.


* The code is from the Command Browser in Dragon NaturallySpeaking voice recognition software. The Command Browser enables the user to create verbal commands which the software then converts to some entry on the screen as determined by the scripting code.

In this specific example, the verbal command is phonetically defined as:

        "vee sub zero"

and the code is meant to enter the  letter "v" followed by a subscript zero and that is followed by a cursor move one space to the right.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
It looks like VBA. Try using the wait method

Application.Wait(Now + TimeValue("0:00:01"))


SendDragonKeys and SendKeys are identical but SendKeys can only be used in VBA commands such as SendKeys "^p".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve_BradyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.