Listbox Auto Typer

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
1 post Page 1 of 1
Contributors
User avatar
anthonygz
Member
Member
Posts: 48
Joined: Sun Feb 13, 2011 7:25 pm

Listbox Auto Typer
anthonygz
This Tutorial was typed by me, you will not find the code or anything anywhere else.
So enjoy!
This is a very simple code to use, but it took awhile to perfect it.

What you will need:
1) Timer
2) Listbox
3) Textbox or a control to enter text into
4) Basic Knowledge of "Copy Pasta" or following an easy tutorial.




=========The Timer=========
Code:
Code: Select all
'Getting Variables to keep track of what item it is on, and to stop any errors from occurring.

'Determining a new string
Dim Count As String

'Declaring Count as the listbox's item count
Count = ListBox1.Items.Count

'Determining the second and last string
            Dim Index As String

'Declaring Index as the listbox's index for later purposes
            Index = ListBox1.SelectedIndex

'Detecting if there is no items in the listbox
If Count = 0 Then

'Giving an error message if the input is blank.
            MsgBox("Put in some text first.")

'Making sure the msgbox dosen't spam itself after displaying.
            Timer2.Enabled = False
'Declaring what will happen next
        Else
'Nothing goes here except the End if to close the statement
            End if
'Our Anti-Error later on in this code
On Error GoTo ErrorHandler


'Sending or Typing the current listbox item
            SendKeys.Send(ListBox1.SelectedItem)

'Pressing enter to send the text
            SendKeys.Send("{ENTER}")

'Increasing the Listbox's Index to go to the next item and "Loop"
            ListBox1.SelectedIndex += 1

ErrorHandler:
'The listbox's count is always one below the index, so this will make it equal detecting if the last item's selected
            If Count = Index + 1 Then

'Sending the last item
                SendKeys.Send("{ENTER}")

'Going to the first item
                ListBox1.SelectedIndex = 0
            End If
        End If

Basically, it would make the typed items loop until stopped.
You can either use a button, or hotkey to stop it by using asynckeys.

=======Textbox or Text Input Code=======
(!Make sure its on the keydown portion of the control.!)
Code: Select all
'Getting if enter is tapped
if e.keycode = keys.enter then

'Seeing if your text input is blank
if textinput.text = "" then

'Giving out an error message as a result
msgbox("please put in some text first!")

'Executing the last portion of this code
else


'Adding in your typed item
listbox1.items.add(textinput.text)


end if
That would be pretty much it for this tutorial.
To start your auto typer, put this in the start button or hotkey's code:
Code: Select all
timer1.start 
'(or whatever you called the timer; Such as Start.start or Whatever.start)

CAUTION:

IF YOU SET THE TIMER INTERVAL TO 1, IT IS VERY HARD TO STOP IF STARTED BY HOTKEY!
1 post Page 1 of 1
Return to “Tutorials”