Good evening readers Habra! Recently, one person showed a macro bot for the Diamond Dash browser post . And he did everything using the AutoIt macro language. And I remembered that I used the AutoIt library to develop a semi-automatic bot on C #. As I developed, see below ...
Necessary funds for work
VisualStudio 2010 itself
C # skills
And AutoIt Library
First of all I downloaded AutoIt ( AutoIt Full Installation ) and installed it. Then in VisualStudio added library. I do not know why but I could not use the library without installing the exe file.
Beginning of work
The essence of my program was to select a rectangle and then use its hot keys to indicate its position and also indicate how many fields there are. For example:
The position of the rectangle is given by points 1.1, 1.n, n.1.
Height 4
Width 3
Hotkeys:
To use hot keys, I used the class found on the Internet , which used hot keys not only with the active application window, but also with the inactive one. ')
My hotkey code:
HotKey[] Key = new HotKey[4]; Key[1] = new HotKey(); Key[2] = new HotKey(); Key[3] = new HotKey(); Key[1].KeyModifier = HotKey.KeyModifiers.Shift; Key[1].Key = Keys.Q; Key[1].HotKeyPressed += new KeyEventHandler(position1); Key[2].KeyModifier = HotKey.KeyModifiers.Shift; Key[2].Key = Keys.W; Key[2].HotKeyPressed += new KeyEventHandler(position2); Key[3].KeyModifier = HotKey.KeyModifiers.Shift; Key[3].Key = Keys.E; Key[3].HotKeyPressed += new KeyEventHandler(position3);
We get 3 hot keys: Shift + Q, Shift + W, Shift + E, which execute the position1, position2 and position3 events. You can use not only Shift but Ctrl, Alt, Win or nothing.
Calculation points for "click":
We transfer positions to the program to calculate the grid for which you need to make clicks.
Calculation Code:
private void button1_Click(object sender, EventArgs e) { int shirina = Convert.ToInt32(textBox4.Text); int Vnax, Vnay, Vx, Vy, Nx, Ny; Vx = Convert.ToInt32(textBox1.Text); Vy = Convert.ToInt32(textBox2.Text); Nx = Convert.ToInt32(textBox3.Text); Ny = Convert.ToInt32(textBox6.Text); Vnax = (Convert.ToInt32(textBox7.Text) - Convert.ToInt32(textBox1.Text)) / (shirina - 1); Vnay = (Convert.ToInt32(textBox2.Text) - Convert.ToInt32(textBox8.Text)) / (shirina - 1); for (int i = 1; i <= shirina; i++) { Shag(Vx, Vy, Nx, Ny); Vx += Vnax; Vy -= Vnay; Nx += Vnax; Ny -= Vnay; } } private void Shag(int Vx, int Vy, int Nx, int Ny) { int vysota = Convert.ToInt32(textBox5.Text); int nax, nay, x, y; int nS = 4; int nCout = 1; String Str = "left"; nax = (Nx - Vx) / (vysota - 1); nay = (Ny - Vy) / (vysota - 1); x = Vx; y = Vy; for (int i = 1; i <= vysota; i++) { autoIt.MouseClick(Str, x, y, nCout, nS); x += nax; y += nay; } Options:
Vx, Vy upper point position
Nx, Ny lower point position
And the most interesting thing about the Shag method, in which we call its parameters from the AutoIt MouseClick library:
x, y - the position of the point to click
nS - the speed of moving the cursor from one point to another
nCout - the number of clicks
Str - which button to click, right or left
Well, that's all I showed you. Sources of my program: Download .
A small video of the application:
I do not know why the cursor disappeared, but in the previous one. watching it was. Used camtasia
Pressing a little hangs, my weak beech + Camtasia was guilty of this well, it loaded the system
and more, the accuracy of clicks depends on the correct positioning of the area for "clicking"
PS: I express my gratitude to my mother, who once asked me to think of how to spend less time on Farm Frenzy apps, but since she could not refuse at all, I wrote this program. At first I had to teach her a little about using the program, but now she is happy.