https://www.autoitscript.com/site/autoit/downloads/
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: log163
Script Function:
Use a specific powder a specific number of times on an egg
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <UpDownConstants.au3>
Opt("GUIOnEventMode", 1)
global const $xArray[3] = [393, 440, 490]; the screen x coordinates for the first,second,and third row on powder pane
global const $xbutton = 442; the screen x coordinates for the confirm button on the powder pane
global const $yArray[3] = [330, 374, 416]; the screen y coordinates for the first,second,and third column on powder pane
global const $ybutton = 447; the screen y coordinates for the confirm button on the powder pane
global const $DragonTitle = "Dragon"; the start of the title for the Dragon's Prohpet window
global const $mouseSpeed = 5
global $repeats = 1
global $powder = 1
_Main()
Func _Main()
;Initialize variables
Local const $iGUIWidth = 300, $iGUIHeight = 100
global const $windowTitle = "Egg Powderizer"
Local $idOK_Btn, $idCancel_Btn
Local $idRepeat, $idPowder
;Create window
GUICreate($windowTitle, $iGUIWidth, $iGUIHeight)
;Create an edit box with no text in it
GUICtrlCreateLabel("Number of Repeats", 10, 10)
$idRepeat = GUICtrlCreateInput("1", 120, 10, 50, 20)
GUICtrlCreateUpdown($idRepeat)
GUICtrlSetOnEvent($idRepeat, "OnUpDown")
;GUICtrlSetLimit($idRepeat,0,2)
GUICtrlCreateLabel("Powder Slot", 10, 40)
$idPowder = GUICtrlCreateInput("1", 120, 40, 50, 20)
GUICtrlCreateUpdown($idPowder)
GUICtrlSetOnEvent($idPowder, "OnUpDown2")
;GUICtrlSetLimit($idPowder,1,0)
;Create an "OK" button
$idOK_Btn = GUICtrlCreateButton("Run", 75, 70, 70, 25)
GUICtrlSetOnEvent($idOK_Btn, "OnYes")
;Create a "CANCEL" button
$idCancel_Btn = GUICtrlCreateButton("Cancel", 165, 70, 70, 25)
GUICtrlSetOnEvent($idCancel_Btn, "OnExit")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")
;Show window/Make the window visible
GUISetState(@SW_SHOW)
While 1
Sleep(10000)
WEnd
EndFunc ;==>_Main
; --------------- Functions ---------------
Func OnExit()
Exit
EndFunc ;==>OnExit
Func OnUpDown()
$repeats = GUICtrlRead (@GUI_CtrlId)
EndFunc ;==>OnUpDown
Func OnUpDown2()
$powder = GUICtrlRead (@GUI_CtrlId)
EndFunc ;==>OnUpDown2
Func OnYes()
local $i = 0
local $x = 0
local $y = 0
Switch $powder
Case 1
$x = $xArray[0]
$y = $yArray[0]
Case 2
$x = $xArray[1]
$y = $yArray[0]
Case 3
$x = $xArray[2]
$y = $yArray[0]
Case 4
$x = $xArray[0]
$y = $yArray[1]
Case 5
$x = $xArray[1]
$y = $yArray[1]
Case 6
$x = $xArray[2]
$y = $yArray[1]
Case 7
$x = $xArray[0]
$y = $yArray[2]
Case 8
$x = $xArray[1]
$y = $yArray[2]
Case 9
$x = $xArray[2]
$y = $yArray[2]
Case Else
;$sMsg = "Error"
Return
EndSwitch
If WinExists($DragonTitle) Then
WinActivate($DragonTitle)
;WinWaitActive("Dragon")
WinSetState($DragonTitle, "", @SW_MAXIMIZE)
For $i = 1 To $repeats
MouseClick($MOUSE_CLICK_PRIMARY, $x, $y, 1, $mouseSpeed)
Sleep(100)
MouseClick($MOUSE_CLICK_PRIMARY, $xbutton, $ybutton, 1, $mouseSpeed)
Sleep(100)
Next
EndIf
EndFunc ;==>OnYes