# Auto Clicker in C++



## xeus (May 31, 2013)

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 (Sep 3, 2013)

xeus said:


> 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.
> 
> ...



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.*


----------



## HauntedGuy (Dec 10, 2013)

a simple way to do it is an AutoHotkey script. Google it.


----------



## harshilsharma63 (Dec 11, 2013)

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.


----------



## TheHumanBot (Dec 11, 2013)

imacro firefox. enough said.


----------



## doomgiver (Dec 11, 2013)

HauntedGuy said:


> a simple way to do it is an AutoHotkey script. Google it.


  +1 for AHK


----------



## mohityadavx (Dec 11, 2013)

Use some good mouse macro recorder  jitbit  is good btw


----------



## Nerevarine (Dec 12, 2013)

doomgiver said:


> +1 for AHK



+1 for AHK


```
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 

```
Sleep, DelayinMilliseconds
```
wherever you need a delay in time..


----------



## a_k_s_h_a_y (Dec 15, 2013)

lol old thread, but yeah this kind of automation sh1t is best done in AHK or AutoIT


----------

