How many keystrokes can I send per second?

  • Thread starter Thread starter Zakynthos
  • Start date Start date
Z

Zakynthos

How many keystrokes can I send per second with 'Sendkeys' statements assuming
tab keys and text are mixed?
 
Many, many strokes.

The keystrokes are buffered until control returns to the application, either
directly or thru DoEvents
 
Thanks for that.

But what's the maximum, precisely, per second?
 
Check back tomorrow.

I'll cook up a little macro to measure system, SendKeys about 10,000
character, and measure time again.

This will give us enough information to calculate the number of characters
per second.
 
Great - many thanks for your help. I'm trying to convince people at work
that lots of time will be sent in a data transfer project from one database
to another and this information will prove useful to support my arguments -
I'm also running timed tests of my program against manual input but don't
have the knowledge to time the max. keystroke output in seconds.
 
It is important to remember that a human is very limited in the ability to
type quickly. The standard QWERTY keyboard was designed to slow down typing,
not speed it up.

Even if you just hold a key down, the thruput is limited by the repeat rate.

We will see if SendKeys can do better!
 
First the code:

Private Declare Function GetTickCount Lib "Kernel32" () As Long
Sub qwerty()
Dim ary(1 To 1350) As String
Dim n1 As Long, n2 As Long
For i = 1 To 1350
ary(i) = Chr(Int(((90 - 65 + 1) * Rnd) + 65))
Next
Application.ScreenUpdating = False
Range("B9").Select
ActiveCell.Clear
n1 = GetTickCount()
Application.SendKeys "{F2}"
For i = 1 To 1350
Application.SendKeys ary(i)
Next
Application.SendKeys "{ENTER}"
DoEvents
Application.ScreenUpdating = True
n2 = GetTickCount()
MsgBox (n2 - n1)
End Sub

So we make a long array of characters, record time, pump the characters into
a cell, re-record the time, and display the difference.

On my elderly Dell, I am able to get 1350 characters into a cell in about
950 milliseconds. And thats sending them one character at a time.
 
Gary's student,

This is fantastic!- will use this to check my computer - the stats will hel
reinforce my arguments for more extensive automation at work - your help has
been invaluable.

Best wishes,

Tony
 
Glad to help!
--
Gary''s Student - gsnu200813


Zakynthos said:
Gary's student,

This is fantastic!- will use this to check my computer - the stats will hel
reinforce my arguments for more extensive automation at work - your help has
been invaluable.

Best wishes,

Tony
 
Tried the code but it errored:

Compile error: "Only comments may appear after End Sub, End Function or End
Property.

Where am I going wrong?

Many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top