Thanks, this is a full code:
Code: Select all
#Requires AutoHotkey v2.0
hWnd1 := 0
hWnd2 := 0
CoordMode "Pixel", "Window"
hs := DateAdd(A_Now, 5, "seconds")
1::WinActivate hWnd1 ; as an example, this activates the window using the id saved to hwin1
2::WinActivate hWnd2 ; as an example, this activates the window using the id saved to hwin1
3::hWnd1 := WinGetID("A")
4::hWnd2 := WinGetID("A")
0::ExitApp
9::
{
Loop
{
state := GetKeyState("CapsLock", "T")
if (state = "1")
{
Break
}
if PixelSearch(&Px, &Py, 698, 350, 771, 420, 0xDC2121, 3) {
Sleep 1000
while PixelSearch(&Px, &Py, 698, 350, 771, 420, 0xDC2121, 3) {
SoundPlay "s.wav"
Sleep 4000
}
}
if PixelSearch(&Px, &Py, 55, 88, 55, 88, 0xD6DEDE, 3) {
SoundPlay "i.wav"
Sleep 4000
Break
}
While PixelSearch(&Px, &Py, 62, 101, 62, 101, 0xBDC6CE, 3) {
SoundPlay "p.wav"
Sleep 10000
}
ha := A_Now
if (ha > hs) {
MsgBox "usar skill"
hs := DateAdd(A_Now, 5, "seconds")
}
}
}
The error:
Error: This variable has not been assigned a value.
Specifically: local hs (same name as a global)
047: }
048: ha := A_Now
▶ 049: If (ha > hs)
049: {
050: MsgBox("usar skill")
[Mod edit: Replaced quote tags with code tags. Please use them yourself when posting code.]