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

Posted on 2013-10-08
Medium Priority
Last Modified: 2013-10-25

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.
Question by:Steve_Brady
LVL 30

Accepted Solution

Randy Downs earned 2000 total points
ID: 39557666
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".

Author Closing Comment

ID: 39602196

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question