Explv Posted August 4, 2016 Share Posted August 4, 2016 (edited) So this is a snippet I wrote as a reply to a thread, but it's pretty buried and some people may find it useful: public final void typeStringInstant(final String output){ for(int i = 0; i < output.length(); i ++){ getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_UNDEFINED, output.charAt(i)); } getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_UNDEFINED, (char) VK_ENTER); } Edited January 29, 2017 by Explv 8 Quote Link to comment Share on other sites More sharing options...
Acerd Posted August 4, 2016 Share Posted August 4, 2016 nice one Quote Link to comment Share on other sites More sharing options...
Fruity Posted August 4, 2016 Share Posted August 4, 2016 nice Quote Link to comment Share on other sites More sharing options...
Xylate Posted January 24, 2017 Share Posted January 24, 2017 gravedigging idgaf. Thanks:) Quote Link to comment Share on other sites More sharing options...
whipz Posted March 7, 2017 Share Posted March 7, 2017 Hey man I get this KEY_TYPED cannot be resolved to a variable for obviously KEY_TYPED has it slightly changed ? @Explv Quote Link to comment Share on other sites More sharing options...
Explv Posted March 7, 2017 Author Share Posted March 7, 2017 2 hours ago, whipz said: Hey man I get this KEY_TYPED cannot be resolved to a variable for obviously KEY_TYPED has it slightly changed ? @Explv You have to import it from this class https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html Quote Link to comment Share on other sites More sharing options...
whipz Posted March 7, 2017 Share Posted March 7, 2017 import java.awt.event.KeyEvent; ? @Explv 14 minutes ago, Explv said: You have to import it from this class https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html Quote Link to comment Share on other sites More sharing options...
whipz Posted March 9, 2017 Share Posted March 9, 2017 On 3/7/2017 at 7:44 PM, Explv said: You have to import it from this class https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html I still cant get it to work even with that import i still get same error /: Quote Link to comment Share on other sites More sharing options...
Explv Posted March 9, 2017 Author Share Posted March 9, 2017 9 hours ago, whipz said: I still cant get it to work even with that import i still get same error /: With that import you would have to change it to KeyEvent.KEY_TYPED..... Quote Link to comment Share on other sites More sharing options...
Polymorphism Posted March 23, 2017 Share Posted March 23, 2017 On 3/8/2017 at 7:14 PM, whipz said: I still cant get it to work even with that import i still get same error /: I believe a static import would solve that problem. Use static imports sparingly however Quote Link to comment Share on other sites More sharing options...