Created
August 6, 2011 05:59
-
-
Save kirb/1129058 to your computer and use it in GitHub Desktop.
Mineclicker: Minesweeper auto-clicker for Windows XP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cs ------------------------------ | |
# Mineclicker | |
# | |
# Written by Ad@m | |
# http://adamscode.sourceforge.net | |
# | |
# Licensed under Creative Commons BY-ND | |
# http://creativecommons.org/licenses/by-nd/3.0 | |
#ce ------------------------------ | |
#Region Initialization | |
$mcVersion = "2.0" | |
#include <ButtonConstants.au3> | |
#include <EditConstants.au3> | |
#include <GUIConstantsEx.au3> | |
#include <StaticConstants.au3> | |
#include <WindowsConstants.au3> | |
Opt("MouseClickDelay", 0) | |
Opt("MouseClickDownDelay", 0) | |
Run("winmine") | |
WinWaitActive("Minesweeper") | |
Send("xyzzy") | |
Send("+{ENTER}") | |
#EndRegion | |
Func _Mineclicker($t, $u) | |
GUISetState(@SW_HIDE) | |
$r = $t - 1 | |
$s = $u - 1 | |
WinMove("Minesweeper", "", 0, 0, Default, Default, 3) | |
$x = 16 | |
$y = 104 | |
$c = 0 | |
For $i = 0 To $s | |
For $j = 0 To $r | |
WinWaitActive("Minesweeper") | |
If Not WinExists("Minesweeper") Then | |
Exit 2 | |
EndIf | |
MouseMove($x, $y, 1) | |
If String(Hex(PixelGetColor(0, 0))) = "00FFFFFF" Then | |
MouseClick("left", Default, Default, 1, 0) | |
EndIf | |
$x = $x + 16 | |
Next | |
$x = 16 | |
$y = $y + 16 | |
Next | |
Exit 0 | |
EndFunc | |
#Region Main | |
$f = WinGetClientSize("Minesweeper") | |
Switch $f[0] | |
Case 170 | |
$e = 9 | |
Case 282 | |
$e = 16 | |
Case 506 | |
$e = 30 | |
Case Else | |
$e = "" | |
EndSwitch | |
$FormMain = GUICreate("Mineclicker by Ad@m", 255, 123, 16, 16) | |
$RowsInput = GUICtrlCreateInput($e, 4, 60, 245, 21) | |
$ButtonAbout = GUICtrlCreateButton("&About", 5, 92, 75, 25, 0) | |
$ButtonOk = GUICtrlCreateButton("&OK", 94, 92, 75, 25, 0) | |
$ButtonCancel = GUICtrlCreateButton("&Cancel", 175, 92, 75, 25, 0) | |
$EnterRowsLabel = GUICtrlCreateLabel("Enter the number of rows of mines in Minesweeper:", 4, 8, 244, 17) | |
$RowsInfoLabel = GUICtrlCreateLabel("9 = Beginner, 16 = Intermediate, 30 = Expert", 4, 30, 244, 21) | |
GUISetState(@SW_SHOW) | |
While 1 | |
Switch GUIGetMsg() | |
Case $GUI_EVENT_CLOSE | |
ExitLoop | |
Case $ButtonCancel | |
ExitLoop | |
Case $ButtonAbout | |
MsgBox(64, "Mineclicker", "Mineclicker " & @CRLF & "Version " & $mcVersion & @CRLF & @CRLF & "Written by Ad@m" & @CRLF & _ | |
"http://adamscode.sourceforge.net" & @CRLF & @CRLF & "Licensed under Creative Commons BY-ND" & @CRLF & _ | |
"http://creativecommons.org/licenses/by-nd/3.0") | |
Case $ButtonOk | |
$t = GUICtrlRead($RowsInput) | |
If @error Or $t = "" Then | |
MsgBox(48, "Mineclicker", "Either the text box was empty or an error occurred. Click OK to exit.") | |
ExitLoop | |
EndIf | |
If $t = 30 Then | |
_Mineclicker($t, 16) | |
Else | |
_Mineclicker($t, $t) | |
EndIf | |
EndSwitch | |
WEnd | |
Exit 1 | |
#EndRegion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment