-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.ahk
More file actions
72 lines (52 loc) · 1.56 KB
/
test2.ahk
File metadata and controls
72 lines (52 loc) · 1.56 KB
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
^Esc::ExitApp ; Press Ctrl + Esc to exit the script
^j:: ; Ctrl + J hotkey
; Save the image on your device and update the imagePath
ClickImage(ByRef x := "", ByRef y := "", imagePath := "C:\Users\hrida\Pictures\Screenshots\Screenshot 2024-06-29 193113.png"){
if (imagePath = "") {
imagePath := "C:\Users\hrida\Pictures\Screenshots\Screenshot 2024-06-29 185124.png"
}
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %imagePath%
if (ErrorLevel = 0) ; Image found
{
x := FoundX
y := FoundY
FoundX+=7
FoundY+=4
Click, %FoundX%, %FoundY%
Sleep, 300
FoundY-=60
Click, %FoundX%, %FoundY%
Sleep, 300
Click, %FoundX%, %FoundY%
Sleep, 300
FoundY+=60
Click, %FoundX%, %FoundY%
Sleep, 300
FoundY-= 60
Click, %FoundX%, %FoundY%
Sleep, 300
; pixel menu
FoundY-= 60
Click, %FoundX%, %FoundY%
Sleep, 300
; pixel menu
FoundY-= 40
Click, %FoundX%, %FoundY%
Sleep, 300
FoundX-= 380
Click, %FoundX%, %FoundY% ; Adjust offsets as needed
Sleep, 300
Click, %FoundX%, %FoundY%
return true
}
else {
MsgBox, % "Image not found: " imagePath " `n Errorlevel: " errorLevel
return false
}
}
; Locate and click the settings button
; Usage example:
if (!ClickImage(FoundX, FoundY))
return