-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
174 lines (138 loc) · 3.5 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#include <iostream>
#include <windows.h>
using namespace std;
struct {
POINT options;
POINT review;
POINT blank;
} pos;
POINT get_rev();
POINT get_opt();
POINT get_blank();
void forever(int tabs, int delay);
void repeat(int tabs, int delay);
void click(POINT options, POINT review, POINT blank, int tabs);
void click_func(DWORD dwFlag);
void key(int tabs);
void key_hit(WORD key);
void key_release(WORD key);
int main(void) {
int in_definate, tabs, delay;
cout << "(1) Forever Loop / (2) Repeat Loop: ";
cin >> in_definate;
cout << "How many tabs do you want to open each time. 1 tab/min = 4000pts: ";
cin >> tabs;
cout << "What is the delay for the loading tab (ms): ";
cin >> delay;
if (in_definate == 1) {forever(tabs, delay);}
else if (in_definate == 2) {repeat(tabs, delay);}
else {return 1;}
}
void forever(int tabs, int delay) {
pos.options.x = 784;
pos.options.y = 415;
pos.blank.x = 688;
pos.blank.y = 414;
pos.review.x = 815;
pos.review.y = 453;
POINT options = pos.options; /*get_opt()*/
POINT review = pos.review; /*get_rev()*/
POINT blank = pos.blank; /*get_blank()*/
Sleep(3000);
while (true) {
click(options, review, blank, tabs);
Sleep(delay);
key(tabs);
Sleep(500);
}
}
void repeat(int tabs, int delay) {
pos.options.x = 784;
pos.options.y = 415;
pos.blank.x = 688;
pos.blank.y = 414;
pos.review.x = 815;
pos.review.y = 453;
POINT options = pos.options; /*get_opt()*/
POINT review = pos.review; /*get_rev()*/
POINT blank = pos.blank; /*get_blank()*/
int repeats;
cout << "Repeats: ";
cin >> repeats;
Sleep(3000);
for (int i = 0; i < repeats; i++) {
click(options, review, blank, tabs);
Sleep(delay);
key(tabs);
Sleep(500);
}
}
POINT get_opt() {
cout << "Input Options Button's Location eg:16 34: ";
cin >> pos.options.x >> pos.options.y;
return pos.options;
}
POINT get_rev() {
cout << "Input Review Button's Location eg:16 34: ";
cin >> pos.review.x >> pos.review.y;
return pos.review;
}
POINT get_blank() {
cout << "Input a Blank Space Location eg:16 34: ";
cin >> pos.blank.x >> pos.blank.y;
return pos.blank;
}
void click(POINT options, POINT review, POINT blank, int tabs) {
// Click Blank Space
SetCursorPos(blank.x, blank.y);
click_func(MOUSEEVENTF_LEFTDOWN);
click_func(MOUSEEVENTF_LEFTUP);
// Click Options Button
SetCursorPos(options.x, options.y);
click_func(MOUSEEVENTF_LEFTDOWN);
click_func(MOUSEEVENTF_LEFTUP);
// Middle-Click Review Button for (tabs)
for (int i = 0; i < tabs; i++) {
SetCursorPos(review.x, review.y);
click_func(MOUSEEVENTF_MIDDLEDOWN);
click_func(MOUSEEVENTF_MIDDLEUP);
}
}
void click_func(DWORD dwFlag) {
INPUT input;
input.type = INPUT_MOUSE;
input.mi.dwFlags = dwFlag;
SendInput(1, &input, sizeof(INPUT));
Sleep(10);
}
void key(int tabs) {
for (int i = 0; i < tabs; i++) {
// keep Ctrl held
key_hit(VK_CONTROL);
// hit and release Tab
key_hit(VK_TAB);
key_release(VK_TAB);
// hit and release V
key_hit(0x56);
key_release(0x56);
// release Ctrl
key_release(VK_CONTROL);
}
for (int i = 0; i < tabs; i++) {
// keep Ctrl held
key_hit(VK_CONTROL);
// hit and release W
key_hit(0x57);
key_release(0x57);
// release Ctrl
key_release(VK_CONTROL);
}
}
void key_hit(WORD key) {
keybd_event(key, 0, 0, 0);
Sleep(10);
}
void key_release(WORD key) {
keybd_event(key, 0, KEYEVENTF_KEYUP, 0);
Sleep(10);
}