rendered paste body; lunchtimers scripting whee
; by pegasus, thanks to comicsans
AutoItSetOption ("MouseCoordMode", "0")
AutoItSetOption ("PixelCoordMode", "0")
HotKeySet("{ESC}", "getOut")
Func getOut()
MouseUp("left")
Exit(0)
EndFunc
$top = 196
$left = 254
$bottom = 738
$right = 1011
$height = 48
$width = 24
$white = 16
$px = 0
$py = 0
Dim $pattern[7][7] = [[1,0,0,1,1,1,1],[1,0,0,1,0,0,0],[1,0,0,1,0,0,0],[1,1,1,1,1,1,1],[0,0,0,1,0,0,1],[0,0,0,1,0,0,1],[1,1,1,1,0,0,1]]
Func nextPattern ()
If $px = UBound($pattern, 1) - 1 Then
$px = 0
If $py = UBound($pattern, 2) - 1 Then
$py = 0
Else
$py = $py + 1
EndIf
Else
$px = $px + 1
EndIf
Dim $ret[2] = [$px * $height + $top, $py * $height + $left]
Return $ret
EndFunc
Func coordsInShape ($x, $y)
For $myy = 0 to UBound($pattern, 2) - 1
For $myx = 0 to UBound($pattern, 1) - 1
If $pattern[$myx][$myy] == 1 And Abs($myx * $height + $left - $x) < $height and Abs($myy * $height + $top - $y) < $width Then Return True
Next
Next
Return False
EndFunc
Func clickable($x, $y)
$color = PixelGetColor($x, $y)
$r = BitShift($color, 16)
$g = BitAND(BitShift($color, 8), 255)
$b = BitAND($color, 255)
If 255 - $r > $white or 255 - $g > $white or 255 - $b > $white Then Return True
Return False
EndFunc
WinActivate("Lunchtimers")
WinWaitActive("Lunchtimers")
While True
For $y = $top to $bottom
For $x = $left to $right
If clickable($x, $y) And Not coordsInShape($x, $y) Then
MouseMove($x, $y, 1)
MouseDown("left")
Do
nextPattern()
Until $pattern[$px][$py] == 1
MouseMove($px * $height + $left + 1, $py * $height + $top + 1, 1)
MouseUp("left")
MouseDown("left")
MouseUp("left")
EndIf
Next
Next
WEnd
MouseUp("left")