Tyrus Posted February 27 Share Posted February 27 Good day all, I've been trying to learn AutoIt for a while now, and I'm just struggling, when I click the button here nothing happens? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Create the main GUI window Global $hGUI = GUICreate("Color Clicker", 300, 150) ; Create a label for the hex color code text field GUICtrlCreateLabel("Enter a hex color code (e.g. FFFFFF):", 10, 10, 280, 20) ; Create a text field for the hex color code Global $hTextField = GUICtrlCreateInput("", 10, 30, 280, 20) ; Create a button to start the color clicker Local $hButton = GUICtrlCreateButton("Click Color", 10, 60, 80, 30) GUICtrlSetOnEvent(-1, "ButtonClick") ; Show the GUI window GUISetState(@SW_SHOW) ; GUI event loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Button click event handler Func ButtonClick() ; Get the hex color code from the text field Local $sHexCode = GUICtrlRead($hTextField) ; Convert the hex color code to a decimal color value Local $iColor = Hex($sHexCode, 6) ; Search the screen for pixels of the specified color and click them Local $aPos = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $iColor, 0, 1) While IsArray($aPos) MouseClick("left", $aPos, $aPos) Sleep(50) $aPos = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $iColor, 0, 1) WEnd EndFunc What am I doing wrong?? I appreciate any help, I'm just stuck! Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now