Auto Clicker in C++

xeus

Broken In
Okay so what I want to do is :-
Create a program that can, say for example, switch to an already opened up google search page.
Type in a given string and press enter.

Once more.
The google search page is open.[Type anything on google.com and then THAT next page is the one ..]
**So , the search box ,where you enter text has fixed coordinates..
(Which website doesnt matter, only coordinates do!)

I want the mouse to go to those coordinates, *click* and now a cursor will appear on the search box.
After this I want to send a fixed string output...That is , it should actually type in the string in that search box.
then press enter.

That's it .
[P.S. - obviously I don't want to do this with google, that was just an example.]

Mini Algorithm-
1)Get the mouse pointer to the x-y coords
2)Click!
3)Type in the fixed string.
4)Enter..

I can put it in a loop, don't bother with the easy bits
I need to know how to control the mouse, and how to send the input string.
Code snippets would be perfect

Thank you !
 

Amithansda

Journeyman
Okay so what I want to do is :-
Create a program that can, say for example, switch to an already opened up google search page.
Type in a given string and press enter.

Once more.
The google search page is open.[Type anything on google.com and then THAT next page is the one ..]
**So , the search box ,where you enter text has fixed coordinates..
(Which website doesnt matter, only coordinates do!)

I want the mouse to go to those coordinates, *click* and now a cursor will appear on the search box.
After this I want to send a fixed string output...That is , it should actually type in the string in that search box.
then press enter.

That's it .
[P.S. - obviously I don't want to do this with google, that was just an example.]

Mini Algorithm-
1)Get the mouse pointer to the x-y coords
2)Click!
3)Type in the fixed string.
4)Enter..

I can put it in a loop, don't bother with the easy bits
I need to know how to control the mouse, and how to send the input string.
Code snippets would be perfect

Thank you !

I dunno how to do it using C++, But you can
1.Make a simple asp page
2.add references to jQuery files,
3.Use iframe to open the desired web page.
4.Use IE/FF/Chrome developers tool to find id of the "Search" button.
5.Trigger 'click' on the Search button using jQuery.


However, iFrame concept will work only if the website does not forbid you to use that in iFrame. Google won't let you use iframe.
 
Use jsoup to do all that. It's a Java based HTML parser. It's very easy and you'll be able to do anything you want with a webpage. Click, simulate button press, get/send cookies and many more things.
 

Nerevarine

Incarnate
+1 for AHK

+1 for AHK

Code:
F1::
Mouseclick, left, X, Y ;Replace X, Y with your Fixed coordinates
Send, {YourText}
Send, {Return}
Return

F2::
exitapp
Return
Pressing F1 will start the action
I think thats about it in AHK, tweak it around a little to fit to your requirements, if required, use
Code:
Sleep, DelayinMilliseconds
wherever you need a delay in time..
 
Top Bottom