Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstantsEx.au3>
- #include <ButtonConstants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- Opt("GUIOnEventMode", 1)
- Global $SautoClickerWindow, $Btn_Start, $Btn_Stop, $Label_Speed, $Input_Speed
- Global $mainWindow, $optionCheckbox[8], $isRunning = False, $monitoringActive = False, $autoClickerActive = False
- Global $autoClickerDelay = 1000 ; Default delay for autoclicker (milliseconds)
- Global Const $monitoringAreaLeft = 520, $monitoringAreaTop = 460, $monitoringAreaRight = 760, $monitoringAreaBottom = 500
- HotKeySet("{F1}", "ToggleClicker")
- $SautoClickerWindow = GUICreate("AutoClicker Settings", 200, 120, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CAPTION))
- GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicker")
- $Btn_Start = GUICtrlCreateButton("Start", 30, 80, 60, 30)
- GUICtrlSetOnEvent($Btn_Start, "StartClicker")
- $Btn_Stop = GUICtrlCreateButton("Stop", 110, 80, 60, 30)
- GUICtrlSetOnEvent($Btn_Stop, "StopClicker")
- $Label_Speed = GUICtrlCreateLabel("Click Speed (ms):", 20, 20, 90, 20)
- $Input_Speed = GUICtrlCreateInput("500", 120, 18, 50, 20)
- GUISetState(@SW_SHOW, $SautoClickerWindow)
- While 1
- Sleep(100)
- WEnd
- Func StartClicker()
- Local $speed = GUICtrlRead($Input_Speed)
- MsgBox(0, "Starting Clicker", "Clicker started with speed: " & $speed & "ms")
- ; Implement your clicker logic here
- EndFunc
- Func StopClicker()
- MsgBox(0, "Stopping Clicker", "Clicker stopped")
- ; Implement your clicker stop logic here
- EndFunc
- Func CloseClicker()
- Exit
- EndFunc
- Func ToggleClicker()
- ; Implement your toggle logic here
- EndFunc
- $mainWindow = GUICreate("AutoIt Automation", 300, 330)
- $optionCheckbox[0] = GUICtrlCreateCheckbox("Clicking", 10, 10, 100, 20)
- $optionCheckbox[1] = GUICtrlCreateCheckbox("Skills", 10, 40, 100, 20)
- $optionCheckbox[2] = GUICtrlCreateCheckbox("Auto Heal", 10, 70, 100, 20)
- $optionCheckbox[3] = GUICtrlCreateCheckbox("Target Closest", 10, 100, 120, 20)
- $optionCheckbox[4] = GUICtrlCreateCheckbox("Pickup Items", 10, 130, 100, 20)
- $optionCheckbox[5] = GUICtrlCreateCheckbox("Digging", 10, 160, 100, 20)
- $optionCheckbox[6] = GUICtrlCreateCheckbox("Monitor", 10, 190, 100, 20)
- $optionCheckbox[7] = GUICtrlCreateCheckbox("AutoClicker", 10, 220, 100, 20)
- $btnStartStop = GUICtrlCreateButton("Start/Stop", 10, 270, 100, 30)
- $btnExit = GUICtrlCreateButton("Exit", 230, 270, 60, 30)
- ; GUI for autoclicker settings
- $autoClickerWindow = GUICreate("AutoClicker Settings", 200, 120, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CAPTION))
- GUICtrlCreateLabel("Delay (ms):", 10, 10, 100, 20)
- $inpDelay = GUICtrlCreateInput("1000", 110, 10, 60, 20)
- $btnAutoClickerStartStop = GUICtrlCreateButton("Start", 10, 50, 80, 30)
- $btnAutoClickerExit = GUICtrlCreateButton("Exit", 110, 50, 80, 30)
- GUISetState(@SW_HIDE, $autoClickerWindow)
- HotKeySet("{End}", "PanicButton") ; Set the "end" key as the panic button
- GUISetState(@SW_SHOW, $mainWindow)
- While 1
- $msg = GUIGetMsg()
- Switch $msg
- Case $GUI_EVENT_CLOSE, $btnExit, $btnAutoClickerExit
- Exit
- Case $btnStartStop
- If Not _IsChecked($optionCheckbox) Then
- MsgBox(48, "Error", "Please select at least one option.")
- Else
- $isRunning = Not $isRunning
- If $isRunning Then
- GUICtrlSetData($btnStartStop, "Stop")
- StartAutomation()
- Else
- MsgBox(64, "Stop", "Stopping automation.")
- ; Add logic to stop automation tasks
- GUICtrlSetData($btnStartStop, "Start")
- EndIf
- EndIf
- Case $optionCheckbox[7] ; Autoclicker checkbox
- If GUICtrlRead($optionCheckbox[7]) = $GUI_CHECKED Then
- GUISetState(@SW_SHOW, $autoClickerWindow)
- Else
- GUISetState(@SW_HIDE, $autoClickerWindow)
- $autoClickerActive = False
- EndIf
- Case $btnAutoClickerStartStop
- If GUICtrlRead($btnAutoClickerStartStop) = "Start" Then
- GUICtrlSetData($btnAutoClickerStartStop, "Stop")
- $autoClickerActive = True
- $autoClickerDelay = GUICtrlRead($inpDelay)
- StartAutoClicker()
- Else
- GUICtrlSetData($btnAutoClickerStartStop, "Start")
- $autoClickerActive = False
- EndIf
- EndSwitch
- WEnd
- Func _IsChecked($checkboxArray)
- For $i = 0 To UBound($checkboxArray) - 1
- If GUICtrlRead($checkboxArray[$i]) = $GUI_CHECKED Then Return True
- Next
- Return False
- EndFunc
- Func StartAutomation()
- Local $appWindow, $coords, $result, $tolerance = 10 ; Define tolerance here
- $appWindow = WinGetHandle("AsdaGlobal")
- If $appWindow = 0 Then
- MsgBox(16, "Error", "Failed to find the target application window.")
- Return
- EndIf
- ; Activate the application window
- WinActivate($appWindow)
- ; Start monitoring if the monitoring checkbox is checked
- If GUICtrlRead($optionCheckbox[6]) = $GUI_CHECKED Then
- $monitoringActive = True
- StartMonitoring()
- EndIf
- While $isRunning
- ; Add your automation logic here
- If GUICtrlRead($optionCheckbox[0]) = $GUI_CHECKED Then
- ; Clicking option selected
- $coords = PixelSearch(1110, 642, 360, 110, 0x6A140A, 40)
- If Not @error Then
- MouseClick("left", $coords[0], $coords[1], 2, 1)
- Sleep(700)
- EndIf
- EndIf
- If GUICtrlRead($optionCheckbox[3]) = $GUI_CHECKED Then
- ; Target Closest option selected
- Send("{TAB 5}") ; Presses the Tab key 5 times.
- Sleep(100)
- EndIf
- If GUICtrlRead($optionCheckbox[4]) = $GUI_CHECKED Then
- ; Pickup Items option selected
- For $i = 1 To Random(1, 15) ; Send "2" a random number of times between 1 and 15
- Send("2")
- Sleep(Random(100, 300)) ; Add a random sleep after each keypress
- Next
- EndIf
- If GUICtrlRead($optionCheckbox[5]) = $GUI_CHECKED Then
- ; Digging option selected
- Send("1")
- Sleep(7000) ; Wait 7 seconds
- Send("2")
- Sleep(200)
- Send("1")
- Sleep(200)
- Send("2")
- EndIf
- Sleep(100) ; Add a delay between iterations to prevent excessive CPU usage
- WEnd
- EndFunc
- Func StartMonitoring()
- While $monitoringActive
- ; Check for the appearance of the box with options in the specified area
- If PixelSearchBox($monitoringAreaLeft, $monitoringAreaTop, $monitoringAreaRight, $monitoringAreaBottom) Then
- ; Found the box, double left-click to select the reddish orange option
- MouseClick("left", $coords[0], $coords[1], 2, 0)
- Sleep(100)
- MouseClick("left", $coords[0], $coords[1], 2, 0)
- Sleep(100)
- Send("{ENTER}")
- Sleep(500)
- Send("Sorry I'm busy atm 2 minutes", 35) ; Type the message with a delay of 35ms between each keystroke
- Sleep(100) ; Wait 100ms before pressing enter again
- Send("{ENTER}")
- EndIf
- Sleep(1000)
- WEnd
- EndFunc
- Func PixelSearchBox($left, $top, $right, $bottom)
- ; Adjust the search area to the specified coordinates
- Local $boxCoords = PixelSearch($left, $top, $right, $bottom, 0xFFFFFF, 10)
- If Not @error Then
- ; Found the box, return true
- $coords = $boxCoords
- Return True
- EndIf
- ; Box not found
- Return False
- EndFunc
- Func PanicButton()
- ; Add the logic for the panic button action here
- Exit
- EndFunc
- Func StartAutoClicker()
- While $autoClickerActive
- MouseClick("left") ; Perform a left click
- Sleep($autoClickerDelay) ; Delay between clicks
- WEnd
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement