Auto typer from list ? - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19) +---- Thread: Auto typer from list ? (/showthread.php?tid=25599) |
Auto typer from list ? - ÜB3R - 03-13-2012 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 Gui (Click to View) RE: Auto typer from list ? - AceInfinity - 03-13-2012 Adding it to the list: Code: Using sr As New StreamReader(Environment.ExpandEnvironmentVariables("%UserProfile%\Desktop\file.txt")) And for sending them, perhaps you want to make a delay for a couple seconds or so: Code: Threading.Thread.Sleep(2000) Just the basics RE: Auto typer from list ? - Bill Nye The Science Guy - 03-16-2012 AceInfinity is a great programmer. The code above is perfect. RE: Auto typer from list ? - AceInfinity - 03-16-2012 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. RE: Auto typer from list ? - ÜB3R - 07-18-2012 Sorry about bringing up a older thread. I have compiled the following source however i am having problems . Source as follows. Quote:Public Class Form1The 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. RE: Auto typer from list ? - ÜB3R - 07-18-2012 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 RE: Auto typer from list ? - AceInfinity - 07-18-2012 @Ü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) • 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.php?456606-VK_*-(Key-Constants)&p=1737427#post1737427 There's lots more that I know of, although with some research you probably will see what i'm talking about with Virtual Keys 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. |