Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto typer from list ?
#1
Hello all i would like to create a auto typer that loads a list of phrases via text file however i cannot find any tutorials which specify this way. I created a gui of what i would like the program to be like however i cannot seem to figure how to do the code. Gui is as follows I would like the load list to load the text file which has the word phrases. And the start button to paste the words on a interval however after each word is typed i would like it to press enter to make sure the text box is clear. Is this possible if so could someone assist me with this it would be highly appreciated. Kind regards UB3R
Eligible.
Reply
#2
Adding it to the list:
Code:
Using sr As New StreamReader(Environment.ExpandEnvironmentVariables("%UserProfile%\Desktop\file.txt"))
    While sr.Peek > -1
        Dim Ln As String = sr.ReadLine
        If Not String.IsNullOrWhiteSpace(Ln) Then _
        ListBox1.Items.Add(Ln)
    End While
End Using

And for sending them, perhaps you want to make a delay for a couple seconds or so:
Code:
Threading.Thread.Sleep(2000)
For Each Obj As String In ListBox1.Items
    SendKeys.Send(Obj & "~")
Next

Just the basics
Reply
#3
AceInfinity is a great programmer. The code above is perfect.
Reply
#4
All except for that
Code:
Threading.Thread.Sleep(2000)

Line which will freeze the GUI lol.

I know how to avoid doing this with automated back and forth or "shared" (as I like to call it) multi-threading UI timers.
Reply
#5
Sorry about bringing up a older thread. I have compiled the following source however i am having problems Nono. Source as follows.
Quote:Public Class Form1
Dim streamer As IO.StreamReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
streamer = IO.File.OpenText(TextBox1.Text)
Dim mystring() As String = streamer.ReadToEnd.Split(vbNewLine)
ListBox1.Items.AddRange(mystring)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Threading.Thread.Sleep(2000)
For Each Obj As String In ListBox1.Items
Threading.Thread.Sleep(2000)
SendKeys.Send(Obj & "~")
Next
End Sub
End Class
The interval/pasting feature is working perfect however what i would like it to do is press enter after each object off listbox is posted. Also if possible clear the location in which it posted in before posting the next line off the listbox. So it will be something like this. Load text file>Click start>Post line off listbox>pause/enter>clear text previously posted> repeat process but post next line off listbox. Hopefully this is explained well. Much appreciated in advance regards UB3R.
Eligible.
Reply
#6
I seemingly have figured out how to do the enter part etc.However what i would like it to do below is select all text in the location where pasted interval backspace then continue pasting words from the list. If anyone could help me it would highly appreciate it as i am kind of noob. Also much appreciated ace for the code above.
Quote:Public Class Form1
Dim streamer As IO.StreamReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
streamer = IO.File.OpenText(TextBox1.Text)
Dim mystring() As String = streamer.ReadToEnd.Split(vbNewLine)
ListBox1.Items.AddRange(mystring)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Threading.Thread.Sleep(2000)
For Each Obj As String In ListBox1.Items
SendKeys.Send(Obj & "~")
Threading.Thread.Sleep(5000)
SendKeys.Send("{ENTER}")
/////////Select all text needed here i assume.
SendKeys.Send("{BACKSPACE}")
Threading.Thread.Sleep(2000)
Next
End Sub
End Class
Eligible.
Reply
#7
@ÜB3R' - Invoke a virtual key event for the Ctrl + A combination, then Delete or Backspace key, I would use this in it's own void or Sub, whatever, C#/VB. Call it when it's needed, Send the string for the listbox item, send Enter, remove ListBox item at index 0. Although with the way you have it going here, I would change things up a bit.

Example in C#:
Code:
private void button1_Click(object sender, EventArgs e)
{
    new Thread(x => SendStrings()).Start();
}

private void SendStrings()
{
    Thread.Sleep(1000);
    int total = listBox1.Items.Count;
    for (int x = 0; x < total; x++)
    {
        //INVOKE!
        SendKeys.SendWait(listBox1.Items[0].ToString());
        SendKeys.SendWait("{ENTER}");
        Invoke((MethodInvoker)delegate {
            listBox1.Items.RemoveAt(0);
            listBox1.Update();
        });
        Thread.Sleep(1000);
    }
}

• Start new thread
• Sleep thread for 1000 milliseconds
• Define a constant total because listBox1.Items.Count will change when we start removing items
• Loop from 0 for as long as x is less than the total that we've defined for our initial listBox1.Items.Count
• SendKeys for the listBox1.Item at index 0 as a string
• Since this is a thread we need to invoke to update the listBox and remove the item at 0
• Sleep for 1000 just for effect, so we can see a more transitional display of what this code does at a viewable pace

Note:
1) Each time we use listBox1 item at index 0, the buffer of items goes up every time through this loop as we continue to use item at index 0 and clear it out. 1 becomes index 0, 2 becomes index 1 and so on, until all of our items are gone, and none remain at index 0, therefore we should have no more listBox items by the time this loop is done with.

2) //INVOKE! - This is where I would be placing the call to the method where we invoke a virtual keypress to select everything, and delete the text from where ever location is currently active with the mouse ibeam.

Virtual Key constants are defined in a short list here: http://forums.codeguru.com/showthread.ph...ost1737427

There's lots more that I know of, although with some research you probably will see what i'm talking about with Virtual Keys Smile I'll leave that up to you to find out what it is though. I've started you off with all that you need to know here, and provided you a good direction for what you're trying to achieve.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [RELEASE] Auto Forum Launcher Advanced [Updated 09/01/2012]] FizzyMentos 14 3,493 01-16-2012, 02:13 PM
Last Post: FizzyMentos
  [VB.net] Auto fill - Auto Login fanste 2 2,318 12-17-2011, 03:17 PM
Last Post: fanste
  [HELP] AUTO TYPER MirZan 11 3,543 03-21-2011, 12:28 PM
Last Post: z3r0c00l
  [Tut] How to make an auto text spammer in vb 2008. [Beginner] DeMeR 4 4,194 10-04-2010, 07:57 AM
Last Post: Jordan L.
  Auto Updater DeHaterZ 6 1,201 07-21-2010, 09:55 PM
Last Post: `P R O D I G Y™

Forum Jump:


Users browsing this thread: 1 Guest(s)