Feonixx Posted July 7, 2008 Share Posted July 7, 2008 expandcollapse popup; Script Start - Add your code below here #Include <GUIConstants.au3> #Include <Misc.au3> #include <EditConstants.au3> Global $nCont = 0, $xColor = 0x000000, $iRunning = False MsgBox(0,"ColorPicker/Chooser","Made By: Feonix") $main = GUICreate("Color Picker",150,50) $Button1 = GUICtrlCreateButton("Color Picker",25,15,100,20) $main2 = GUICreate("Color Picker",150,300) $Button2 = GUICtrlCreateButton("Back to Main",25,20,100,20) $Label1 = GUICtrlCreateLabel("",50,100,50,50) $Button3 = GUICtrlCreateButton("Choose your color",25,200,100,20) $hHex = GUICtrlCreateInput("", 25, 50, 100, -1, $ES_READONLY) $Button4 = GUICtrlCreateButton("Start- Move away from screen",1,250,150,20) WinSetOnTop($main2, "",1) GUISetState(@SW_SHOW, $main) While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 GUISetState(@SW_HIDE, $main) Sleep(100) GUISetState(@SW_SHOW, $main2) Case $msg = $Button2 GUISetState(@SW_HIDE, $main2) GUISetState(@SW_SHOW, $main) Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button3 Do If PixelGetColor(MouseGetPos(0), MouseGetPos(1)) <> $xColor Then $xColor = PixelGetColor(MouseGetPos(0), MouseGetPos(1)) GUICtrlSetBkColor($Label1, $xColor) GUICtrlSetBkColor($hHex, $xColor) GUICtrlSetData($hHex, "0x" & StringRight(Hex($xColor), 6)) EndIf Until _IsPressed(01) Case $msg = $Button4 $coord = PixelSearch(10, 10, 800, 580, $hHex) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndSelect WEnd Kk, so its doing all i want it to so far, it has a main window, opens into another, and finds a color (just load to see). Now, i want it to take the hex value in the input box and search for it, and then move to it and click. Thats where its messing up and not doing it, could these be a problem with the @ES_READONLY, or something else? Thanks for any help muttley Link to comment Share on other sites More sharing options...
Feonixx Posted July 7, 2008 Author Share Posted July 7, 2008 bump Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 7, 2008 Share Posted July 7, 2008 $hHex is only a controlID, you need to use GUICtrlRead($hHex) for reading the value from the input! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Feonixx Posted July 7, 2008 Author Share Posted July 7, 2008 (edited) $hHex is only a controlID, you need to use GUICtrlRead($hHex) for reading the value from the input! So set like $DataRead = GUICtrlRead($hHex) And then set that to the one its reading and the value to search for? EDIT: expandcollapse popup#Include <GUIConstants.au3> #Include <Misc.au3> #include <EditConstants.au3> Global $nCont = 0, $xColor = 0x000000, $iRunning = False MsgBox(0,"Main Window","Made By: Feonix") $main = GUICreate("Window",150,50) $Button1 = GUICtrlCreateButton("Open another window",25,15,100,20) $main2 = GUICreate("Window",150,300) $Button2 = GUICtrlCreateButton("Back to Main",25,20,100,20) $Label1 = GUICtrlCreateLabel("",50,100,50,50) $Button3 = GUICtrlCreateButton("Choose your color",25,200,100,20) $hHex = GUICtrlCreateInput("", 25, 50, 100, -1, $ES_READONLY) $Button4 = GUICtrlCreateButton("Start- Move away from screen",1,250,150,20) WinSetOnTop($main2, "Yay",1) GUISetState(@SW_SHOW, $main) $DataRead = GUICtrlRead($hHex) While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 GUISetState(@SW_HIDE, $main) Sleep(100) GUISetState(@SW_SHOW, $main2) Case $msg = $Button2 GUISetState(@SW_HIDE, $main2) GUISetState(@SW_SHOW, $main) Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button3 Do If PixelGetColor(MouseGetPos(0), MouseGetPos(1)) <> $xColor Then $xColor = PixelGetColor(MouseGetPos(0), MouseGetPos(1)) GUICtrlSetBkColor($Label1, $xColor) GUICtrlSetBkColor($hHex, $xColor) GUICtrlSetData($hHex, "0x" & StringRight(Hex($xColor), 6)) EndIf Until _IsPressed(01) Case $msg = $Button4 $coord = PixelSearch(10, 10, 800, 580, $DataRead) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndSelect WEnd Changed to this, and the mouse moves, but it doesnt move to the color, just to the corner of the screen Edited July 7, 2008 by Feonixx Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 8, 2008 Share Posted July 8, 2008 You are "reading" the value when the input doesn't have anything in it and therefore your code doesn't work as intended. For that to work you need to move your GUICtrlRead() to right after GUICtrlSetData() or directly in PixelSearch() I also just noticed your input was read-only so the easiest in this case would be to put $xColor in your PixelSearch() so you don't need any GUICtrlRead() For example: expandcollapse popup#Include <GUIConstantsEx.au3> #Include <Misc.au3> #include <EditConstants.au3> Global $nCont = 0, $xColor = 0x000000, $iRunning = False MsgBox(0,"Main Window","Made By: Feonix") $main = GUICreate("Window",150,50) $Button1 = GUICtrlCreateButton("Open another window",15,15,120,20) $main2 = GUICreate("Window",150,300) $Button2 = GUICtrlCreateButton("Back to Main",25,20,100,20) $Label1 = GUICtrlCreateLabel("",50,100,50,50) $Button3 = GUICtrlCreateButton("Choose your color",25,200,100,20) $hHex = GUICtrlCreateInput("", 25, 50, 100, -1, $ES_READONLY) $Button4 = GUICtrlCreateButton("Start- Move away from screen",1,250,150,20) WinSetOnTop($main2, "Yay",1) GUISetState(@SW_SHOW, $main) While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 GUISetState(@SW_HIDE, $main) Sleep(100) GUISetState(@SW_SHOW, $main2) Case $msg = $Button2 GUISetState(@SW_HIDE, $main2) GUISetState(@SW_SHOW, $main) Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button3 Do If PixelGetColor(MouseGetPos(0), MouseGetPos(1)) <> $xColor Then $xColor = PixelGetColor(MouseGetPos(0), MouseGetPos(1)) GUICtrlSetBkColor($Label1, $xColor) GUICtrlSetBkColor($hHex, $xColor) GUICtrlSetData($hHex, "0x" & StringRight(Hex($xColor), 6)) EndIf Until _IsPressed(01) Case $msg = $Button4 $coord = PixelSearch(10, 10, 800, 580, $xColor) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndSelect WEnd Do note that I also increased the width on $Button1 because I couldn't see all of the outmost letters and i changed #Include <GUIConstants.au3> to #Include <GUIConstantsEx.au3> Because I am using the newest stable AutoIt (3.2.12.1) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now