Advertisement
ZxkH

Iteration #14.1

Feb 7th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.25 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <StaticConstants.au3>
  5. #include <WindowsConstants.au3>
  6.  
  7. Opt("GUIOnEventMode", 1)
  8.  
  9. Global $SMainWindow, $SautoClickerWindow, $Btn_ToggleAutoClicker, $Btn_Start, $Btn_Stop, $Btn_Exit, $Label_Speed, $Input_Speed
  10.  
  11. $SMainWindow = GUICreate("Main Window", 300, 200)
  12. GUISetOnEvent($GUI_EVENT_CLOSE, "CloseMainWindow")
  13.  
  14. $Checkbox1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 20, 100, 20)
  15. $Checkbox2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50, 100, 20)
  16. $Checkbox3 = GUICtrlCreateCheckbox("Checkbox 3", 20, 80, 100, 20)
  17.  
  18. $Btn_Start = GUICtrlCreateButton("Start", 20, 120, 60, 30)
  19. GUICtrlSetOnEvent($Btn_Start, "StartClicker")
  20.  
  21. $Btn_ToggleAutoClicker = GUICtrlCreateButton("Toggle AutoClicker", 90, 120, 120, 30)
  22. GUICtrlSetOnEvent($Btn_ToggleAutoClicker, "ToggleAutoClicker")
  23.  
  24. $Btn_Stop = GUICtrlCreateButton("Stop", 220, 120, 60, 30)
  25. GUICtrlSetOnEvent($Btn_Stop, "StopClicker")
  26.  
  27. $Btn_Exit = GUICtrlCreateButton("Exit", 160, 160, 60, 30)
  28. GUICtrlSetOnEvent($Btn_Exit, "CloseMainWindow")
  29.  
  30. GUISetState(@SW_SHOW, $SMainWindow)
  31.  
  32. While 1
  33. Sleep(100)
  34. WEnd
  35.  
  36. Func ToggleAutoClicker()
  37. If Not IsDeclared("SautoClickerWindow") Then
  38. $SautoClickerWindow = GUICreate("AutoClicker Settings", 200, 120, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CAPTION))
  39.  
  40. $Btn_Start = GUICtrlCreateButton("Start", 30, 80, 60, 30)
  41. GUICtrlSetOnEvent($Btn_Start, "StartClicker")
  42.  
  43. $Btn_Stop = GUICtrlCreateButton("Stop", 110, 80, 60, 30)
  44. GUICtrlSetOnEvent($Btn_Stop, "StopClicker")
  45.  
  46. $Label_Speed = GUICtrlCreateLabel("Click Speed (ms):", 20, 20, 90, 20)
  47. $Input_Speed = GUICtrlCreateInput("500", 120, 18, 50, 20)
  48.  
  49. GUISetState(@SW_SHOW, $SautoClickerWindow)
  50. Else
  51. GUIDelete($SautoClickerWindow)
  52. UnsetVariable("SautoClickerWindow")
  53. EndIf
  54. EndFunc
  55.  
  56. Func StartClicker()
  57. Local $speed = GUICtrlRead($Input_Speed)
  58. MsgBox(0, "Starting Clicker", "Clicker started with speed: " & $speed & "ms")
  59. ; Implement your clicker logic here
  60. EndFunc
  61.  
  62. Func StopClicker()
  63. MsgBox(0, "Stopping Clicker", "Clicker stopped")
  64. ; Implement your clicker stop logic here
  65. EndFunc
  66.  
  67. Func CloseMainWindow()
  68. Exit
  69. EndFunc
  70.  
  71. #include <GUIConstantsEx.au3>
  72. #include <ButtonConstants.au3>
  73. #include <EditConstants.au3>
  74. #include <GUIConstantsEx.au3>
  75. #include <StaticConstants.au3>
  76. #include <WindowsConstants.au3>
  77.  
  78. Opt("GUIOnEventMode", 1)
  79.  
  80. Global $SautoClickerWindow, $Btn_Start, $Btn_Stop, $Label_Speed, $Input_Speed
  81. Global $mainWindow, $optionCheckbox[8], $isRunning = False, $monitoringActive = False, $autoClickerActive = False
  82. Global $autoClickerDelay = 1000 ; Default delay for autoclicker (milliseconds)
  83. Global Const $monitoringAreaLeft = 520, $monitoringAreaTop = 460, $monitoringAreaRight = 760, $monitoringAreaBottom = 500
  84.  
  85. HotKeySet("{F1}", "ToggleClicker")
  86.  
  87. $SautoClickerWindow = GUICreate("AutoClicker Settings", 200, 120, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CAPTION))
  88. GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicker")
  89.  
  90. $Btn_Start = GUICtrlCreateButton("Start", 30, 80, 60, 30)
  91. GUICtrlSetOnEvent($Btn_Start, "StartClicker")
  92.  
  93. $Btn_Stop = GUICtrlCreateButton("Stop", 110, 80, 60, 30)
  94. GUICtrlSetOnEvent($Btn_Stop, "StopClicker")
  95.  
  96. $Label_Speed = GUICtrlCreateLabel("Click Speed (ms):", 20, 20, 90, 20)
  97. $Input_Speed = GUICtrlCreateInput("500", 120, 18, 50, 20)
  98.  
  99. GUISetState(@SW_SHOW, $SautoClickerWindow)
  100.  
  101. While 1
  102. Sleep(100)
  103. WEnd
  104.  
  105. Func StartClicker()
  106. Local $speed = GUICtrlRead($Input_Speed)
  107. MsgBox(0, "Starting Clicker", "Clicker started with speed: " & $speed & "ms")
  108. ; Implement your clicker logic here
  109. EndFunc
  110.  
  111. Func StopClicker()
  112. MsgBox(0, "Stopping Clicker", "Clicker stopped")
  113. ; Implement your clicker stop logic here
  114. EndFunc
  115.  
  116. Func CloseClicker()
  117. Exit
  118. EndFunc
  119.  
  120. Func ToggleClicker()
  121. ; Implement your toggle logic here
  122. EndFunc
  123.  
  124. $mainWindow = GUICreate("AutoIt Automation", 300, 330)
  125. $optionCheckbox[0] = GUICtrlCreateCheckbox("Clicking", 10, 10, 100, 20)
  126. $optionCheckbox[1] = GUICtrlCreateCheckbox("Skills", 10, 40, 100, 20)
  127. $optionCheckbox[2] = GUICtrlCreateCheckbox("Auto Heal", 10, 70, 100, 20)
  128. $optionCheckbox[3] = GUICtrlCreateCheckbox("Target Closest", 10, 100, 120, 20)
  129. $optionCheckbox[4] = GUICtrlCreateCheckbox("Pickup Items", 10, 130, 100, 20)
  130. $optionCheckbox[5] = GUICtrlCreateCheckbox("Digging", 10, 160, 100, 20)
  131. $optionCheckbox[6] = GUICtrlCreateCheckbox("Monitor", 10, 190, 100, 20)
  132. $optionCheckbox[7] = GUICtrlCreateCheckbox("AutoClicker", 10, 220, 100, 20)
  133. $btnStartStop = GUICtrlCreateButton("Start/Stop", 10, 270, 100, 30)
  134. $btnExit = GUICtrlCreateButton("Exit", 230, 270, 60, 30)
  135.  
  136. ; GUI for autoclicker settings
  137. $autoClickerWindow = GUICreate("AutoClicker Settings", 200, 120, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CAPTION))
  138. GUICtrlCreateLabel("Delay (ms):", 10, 10, 100, 20)
  139. $inpDelay = GUICtrlCreateInput("1000", 110, 10, 60, 20)
  140. $btnAutoClickerStartStop = GUICtrlCreateButton("Start", 10, 50, 80, 30)
  141. $btnAutoClickerExit = GUICtrlCreateButton("Exit", 110, 50, 80, 30)
  142. GUISetState(@SW_HIDE, $autoClickerWindow)
  143.  
  144. HotKeySet("{End}", "PanicButton") ; Set the "end" key as the panic button
  145.  
  146. GUISetState(@SW_SHOW, $mainWindow)
  147.  
  148. While 1
  149. $msg = GUIGetMsg()
  150. Switch $msg
  151. Case $GUI_EVENT_CLOSE, $btnExit, $btnAutoClickerExit
  152. Exit
  153. Case $btnStartStop
  154. If Not _IsChecked($optionCheckbox) Then
  155. MsgBox(48, "Error", "Please select at least one option.")
  156. Else
  157. $isRunning = Not $isRunning
  158. If $isRunning Then
  159. GUICtrlSetData($btnStartStop, "Stop")
  160. StartAutomation()
  161. Else
  162. MsgBox(64, "Stop", "Stopping automation.")
  163. ; Add logic to stop automation tasks
  164. GUICtrlSetData($btnStartStop, "Start")
  165. EndIf
  166. EndIf
  167. Case $optionCheckbox[7] ; Autoclicker checkbox
  168. If GUICtrlRead($optionCheckbox[7]) = $GUI_CHECKED Then
  169. GUISetState(@SW_SHOW, $autoClickerWindow)
  170. Else
  171. GUISetState(@SW_HIDE, $autoClickerWindow)
  172. $autoClickerActive = False
  173. EndIf
  174. Case $btnAutoClickerStartStop
  175. If GUICtrlRead($btnAutoClickerStartStop) = "Start" Then
  176. GUICtrlSetData($btnAutoClickerStartStop, "Stop")
  177. $autoClickerActive = True
  178. $autoClickerDelay = GUICtrlRead($inpDelay)
  179. StartAutoClicker()
  180. Else
  181. GUICtrlSetData($btnAutoClickerStartStop, "Start")
  182. $autoClickerActive = False
  183. EndIf
  184. EndSwitch
  185. WEnd
  186.  
  187. Func _IsChecked($checkboxArray)
  188. For $i = 0 To UBound($checkboxArray) - 1
  189. If GUICtrlRead($checkboxArray[$i]) = $GUI_CHECKED Then Return True
  190. Next
  191. Return False
  192. EndFunc
  193.  
  194. Func StartAutomation()
  195. Local $appWindow, $coords, $result, $tolerance = 10 ; Define tolerance here
  196.  
  197. $appWindow = WinGetHandle("AsdaGlobal")
  198. If $appWindow = 0 Then
  199. MsgBox(16, "Error", "Failed to find the target application window.")
  200. Return
  201. EndIf
  202.  
  203. ; Activate the application window
  204. WinActivate($appWindow)
  205.  
  206. ; Start monitoring if the monitoring checkbox is checked
  207. If GUICtrlRead($optionCheckbox[6]) = $GUI_CHECKED Then
  208. $monitoringActive = True
  209. StartMonitoring()
  210. EndIf
  211.  
  212. While $isRunning
  213. ; Add your automation logic here
  214.  
  215. If GUICtrlRead($optionCheckbox[0]) = $GUI_CHECKED Then
  216. ; Clicking option selected
  217. $coords = PixelSearch(1110, 642, 360, 110, 0x6A140A, 40)
  218. If Not @error Then
  219. MouseClick("left", $coords[0], $coords[1], 2, 1)
  220. Sleep(700)
  221. EndIf
  222. EndIf
  223.  
  224. If GUICtrlRead($optionCheckbox[3]) = $GUI_CHECKED Then
  225. ; Target Closest option selected
  226. Send("{TAB 5}") ; Presses the Tab key 5 times.
  227. Sleep(100)
  228. EndIf
  229.  
  230. If GUICtrlRead($optionCheckbox[4]) = $GUI_CHECKED Then
  231. ; Pickup Items option selected
  232. For $i = 1 To Random(1, 15) ; Send "2" a random number of times between 1 and 15
  233. Send("2")
  234. Sleep(Random(100, 300)) ; Add a random sleep after each keypress
  235. Next
  236. EndIf
  237.  
  238. If GUICtrlRead($optionCheckbox[5]) = $GUI_CHECKED Then
  239. ; Digging option selected
  240. Send("1")
  241. Sleep(7000) ; Wait 7 seconds
  242. Send("2")
  243. Sleep(200)
  244. Send("1")
  245. Sleep(200)
  246. Send("2")
  247. EndIf
  248.  
  249. Sleep(100) ; Add a delay between iterations to prevent excessive CPU usage
  250. WEnd
  251. EndFunc
  252.  
  253. Func StartMonitoring()
  254. While $monitoringActive
  255. ; Check for the appearance of the box with options in the specified area
  256. If PixelSearchBox($monitoringAreaLeft, $monitoringAreaTop, $monitoringAreaRight, $monitoringAreaBottom) Then
  257. ; Found the box, double left-click to select the reddish orange option
  258. MouseClick("left", $coords[0], $coords[1], 2, 0)
  259. Sleep(100)
  260. MouseClick("left", $coords[0], $coords[1], 2, 0)
  261. Sleep(100)
  262. Send("{ENTER}")
  263. Sleep(500)
  264. Send("Sorry I'm busy atm 2 minutes", 35) ; Type the message with a delay of 35ms between each keystroke
  265. Sleep(100) ; Wait 100ms before pressing enter again
  266. Send("{ENTER}")
  267. EndIf
  268. Sleep(1000)
  269. WEnd
  270. EndFunc
  271.  
  272. Func PixelSearchBox($left, $top, $right, $bottom)
  273. ; Adjust the search area to the specified coordinates
  274. Local $boxCoords = PixelSearch($left, $top, $right, $bottom, 0xFFFFFF, 10)
  275. If Not @error Then
  276. ; Found the box, return true
  277. $coords = $boxCoords
  278. Return True
  279. EndIf
  280. ; Box not found
  281. Return False
  282. EndFunc
  283.  
  284. Func PanicButton()
  285. ; Add the logic for the panic button action here
  286. Exit
  287. EndFunc
  288.  
  289. Func StartAutoClicker()
  290. While $autoClickerActive
  291. MouseClick("left") ; Perform a left click
  292. Sleep($autoClickerDelay) ; Delay between clicks
  293. WEnd
  294. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement