Solved

Injecting Text into a running java application

Posted on 2012-12-26
2
169 Views
Last Modified: 2013-02-04
I have a java app that i launch via a script that calls a .jar file.  That app (awt) is just a big form with jbutton and etc.  i DO NOT have the java source code for this app.

Is it possible to create a second app that will AUTOFILL corresponding fields with values retrieved from the db?

For example:  First name is entered into a webform, gets stored in a database and when the "second app" is executed it pulls the data and inserts it into the corresponding mapped field.

Decompiling is not an option as the app gets updates every now and then.

Need an out of the box solution!
0
Comment
Question by:Squadless
2 Comments
 
LVL 26

Accepted Solution

by:
dpearson earned 500 total points
Comment Utility
Your best bet is to explore the "Robot" class:
http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html

This will let you generate mouse events and keyboard events directly.  You should store the location of the fields on the webform in the second app alongside the data that should be entered in the field.  Then you can move the mouse to the correct place on screen, click in the text field and then send keyboard events to type in the values you wish to enter.

When the app is updated, you may need to update the location of the fields if they have moved to a new position on the screen.

Hope that helps,

Doug
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Might be worth a look at http://teststack.github.com/White/
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now