Visual Basic "SendKeys" command question

By Mutant-JD ·
Tags: Windows, Software
Hello, its my first time here and I would like to ask a question.
I use Microsoft Visual Basic 2008 Express Edition and I am trying to build an Auto-Typer for my own use. I know how to use intervals (Timer1.Interval etc.) but is it possible to change the SPEED of the typing? I mean when auto-typer starts writing, at a notepad for example, writes too quickly. Personally I believe this has to do with the SendKeys, I think there should be a way to slow it down, pause it somehow or something...

Thanks a lot!

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

You can use SendWait Method

by GeorgeJ0 In reply to Visual Basic "SendKeys" c ...

The best method would be using the SendKeys.SendWait Method. Use SendWait to send keystrokes or combinations of keystrokes to the active application and wait for the keystroke messages to be processed. You can use this method to send keystrokes to an application and wait for any processes that are started by the keystrokes to be completed. This can be important if the other application must finish before your application can continue.

Public Shared Sub SendWait ( _
keys As String _

Dim keys As String


Source is MSDN -

Another thing I can think of right now is maybe a timer. I am guessing you are trying to slow down each character. So we need to split the text into characters then we use a timer to control how fast we want to send the characters.

Function to split string :-

Dim a() As String
Dim j As Integer
a = TextBox1.Text.Split(Lf)

For j = 0 To a.GetUpperBound(0)

Then use a timer to send the characters at your desired pace.

Hope this helps. :-)

Collapse -

Forgot to add another piece of code

by GeorgeJ0 In reply to You can use SendWait Meth ...

Sorry for posting again, I couldn't edit my previous post so replying again. You can use this code as well.

Splitting a word into Character :

Dim myArray As Char() = TextBox1.Text.ToCharArray()

For i = 0 To myArray.GetUpperBound(0) - 1

Related Discussions

Related Forums