0

What specifically I need to do. On the click event of a button in my Web Application. I need it to capture

  1. a screenshot.
  2. without bringing the program or the process to front or set focus on it.
  3. and process a simple pattern recognition for this screenshot.
  4. the recognition function will return a bool value.

I don't think that's that easy. but I've never done something like this, and if you could help me to figure out if it's possible and what's a clean way to do this ?

Hint: I'll be trying to recognize just a RadioButton value from an application. I don't have much experience in pattern recognition but I think I won't need a very accurate Algorithm or Framwork as the input quality and picture will be exactly the same. the application will just find the 'RadioButton' that's beside a specific text or if I could specify which part of the image to recognize I won't need the text thing. and it will determine whether it's filled or not!


People will wonder why on earth would I need my application to do that! :D so of course you deserve a reason why you are doing this =).

Clarification:

I need to get a 'RadioButton' value from an application, that is extremely hard to get an API or even a public property to share the value for this 'RadioButton'!

People are down voting and want to close my question! for what reason ? .. I'm sorry for you if you're not open enough to accept that it's not always DataReader, int x, loops and typical stuff! My idea was shutdown and I fought to get it back on. I'm really sorry for you! =)

Mazen Elkashef
  • 3,430
  • 6
  • 44
  • 72
  • Just to clarify: You need to get the value of a radio button, and the best way to do it is to take a screenshot, do csi-style "pattern" recognition, and determine if it clicked or not?!? Me thinks this is the definition of an _[XY Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem/66378#66378)_ – Michael Jasper Oct 09 '11 at 03:47
  • I understand how crazy is this. I'm building a very important web application and the whole idea was shutdown because of this RadioButton value. I'll no way get an API for this program. do you have any ideas ? .. all my web application's calculations will depend on this value and it has to be automated and I can't access this value through an API. so I've thought about it a million time and I already gave up on the idea since the last 10 days. and just right now this idea brought my project to life. "If that's doable!" – Mazen Elkashef Oct 09 '11 at 03:55
  • Either you're playing with us, or someone is playing with _you_. – John Saunders Oct 09 '11 at 04:02
  • Are you sure you need a screen shot? Maybe some other API might help, like the type that permits GUI automation? – John Saunders Oct 09 '11 at 04:04
  • Michael. I just want to add that if you think there might be another way to do that you can't imagine how GRATEFUL I would be. of course this complicated method is not what I've wished for. but if this is my only way then I'll take it .. Again Hopefully it's possible! =) – Mazen Elkashef Oct 09 '11 at 04:17
  • @JohnSaunders .. I Lol'd. It's the last thing to do is to waste my time or your time. so I'm not playing here. and no one is playing with me the application is my sole idea and It's like a small dream I'd be happy if I could build it :) .. about your 2nd comment I'm sorry I didn't get it "Maybe some other API might help, like the type that permits GUI automation?" !? – Mazen Elkashef Oct 09 '11 at 04:19
  • 1
    See [UI Automation Fundamentals](http://msdn.microsoft.com/en-us/library/ms753107.aspx). – John Saunders Oct 09 '11 at 07:54
  • I saw this question http://stackoverflow.com/questions/1220690/how-can-you-read-values-from-an-open-application-in-windows which is exactly what I'm trying to achieve but the problem here is that I don't even see an answer to the question, beside that my program users won't have an administrative privileges, and it's very restricted they can't even right click or open any Windows Explorer. all what they can do is see the External devices like USB and MyDocuments and that's it! – Mazen Elkashef Oct 09 '11 at 08:12
  • @John Saunders .. I Will – Mazen Elkashef Oct 09 '11 at 08:13

1 Answers1

2

To take screen shot thru html and javacript is simply not possible, you have to use flash or silverlight.

(Posting from mobile)

Community
  • 1
  • 1
Harsh Baid
  • 7,199
  • 5
  • 48
  • 92
  • +1 I really appreciate your help. but I just want to make sure did you mean I can't take a screenshot from an application, or from a webpage or both ? .. because actually I know an application in a company that takes frequent screenshots from their website when used by visitors – Mazen Elkashef Oct 09 '11 at 06:59
  • 2
    @lKashef: it is not possible, in general, for a web page to take a screen shot. The only exception would be if the web page contains an applet or ActiveX control that can take the screenshot, or maybe if Flash or Silverlight is being used. It's a serious security breach, unless the user of the web site permits it. – John Saunders Oct 09 '11 at 07:53
  • Hmm, Ok so this means that Windows Application can do it ? I think yeah because I saw some answers here in this subject. I read like 10 of them and they are not working. Always something is wrong or the code sample is not complete. If I changed my application from web to windows, do you have any idea or have any article that posts like a complete example to get a screenshot for a specific application ? – Mazen Elkashef Oct 09 '11 at 08:10
  • http://stackoverflow.com/questions/4595923/run-winforms-control-inside-webforms-and-take-screenshot-of-it check this link .. – Harsh Baid Oct 09 '11 at 08:20
  • This link provides code using windows application http://geekswithblogs.net/Maisblog/archive/2010/01/14/screenshot-using-windows-forms.aspx – Harsh Baid Oct 09 '11 at 08:24
  • I meant not possible using html and javascript.. But possible in application ofcourse.. And also possible using flash or silverlight or as @johnsaunders said... – Harsh Baid Oct 09 '11 at 08:31
  • Ok I checked the article for the screenshot but it's not for a specific application! it's a normal screenshot. I tried to implement it and then try to add some code for the specific program thing, but something's wrong with the page! can you see the full code ? because on my PC it seems pretty missed up! the last line that I can see is finally{ !! – Mazen Elkashef Oct 09 '11 at 08:44
  • Well that's good because eventually I was going to convert my WebApp to a WinApp but I just didn't want to bother the company to setup a new application that is still not trusted all over the company's PCs! .. but whatever let's do it as a WinApp =D I'll focus on how to get my screenshot then we can see the part with the recognition. – Mazen Elkashef Oct 09 '11 at 08:46
  • 1
    I have the same view.. He he.. I think u have to apply some logic to save the bitmap object in a file.. Finally block should have some object disposing code.. I think this logical now.. Pls try some r N d or OUR god GOOGLE – Harsh Baid Oct 09 '11 at 08:53
  • Lol =D .. Well I solved the issue with my good friend Firefox, I just disabled the style and I have some news, The tutorial is available in VB.NET TOO! lol but I think a lot of people will miss on that =) .. anyway I took the screenshot and everything is good for now. but I need to do it for a specific program now. I'll do my research but if you found anything please update me. Thanks Harsh for your help, I really appreciate it =) – Mazen Elkashef Oct 09 '11 at 09:06
  • Great if my answer was helpful, then pls accept my answer..yes I'll update if any.. And you can post any other solution which works for u as answer as well finally.. :D – Harsh Baid Oct 09 '11 at 09:26