ninjamuffinz Posted February 19, 2016 Posted February 19, 2016 Is there a way have my bot type a message faster than using getKeyboard.typeString(); I would like the message to be typed instantly, it doesn't matter if it's obvious if ts a bot. I have tried the smart typer posted on these forums but I cant seem to get it to work properly (Throws an exception) Is there a simple way of doing this? Thanks in advance.
FrostBug Posted February 19, 2016 Posted February 19, 2016 you can loop through each character in your string and use the typeKey method or the press/releaseKey methods for each character, and finish off by submitting the ENTER (\n) character. Should be instant
Explv Posted February 19, 2016 Posted February 19, 2016 (edited) See my post here for a working solution:http://osbot.org/forum/topic/85684-finished-my-new-script-but-how-do-i-type-faster/?p=952925I would paste the code but I'm on my phone Edit (pasted code here): 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); } Edited February 19, 2016 by Explv
ninjamuffinz Posted February 19, 2016 Author Posted February 19, 2016 See my post here for a working solution: http://osbot.org/forum/topic/85684-finished-my-new-script-but-how-do-i-type-faster/?p=952925 I would paste the code but I'm on my phone I found your code as mentioned. It works exactly as I needed. Thanks for your help! 1