Posted: Thu Mar 18, 2010 3:03 am Post subject: Java Question
Just wanted to know if it is possible to code a program using java that would get a colour or text from another program that is open then play a sound if the colour or text im looking for is found. Thanks
Sponsor Sponsor
SNIPERDUDE
Posted: Thu Mar 18, 2010 11:41 am Post subject: RE:Java Question
You mean something like a text file? Word file? or Webpage?
I'm sure it is possible in some form or another, but I don't know too much in Java to help you.
DemonWasp
Posted: Thu Mar 18, 2010 3:30 pm Post subject: RE:Java Question
There are many ways of passing information from one program to another. Common methods include pipes, network connections and shared memory. Java fully supports the first two.
If you mean "look at another application's window, read the text / colours there, then act on that information", then almost certainly no, since you shouldn't be able to do that.
SNIPERDUDE
Posted: Thu Mar 18, 2010 6:45 pm Post subject: RE:Java Question
Should work on websites and saved documents that you call.
zaczac
Posted: Thu Mar 18, 2010 6:58 pm Post subject: Re: Java Question
Would it be possible to use another language to do so?, I need a program that will find a string of text from another program that will be placed on my screen \ same spot every time.
Barbarrosa
Posted: Thu Mar 18, 2010 7:06 pm Post subject: Re: Java Question
As long as it's visible on top of everything else, I've seen applications take video recordings of the screen. Find how one of those works, apply some text/image recognition, and you should have what you need.
SNIPERDUDE
Posted: Thu Mar 18, 2010 8:45 pm Post subject: RE:Java Question
That could do it. Mind if I ask what it's for?
X Abstract X
Posted: Thu Mar 18, 2010 9:16 pm Post subject: Re: Java Question
This would be a huge amount of work but if the target program is written in Java you could try using the Java Reflection API. If the program isn't a Java application then http://en.wikipedia.org/wiki/Hooking. Seriously though, this is probably not worth the trouble.
Sponsor Sponsor
Tony
Posted: Thu Mar 18, 2010 9:24 pm Post subject: Re: RE:Java Question
DemonWasp @ Thu Mar 18, 2010 3:30 pm wrote:
If you mean "look at another application's window, read the text / colours there, then act on that information", then almost certainly no, since you shouldn't be able to do that.
Sounds like the target application is a simple bot of some kind; so there are plenty of counter-examples to the above statement... But it's a non-trivial amount of work. That is to say, it's possible to do and it has been done, but there is no "just run this code" type of a solution.
It definitely wouldn't be able to read text (strings don't exist on the screen, they're bitmap images, you could capture it, and use an ocr program to *attempt* to convert it back to the text you want), but it might be able to do stuff based on the colour at a position.
---
If you're on Linux, look for an X11 library for Java, I'm pretty sure you can get pixel by pixel information for any window with X11. You'll need to access it by window id, though (and don't expect X programming to be intuitive).
DemonWasp
Posted: Thu Mar 18, 2010 10:58 pm Post subject: Re: RE:Java Question
Tony @ Thu Mar 18, 2010 9:24 pm wrote:
DemonWasp @ Thu Mar 18, 2010 3:30 pm wrote:
If you mean "look at another application's window, read the text / colours there, then act on that information", then almost certainly no, since you shouldn't be able to do that.
Sounds like the target application is a simple bot of some kind; so there are plenty of counter-examples to the above statement... But it's a non-trivial amount of work. That is to say, it's possible to do and it has been done, but there is no "just run this code" type of a solution.
So, you're saying that if I type in my credit card number in a Firefox window, another application should be able to screen-read that?
I could have been clearer: You shouldn't be able to do it, but you probably can.
Tony
Posted: Thu Mar 18, 2010 11:26 pm Post subject: RE:Java Question
It'd be easier and more accurate to just keylog what you type and then validate chains of numbers against credit-card formats.
And yes, another application should be able to screen-read what you are doing in Firefox. The alternative is that you no longer own the content that streams through your computer. Incidentally this is exactly what some DRM attempts to achieve -- no more screenshots. No screencasts. No audio recordings.
What should not happen has to do with permissions for that "other application" to run.
Though to be fair, we are not talking about editing anything, not are we talking about memory. Just the capture of output from the display device. Or audio device... also, it should be noted that a network card can be thought of as a type of input/output device... it's just that it's all digital, but that's just technical implementations. Oh, and a wireless connection broadcasts your packets to everybody in the area who cares to listen.