1.

Solve : send keys and find text VB .NET?

Answer»

Hello again and thank you for helping me every time.
Today I was thinking about some stuff in vb and had 2 questions that google didn't answer me:
1. How can I Sendkeys to another process without being focused on, I mean if I have the MS Word opened but minimized or in background, can I send a text to that process without making it on top of all?
2. Is it possible to find a text on another process and get the COORDINATES of where the text is? Ex find the Like button on a website with fb and get the coordinates? Without downloading the webpage, maybe using webbrowser controlQuote

1. How can I Sendkeys to another process without being focused on, I mean if I have the MS Word opened but minimized or in background, can I send a text to that process without making it on top of all?

In windows the only way I know how to pass keystroke info to another program is to select its focus and then enter the information, HOWEVER a memory hack could be performed to pass information into a program that is not the windows focus, but I cant show you how to hack it as for this can be used for evil intent..LOL


Quote
2. Is it possible to find a text on another process and get the coordinates of where the text is? Ex find the Like button on a website with fb and get the coordinates? Without downloading the webpage, maybe using webbrowser control

In order to access the information it will have to be loaded ( aka downloaded to your browser for example ) at least once. There is no way to get information from a website without at least 1 time download of the HTML etc to your browser or custom HTML interpreter which runs out same as a browser and loads the information to perform further tasks with it.

As far as finding the location of the like button it could be done by dumping the video data to a 2 dimensional array and then look for the LIKE SYMBOL. Then when found report back the location. THIS IS A LOT OF WORK! As for you would need to create a template of positives, and change the information from color to Black and White Binary 0's and 1's, where you perform an analysis on pixel locations to detect if the binary layout of the PIXELS match against a positive template or not. Then when found be able to report back the X,Y coordinates which would probably be some trial and error to calibrate.

If looking for text on a web page this is FAR EASIER, but IMAGE recognition of the Like symbol of Facebook would be quite an involved process.

Just had a vision of a flat screen display mated up ( duck taped ) with a DIGITAL OCR scanner to hunt for the FaceBook Like symbol...LOL
1. Not using sendkeys. I don't know what your goal is but it's probably doable using Office Automation.


2. Searching for the like button would be searching for an image, mostly.

Quote from: DaveLembke on August 08, 2012, 12:07:23 PM
If looking for text on a web page this is FAR EASIER, but image recognition of the Like symbol of Facebook would be quite an involved process.
I would think loading it into a webbrowser control and using DOM manipulation to find the image and get it's position might work. Of course as you point out the idea of getting any information from a site without downloading it is pretty silly. Also this has an issue in that if Facebook ever changes the image being pointed to, it stops working.the like button was an example, I want to find a text and click on it automatically but I won't know how to find the text in the pageWith intent of use still unclear, I have this to share:

If you are visiting sites that always have the buttons you want to click in the same location, a simple keyboard/mouse macro can run. I have used such macros to gather information in an automated manner, but they could also be used to add clicks to generate bogus traffic if one was trying to generate what looks like traffic from others to get paid per click. BUT those who pay per click traffic usually track to verify that macro bots aren't creating false traffic from a single IP origin to verify the validity of the traffic that they are paying for. I can only think of a company being a fool to pay per click without such an audit to verify validity of the traffic to be real traffic vs simulated traffic from automation.

If you are trying to find button locations that are ever changing, BC had the best option with the DOM manipulation to find the image and get its position to then send a simulated mouse click to it.

Quote
I want to find a text and click on it automatically
As far as hyperlinks in a web page, to follow those which are linked TEXT, you can create a program that loads the website and searches the HTML for keywords and then reads in the Hyperlink location for that matching text and then runs with that URL to perform additional duties. X and Y location of that text in the page is unnecessary because Hyperlinks in HTML are a standard structure and you can read in all information starting at " and ending at " of the URL to know the start and end point of the URL string in the page you are grabbing the link from. You then can pass that URL into a function that runs to the next page and performs another duty. And that is why finding text is so much easier than finding an image. The only other way i can think of finding an images link would be if the image was always the same name, but that doesnt happen 99% of the time.


Discussion

No Comment Found