November 1, 201510 yr Hello! I've been working hard on learning how to use OSBot and i've just finished my latest script, HOWEVER, I am using getKeyboard().typeString and realised how slow it types. I am looking for something that types a lot faster, and was wondering how I would make it type a lot faster than it currently does (which isn't fast at all). ANY help is appreciated as always, and I thank you for helping me learn Java and the OSBot api
November 1, 201510 yr Hello! I've been working hard on learning how to use OSBot and i've just finished my latest script, HOWEVER, I am using getKeyboard().typeString and realised how slow it types. I am looking for something that types a lot faster, and was wondering how I would make it type a lot faster than it currently does (which isn't fast at all). ANY help is appreciated as always, and I thank you for helping me learn Java and the OSBot api Wouldnt you change something like the sleeping condition? Lower the time before it re-starts that part.
November 1, 201510 yr Author Wouldnt you change something like the sleeping condition? Lower the time before it re-starts that part. The sleeping condition won't affect how fast the keys are pressed
November 1, 201510 yr http://osbot.org/forum/topic/73829-smartkeyboard-better-human-typing/ I think this might help
November 1, 201510 yr Author http://osbot.org/forum/topic/73829-smartkeyboard-better-human-typing/ I think this might help Thanks for the idea. I will have a look at it, however, I doubt this is going to make it type fast, this is more making the typing look human (by making mistakes), I don't want mistakes in mine, I want it to type really fast (almost instant), as this is going to be ran on trash accounts so I don't care about how human-like it looks
November 1, 201510 yr Thanks for the idea. I will have a look at it, however, I doubt this is going to make it type fast, this is more making the typing look human (by making mistakes), I don't want mistakes in mine, I want it to type really fast (almost instant), as this is going to be ran on trash accounts so I don't care about how human-like it looks Someone had the source for an instant typer once upon a time, not sure how it was done but try looking into KeyEvents?
November 3, 201510 yr Try something like this? (This is probably what typeString does, but with a substantial delay between each key) void typeFast(String str) { for(char c : str.toCharArray()) { getKeyboard().typeKey(c); } getKeyboard().typeKey((char)KeyEvent.VK_ENTER); } Edited November 3, 201510 yr by FrostBug
November 4, 201510 yr Try something like this? (This is probably what typeString does, but with a substantial delay between each key) void typeFast(String str) { for(char c : str.toCharArray()) { getKeyboard().typeKey(c); } getKeyboard().typeKey((char)KeyEvent.VK_ENTER); } typeKey() still has the delay afaik (hence why my SmartKeyboard is still pretty slow). Also, when pressing enter, you want to send 13 & 10 in rapid succession (\r\n): getKeyboard().typeKey((char)13); getKeyboard().typeKey((char)10);
November 5, 201510 yr typeKey() still has the delay afaik (hence why my SmartKeyboard is still pretty slow). Also, when pressing enter, you want to send 13 & 10 in rapid succession (\r\n): getKeyboard().typeKey((char)13); getKeyboard().typeKey((char)10); if typekey has a delay, just simulate it instead getKeyboard().pressKey(c); getKeyboard().releaseKey(c); I'll assume typekey does the same, but with a delay inbetween the two Also, do you have a source for the \r\n thing? I really kind of doubt it's necessary. What reason would the game applet have to not simply listen for the VK_ENTER keypress? That's all the actual keyboard key triggers. Edited November 5, 201510 yr by FrostBug
November 7, 201510 yr if typekey has a delay, just simulate it instead getKeyboard().pressKey(c); getKeyboard().releaseKey(c); I'll assume typekey does the same, but with a delay inbetween the two Also, do you have a source for the \r\n thing? I really kind of doubt it's necessary. What reason would the game applet have to not simply listen for the VK_ENTER keypress? That's all the actual keyboard key triggers. For some reason getKeyboard().pressKey(c); getKeyboard().releaseKey(c); Does not work for me (maybe I am doing something wrong) However this does: private void typeStringInstant(String output){ for(int i = 0; i < output.length(); i ++){ char c = output.charAt(i); int code = KeyEvent.getExtendedKeyCodeForChar(c); // Type the character getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c); } // Press enter getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1); // Release enter getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000', 1); } Edit: GIF demonstration: https://gyazo.com/36757b8e49c1abbcc4b0a4090bb6322e Edited November 7, 201510 yr by Explv
November 7, 201510 yr For some reason getKeyboard().pressKey(c); getKeyboard().releaseKey(c); Does not work for me (maybe I am doing something wrong) However this does: private void typeStringInstant(String output){ for(int i = 0; i < output.length(); i ++){ char c = output.charAt(i); int code = KeyEvent.getExtendedKeyCodeForChar(c); getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c); } // Press the enter key getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1); } Edit: GIF demonstration: https://gyazo.com/36757b8e49c1abbcc4b0a4090bb6322e You might want to generate a release key event as well (See TypeKeyEvent, which also acquires exclusive access to the KeyEventHandler, that could be a good idea as well).
November 7, 201510 yr You might want to generate a release key event as well (See TypeKeyEvent, which also acquires exclusive access to the KeyEventHandler, that could be a good idea as well). Oops didn't even notice. Corrected my post, thanks for pointing it out. Edited November 7, 201510 yr by Explv
Create an account or sign in to comment