glide Posted December 31, 2018 Share Posted December 31, 2018 (edited) I need help finding a keyboard that types instantly. I used one in the past but it doesn't seem to work anymore and I'm not sure what exactly the issue is. It can be found in this thread here: The solution (which worked in the past) was given by @Explv Thank you. Edited December 31, 2018 by glide Quote Link to comment Share on other sites More sharing options...
jakealaka9 Posted December 31, 2018 Share Posted December 31, 2018 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); } This works almost fine for me. You have to change one thing with the Press enter and release enter. I bet the method generateBotKeyEvent was updated because it shouldn't have the 1 at the end. Instead it should be getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000'); and getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000'); Of course there is also some natural delay between when the chat is sent and when it appears, but it instantly types and sends the message. The code I tested this with and worked is here: package net.chatbox.instantchat; import java.awt.event.KeyEvent; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Helper", info = "Instant Chat", logo = "", name = "Instant Chatter", version = 0) public class InstantChat extends Script{ @Override public int onLoop() throws InterruptedException { return 100; } public void onStart(){ typeStringInstant("This probably will work just fine for me"); } public void onExit() { typeStringInstant("Double-checking this"); } 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'); // Release enter getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000'); } } 1 Quote Link to comment Share on other sites More sharing options...
glide Posted December 31, 2018 Author Share Posted December 31, 2018 2 hours ago, jakealaka9 said: 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); } This works almost fine for me. You have to change one thing with the Press enter and release enter. I bet the method generateBotKeyEvent was updated because it shouldn't have the 1 at the end. Instead it should be getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000'); and getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000'); Of course there is also some natural delay between when the chat is sent and when it appears, but it instantly types and sends the message. The code I tested this with and worked is here: package net.chatbox.instantchat; import java.awt.event.KeyEvent; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Helper", info = "Instant Chat", logo = "", name = "Instant Chatter", version = 0) public class InstantChat extends Script{ @Override public int onLoop() throws InterruptedException { return 100; } public void onStart(){ typeStringInstant("This probably will work just fine for me"); } public void onExit() { typeStringInstant("Double-checking this"); } 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'); // Release enter getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000'); } } Thank you so much! It works perfectly. Quote Link to comment Share on other sites More sharing options...