Explv Posted August 4, 2016 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
whipz Posted March 7, 2017 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
Explv Posted March 7, 2017 Author 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
whipz Posted March 7, 2017 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
whipz Posted March 9, 2017 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 /:
Explv Posted March 9, 2017 Author 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.....
Polymorphism Posted March 23, 2017 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