-
Notifications
You must be signed in to change notification settings - Fork 0
/
kahoot.ahk
196 lines (183 loc) · 4.12 KB
/
kahoot.ahk
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
; Script to auto enter kahoot
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; TODO Fix spacing issue
Run() {
OnQ := 1
SLEEP_TIME := 500
; Assume Firefox is open and on Kahoot tab
#IfWinNotActive ahk_class MozillaWindowClass
WinActivate, ahk_class MozillaWindowClass
#IfWinNotActive
; Open the spread
; Verify spreadsheet is open
Send {End}
Click 971, 935
Sleep, %SLEEP_TIME%
; Open the spreadsheet
; Asuume its open
WinActivate, ahk_class XLMAIN
MouseMove 1892, 156
Sleep, %SLEEP_TIME%
Click down
MouseMove 254, 156
Sleep, %SLEEP_TIME%
Click up
Sleep, %SLEEP_TIME%
Send ^c
Sleep, %SLEEP_TIME%
Send {Esc}
Sleep, %SLEEP_TIME%
WinActivate, ahk_class MozillaWindowClass ; Go to Q on Kahoot
Click 632, 239
Send ^v
Sleep, %SLEEP_TIME%
; A1
WinActivate, ahk_class XLMAIN
Send, {Right}
MouseMove 1892, 156
Sleep, %SLEEP_TIME%
Click down
MouseMove 254, 156
Sleep, %SLEEP_TIME%
Click up
Sleep, %SLEEP_TIME%
Send ^c
Sleep, %SLEEP_TIME%
Send {Esc}
WinActivate, ahk_class MozillaWindowClass ; Go to Q on Kahoot
MouseMove, 613, 503
Click
Sleep, %SLEEP_TIME%
Send, ^v
Sleep, %SLEEP_TIME%
; A2
WinActivate, ahk_class XLMAIN
Send, {Right}
MouseMove 1892, 156
Sleep, %SLEEP_TIME%
Click down
MouseMove 254, 156
Sleep, %SLEEP_TIME%
Click up
Sleep, %SLEEP_TIME%
Send ^c
Sleep, %SLEEP_TIME%
Send {Esc}
WinActivate, ahk_class MozillaWindowClass ; Go to Q on Kahoot
MouseMove, 613, 605
Click
Sleep, %SLEEP_TIME%
Send, ^v
Sleep, %SLEEP_TIME%
; A3
WinActivate, ahk_class XLMAIN
Send, {Right}
MouseMove 1892, 156
Sleep, %SLEEP_TIME%
Click down
MouseMove 254, 156
Sleep, %SLEEP_TIME%
Click up
Sleep, %SLEEP_TIME%
Send ^c
Sleep, %SLEEP_TIME%
Send {Esc}
WinActivate, ahk_class MozillaWindowClass ; Go to Q on Kahoot
MouseMove, 1208, 503
Click
Sleep, %SLEEP_TIME%
Send, ^v
Sleep, %SLEEP_TIME%
; A4
WinActivate, ahk_class XLMAIN
Send, {Right}
MouseMove 1892, 156
Sleep, %SLEEP_TIME%
Click down
MouseMove 254, 156
Sleep, %SLEEP_TIME%
Click up
Sleep, %SLEEP_TIME%
Send ^c
Sleep, %SLEEP_TIME%
Send {Esc}
WinActivate, ahk_class MozillaWindowClass ; Go to Q on Kahoot
MouseMove, 1208, 605
Click
Sleep, %SLEEP_TIME%
Send, ^v
Sleep, %SLEEP_TIME%
; Notes
WinActivate, ahk_class XLMAIN
Send, {Right}
Send, {Right}
MouseMove 1892, 156
Sleep, %SLEEP_TIME%
Click down
MouseMove 254, 156
Sleep, %SLEEP_TIME%
Click up
Sleep, %SLEEP_TIME%
Send ^c
Sleep, %SLEEP_TIME%
Send {Esc}
WinActivate, ahk_class MozillaWindowClass ; Go to Q on Kahoot
MouseMove, 928, 718
Click
Sleep, %SLEEP_TIME%
Send, ^v
Sleep, %SLEEP_TIME%
; Get secs
WinActivate, ahk_class XLMAIN
Send, {Right}
Send, {Right}
Send, ^c
Sleep %SLEEP_TIME%
WinActivate, ahk_class MozillaWindowClass
Click 642, 345
Sleep %SLEEP_TIME%
; Parse CBoard
clipy := clipboard ; not necessary but for clarity since I further process the variable
clipy := substr(clipy, 1, instr(clipy, "`r") -1) ; just in case there is no "`n" before
Send {Up}
Send {Up}
Sleep %SLEEP_TIME%
Loop, %clipy% {
Send {Down}
}
Send {Enter}
; Select Ans
WinActivate, ahk_class XLMAIN
Loop, 3 {
Send {Left}
}
Send ^c
Sleep %SLEEP_TIME%
clipy := clipboard ; not necessary but for clarity since I further process the variable
clipy := substr(clipy, 1, instr(clipy, "`r") -1) ; just in case there is no "`n" before
WinActivate, ahk_class MozillaWindowClass
IfEqual, clipy, A, Click 941, 500
IfEqual, clipy, B, Click 941, 597
IfEqual, clipy, C, Click 1526, 500
IfEqual, clipy, D, Click 1526, 597
Sleep %SLEEP_TIME%
; DONE!
Click 1867, 100
Sleep %SLEEP_TIME%
WinActivate, ahk_class XLMAIN
Loop, 5 {
Send {Left}
}
Sleep %SLEEP_TIME%
Send {Down}
}
F9::ExitApp
F8::
Loop, 3 {
Run()
}
Return