Typing simulator

Asked

Viewed 97 times

0

I wanted to know how to make the program type alone, is like sending message with Ndkeys but goes letter by letter as if it were a human typing.

I had done the usual way to send a message, but I need it to be sent slowly and I couldn’t:

    Dim F1 As Boolean
        F1 = GetAsyncKeyState(Keys.F1)
Select Case F1
            Case F1
                If F1 And MetroComboBox1.Text = "F1" = True Then
                    Clipboard.SetDataObject(MetroTextBox1.Text)
                    SendKeys.Send("{ENTER}")
                    SendKeys.Send("^v{ENTER}")
                ElseIf F1 And MetroComboBox2.Text = "F1" = True Then
                    Clipboard.SetDataObject(MetroTextBox2.Text)
                    SendKeys.Send("{ENTER}")
                    SendKeys.Send("^v{ENTER}")
                ElseIf F1 And MetroComboBox3.Text = "F1" = True Then
                    Clipboard.SetDataObject(MetroTextBox3.Text)
                    SendKeys.Send("{ENTER}")
                    SendKeys.Send("^v{ENTER}")
                ElseIf F1 And MetroComboBox4.Text = "F1" = True Then
                    Clipboard.SetDataObject(MetroTextBox4.Text)
                    SendKeys.Send("{ENTER}")
                    SendKeys.Send("^v{ENTER}")
                End If
        End Select

I wanted to know how I do so that the messages I send from textbox1 are sent slowly, letter by letter

I also tried to deploy this code in my project but I was not successful, it basically makes the effect I want but at lower speed and on a label of the program:

Public Class Form2
    Dim i As Integer = -1
    Dim mensagem As String
    Private Sub ExibirMensagem(ByVal msg As String)
        Timer1.Stop()
        i = -1
        Label1.Text = Nothing
        mensagem = msg
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim tamanho As Integer = mensagem.Length
        i = i + 1
        If i = tamanho Then
            Timer1.Stop()
            i = -1
        Else
            Label1.Text = Label1.Text & mensagem.Chars(i)
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ExibirMensagem(TextBox1.Text)

    End Sub
End Class
  • Would it solve with System.Threading.Thread.Sleep(200) ?

  • 1

    i had already tested this but it only takes time for the command to run, but when the command is executed the phrase is sent as a Ctrl+V. There is some alternative command from Sendkeys?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.