|
#include <Constants.au3> |
|
#include <GUIConstantsEx.au3> |
|
#include <WindowsConstants.au3> |
|
|
|
$count = 125 |
|
$label = 0 |
|
$button = 0 |
|
|
|
Func _WriteErrorLog($ErrorMessage) |
|
FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @HOUR & ":" & @MIN & ":" & @SEC & ": " & $ErrorMessage) |
|
EndFunc ;==>WriteErrorLog |
|
|
|
Func CheckGUI() |
|
$msg = GUIGetMsg() |
|
|
|
Select |
|
Case $msg = $GUI_EVENT_CLOSE Or $msg = $button |
|
Exit |
|
EndSelect |
|
EndFunc |
|
|
|
Func Setup($title) |
|
; Create a GUI with various controls. |
|
$gui = GUICreate($title, 300, 200) |
|
|
|
$label = GUICtrlCreateLabel("Performing action 1/" & $count, 10, 10, 300) |
|
|
|
; Create a button control. |
|
$button = GUICtrlCreateButton("Cancel", 85, 85, 130, 30) |
|
|
|
; Display the GUI. |
|
GUISetState(@SW_SHOW, $gui) |
|
|
|
; Register the CheckGUI function to be called every 100 milliseconds. |
|
AdlibRegister("CheckGUI", 100) |
|
|
|
Opt("SendKeyDownDelay", 20) |
|
EndFunc |
|
|
|
Func UpdateStatus($text) |
|
GUICtrlSetData($label, $text) |
|
EndFunc |
|
|
|
Func SendKey($key, $presses = 1, $delay = 200) |
|
For $i = 1 to $presses |
|
Send($key) |
|
Sleep($delay) |
|
Next |
|
EndFunc |
|
|
|
Func SelectSpell($col, $row, $delay = 200) |
|
; select magic |
|
SendKey("{DOWN}", 1, $delay) |
|
SendKey("z", 1, $delay) |
|
|
|
; move to magic column |
|
SendKey("{RIGHT}", $col, $delay) |
|
|
|
; move to magic row |
|
SendKey("{DOWN}", $row, $delay) |
|
|
|
; select spell |
|
SendKey("z", 2, $delay) |
|
EndFunc |
|
|
|
Func Clear($delay = 200) |
|
; next player |
|
SendKey("s", 4, $delay) |
|
EndFunc |
|
|
|
Func Close() |
|
; Unregister the CheckGUI function before exiting. |
|
AdlibUnRegister("CheckGUI") |
|
EndFunc |