Results 1 to 12 of 12
- 06-01-2010, 04:44 AM #1
Member
- Join Date
- Jun 2010
- Location
- GDL MEXICO
- Posts
- 6
- Rep Power
- 0
How to localize the position on screen of a running java application?
Hi!
Im trying to create an application to automate a procedure...
The thing is that I need to localize on screen a running java application, I mean the X and Y values where is positioned that app...
but I have no idea how can I do that...
Can someone help me? :confused:
Thank You
:)Last edited by lolaika; 06-01-2010 at 07:30 PM.
- 06-01-2010, 10:59 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
Is your application running in the same JVM? If so you can get all the frames with the Frame.getFrames() method and you're in business. If not, the other application has to cooperate a bit, e.g. it should save its frame position in a file which your application can access. Grabbing the screen image and analyzing it is a last (tedious) resort.
kind regards,
Jos
- 06-01-2010, 07:15 PM #3
Member
- Join Date
- Jun 2010
- Location
- GDL MEXICO
- Posts
- 6
- Rep Power
- 0
The application is not running in the same JVM... And I cant modify the other app ... So I guess I could use the third option, but how do I do that?
Thanx
- 06-01-2010, 07:26 PM #4
See the Robot class for how to capture the current screen.
From that image, create a byte array and scan it.
Grabbing the screen image and analyzing it is a last (tedious) resort.
- 06-01-2010, 07:29 PM #5
Member
- Join Date
- Jun 2010
- Location
- GDL MEXICO
- Posts
- 6
- Rep Power
- 0
ok, I create a byte array... But how can I identify where the app begins? Or a textfield begins? :confused:
Last edited by lolaika; 06-01-2010 at 07:31 PM.
- 06-01-2010, 08:19 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
- 06-01-2010, 08:23 PM #7
Think at the pixel level. Can you tell when the pixel you are looking at is on the desktop and when it is part of a window? Perhaps in a well defined environment. In general:
Don't go there, forget about it.
- 06-01-2010, 08:34 PM #8
Member
- Join Date
- Jun 2010
- Location
- GDL MEXICO
- Posts
- 6
- Rep Power
- 0
ok ok...
I'll try to do it...
Buy anyone hot another idea?
How can I do it?
:D
- 06-01-2010, 08:37 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
- 06-01-2010, 08:48 PM #10
An idea on how to get some insights:
Get a program that will display the value of pixels at the mouse when the mouse scans over an image. What color is a window's title bar. What color is the desktop. You run the cursor up and down and left and right and see where there are different colors/things.
Better go to Google and see what's been done.
- 06-01-2010, 09:03 PM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
This is going to be a lost battle: the OP even wants to recognize 'the start of a text field', so even *shudder* the contents of such a field (eeww, character recognition comes to mind). Font comparisons, anti aliased rendering and all that horror; (partially) hidden characters but still present in that other application; I don't even want to think about it; I'm afraid my first advice still applies: you don't want to go there, forget about it.
kind regards,
Jos
- 06-01-2010, 10:34 PM #12
I agree. I'd thought of doing something like what the OP wants to do but gave up. I was trying to sucker someone to doing the work as I watched. Oh well.
I did a simple program that filled in a drawn closed shape but it only had the two colors of the shape and the background to consider and so could easily find the boundary.
Similar Threads
-
How to position a modal dialog box at the center of the screen?
By javaexplorer in forum AWT / SwingReplies: 3Last Post: 01-16-2010, 07:14 PM -
running a java application on Japanese OS
By yibingdong in forum Advanced JavaReplies: 4Last Post: 09-09-2009, 10:01 PM -
Problem running a java desktop application
By chris@gaiag.net in forum AWT / SwingReplies: 2Last Post: 08-24-2008, 04:24 AM -
Localize JFileChooser
By Java Tip in forum Java TipReplies: 0Last Post: 03-14-2008, 11:54 AM -
Running a application in java
By barney in forum Java AppletsReplies: 1Last Post: 08-07-2007, 07:12 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks