Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Java Question
Index -> Programming, Java -> Java Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic
Author Message
zaczac




PostPosted: 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 Embarassed
 
Sponsor
Sponsor
Sponsor
sponsor
SNIPERDUDE




PostPosted: 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




PostPosted: 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




PostPosted: Thu Mar 18, 2010 6:45 pm   Post subject: RE:Java Question

Should work on websites and saved documents that you call.
 
zaczac




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
 
DtY




PostPosted: Thu Mar 18, 2010 9:33 pm   Post subject: RE:Java Question

Check out AutoIt (if you're on Windows): http://www.autoitscript.com/autoit3/index.shtml

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




PostPosted: 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




PostPosted: 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. Wink

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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
 
DemonWasp




PostPosted: Thu Mar 18, 2010 11:42 pm   Post subject: RE:Java Question

Hmm, I suppose. Still, it seems completely insane that one app is allowed to view and edit the window contents / memory of another application.
 
SNIPERDUDE




PostPosted: Fri Mar 19, 2010 1:47 am   Post subject: RE:Java Question

There have been many worse programs written.
 
Tony




PostPosted: Fri Mar 19, 2010 4:11 am   Post subject: Re: RE:Java Question

SNIPERDUDE @ Fri Mar 19, 2010 1:47 am wrote:
There have been many worse programs written.

Tony @ Thu Mar 18, 2010 11:26 pm wrote:
... screenshots ... screencasts ... audio recordings


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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
 
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic

Page 1 of 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: