Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 18:17

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[QUESTION] Java: input keystrokes to other program?

Discussion on [QUESTION] Java: input keystrokes to other program? within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
strontklit's Avatar
 
elite*gold: 0
Join Date: Mar 2012
Posts: 220
Received Thanks: 117
[QUESTION] Java: input keystrokes to other program?

Hi,

I was wondering if i program a GUI and everything in java so that i can make keys get repeated multiple times (to create a bot) which i can do so far, is there a way to input these keystrokes to another program (a game)?

I am not asking how to program all the rest just if there is a way to input it?

I hope someone can help me. I prefer english answers but i can read german too just not write it

Thanks in advance
strontklit is offline  
Old 09/23/2012, 14:00   #2

 
Obilee's Avatar
 
elite*gold: 11
Join Date: May 2007
Posts: 62,452
Received Thanks: 29,520
Switch the focus to the game window and repeat the keys with the robot class:

Code:
 Robot robot = new Robot();
            // Creates the delay of 5 sec so that you can open notepad before
            // Robot start writting
            robot.delay(5000);
            robot.keyPress(KeyEvent.VK_H);
            robot.keyPress(KeyEvent.VK_I);
            robot.keyPress(KeyEvent.VK_SPACE);
            robot.keyPress(KeyEvent.VK_B);
            robot.keyPress(KeyEvent.VK_U);
            robot.keyPress(KeyEvent.VK_D);
            robot.keyPress(KeyEvent.VK_Y);
Obilee is offline  
Reply


Similar Threads Similar Threads
[Question/Problem] Keystrokes not recognized
02/20/2012 - AutoIt - 2 Replies
Hi, a friend asked me to write a small hotkey macro. Normaly that isnt a problem Ive done those for many games but with this one, it just wont work. First Problem: Send(), ControlSend() and _PostMessage... dont work. It works fine for notepad aso. but as soon as the game is active the keystrokes dont work. i.e. sending space wont let you jump, enter doesnt toggle chat input on/off and a string doesnt appear in the chat input. Second Problem: I create a hotkey that works fine outside...
[JAVA] .jar-File [,,Could not find the main class - program will exit"]
10/28/2011 - General Coding - 6 Replies
Hallo. Habe heute mit Eclipse eine kleine GUI (swing) Anwendung geschrieben und wollte diese in ein .jar.Archiv packen. (IDE : eclipse). Nun suche ich schon seit Stunden nach einer Lösung für das Problem, denn wenn ein Freund von mir auf seinem Rechner diese jar Datei starten möchte, erscheint die Fehlermeldung : "could not find the main class - program will exit". Vllt. weiß jemand von euch weiter... lg
[Question]GUI Intereface Input Text.
06/08/2010 - CO2 Private Server - 5 Replies
Hey, needing help on my source(USES GUI) i made it GUI but i don't understand how do i do the input text? Like elite-coemu it starts up server and when u press start it inputs the text in the text box Like so if i put console.writeline("Bleh"); Or Database.LoadMobs; I want it to input that text in the text box any ideas?
Question about Coding.... Please Read and Input Your Idea.
03/09/2010 - CO2 Private Server - 14 Replies
Well basically I want to know if anyone has ever heard of or seen anything like this before. A person I met has this pserver, and on it they have what they call Epics. They claim as if these are AI or Artificial Intelligence Characters. But you see my dilemma is they are claiming that each of these can imitate people, have their own attitude and can talk to you, as well as normal humans. Just seems odd to me, I've never seen anything like it. The people claim: They've got the basic GM...



All times are GMT +2. The time now is 18:17.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.