twisted Posted September 29, 2008 Share Posted September 29, 2008 Hi, just started off using AutoIt and I'm not very good. Been trying to get this working for some time. It's kind of bare right now because the GUI is there for now just to let me know that the script is running. I'm trying to get it working before I "beautify" the whole thing. expandcollapse popup$aLoop = 0 $bLoop = 1 Dim $set, $posx, $posy, $rainbow HotKeySet("{ESC}", "Terminate") HotKeySet("{HOME}", "SetColor") HotKeySet("{END}", "ToggleSeek") Func Terminate() Exit 0 EndFunc Func SetColor() $set = $rainbow MsgBox ( 4096, "", $set) EndFunc Func ToggleSeek() If $aLoop = 0 Then $aLoop = 1 ElseIf $aLoop = 1 Then $aLoop = 0 EndIf EndFunc GUICreate ( "Colour Click", 300, 50 ) GUICtrlCreateLabel ("Colour Click Running! Press Esc to quit.", 10, 10) GUISetState(@SW_SHOW) While $bLoop = 1 $posx = MouseGetPos ( 0 ) $posy = MouseGetPos ( 1 ) $rainbow = PixelGetColor ( $posx , $posy) WEnd While $aLoop = 1 If $rainbow = $set Then MouseClick ( "left" ) Sleep ( 500 ) EndIf WEnd Basically it's supposed to set the color once you hit the HOME key and it seems to work because the message box that pops up whenever i hit HOME shows the color code. However, I can't seem to get it clicking by hitting the END key. Any help would be much appreciated, can't seem to get it working myself. I hope it doesn't turn out to be some really stupid mistake on my part. Thanks! Link to comment Share on other sites More sharing options...
Rental Posted September 30, 2008 Share Posted September 30, 2008 You were close. All you had to do was get rid of the 2nd while and add the if..then into your first one. I tested using paint and setting to a color like red, selected the paint bucket and when i moused over it it would change the color so i knew it was working. expandcollapse popup$aLoop = 0 $bLoop = 1 Dim $set, $posx, $posy, $rainbow HotKeySet("{ESC}", "Terminate") HotKeySet("{HOME}", "SetColor") HotKeySet("{END}", "ToggleSeek") Func Terminate() Exit 0 EndFunc Func SetColor() $set = $rainbow MsgBox ( 4096, "", $set) EndFunc Func ToggleSeek() If $aLoop = 0 Then $aLoop = 1 ElseIf $aLoop = 1 Then $aLoop = 0 EndIf EndFunc GUICreate ( "Colour Click", 300, 50 ) GUICtrlCreateLabel ("Colour Click Running! Press Esc to quit.", 10, 10) GUISetState(@SW_SHOW) While $bLoop = 1 $posx = MouseGetPos ( 0 ) $posy = MouseGetPos ( 1 ) $rainbow = PixelGetColor ( $posx , $posy) If $rainbow = $set Then MouseClick("Left") Sleep ( 500 ) EndIf WEnd Good luck with the rest Link to comment Share on other sites More sharing options...
Valuater Posted September 30, 2008 Share Posted September 30, 2008 Another look... expandcollapse popupDim $aLoop = 0, $bLoop = 1 Dim $set, $posx, $posy, $rainbow HotKeySet("{ESC}", "Terminate") HotKeySet("{HOME}", "SetColor") HotKeySet("{END}", "ToggleSeek") GUICreate("Colour Click", 300, 50) GUICtrlCreateLabel("Colour Click Running! Press Esc to quit.", 10, 10) GUISetState(@SW_SHOW) While GUIGetMsg() <> -3 ; different then exit If $bLoop = 1 Then $posx = MouseGetPos(0) $posy = MouseGetPos(1) $rainbow = PixelGetColor($posx, $posy) EndIf If $aLoop = 1 Then If $rainbow = $set Then MouseClick("left") Sleep(500) EndIf EndIf WEnd ; ---- Functions --------- Func Terminate() Exit 0 EndFunc ;==>Terminate Func SetColor() $set = $rainbow MsgBox(4096, "", $set) EndFunc ;==>SetColor Func ToggleSeek() If $aLoop = 0 Then $aLoop = 1 ElseIf $aLoop = 1 Then $aLoop = 0 EndIf ToolTip("aLoop = " & $aLoop & @CRLF & "bLoop = " & $bLoop & @CRLF & "Color = " & $rainbow & " ", 10, 10, "... 8)", 1) EndFunc ;==>ToggleSeek 8) Link to comment Share on other sites More sharing options...
twisted Posted September 30, 2008 Author Share Posted September 30, 2008 Wow, that was quick, thanks to you both! I guess it was a stupid mistake then, my script was getting stuck in the first loop. Hmm. Guess I can continue working on it now! Thanks again! Link to comment Share on other sites More sharing options...
Rental Posted September 30, 2008 Share Posted September 30, 2008 (edited) I tryed Valuater's and had some problems getting it to work, dont know if i was just me or something but once i changed the way he had the While i got it to work here's what i had to change it to to get it to work on mine, agian good luck While GUIGetMsg() <> -3 ; different then exit $posx = MouseGetPos(0) $posy = MouseGetPos(1) $rainbow = PixelGetColor($posx, $posy) If $rainbow = $set Then MouseClick("left") Sleep(500) EndIf WEnd Edited September 30, 2008 by Rental 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