Jump to content

Click on color


ashley
 Share

Recommended Posts

excample would be 100% better

please

hahaha, I love it how you edited your post to add 'please'

Click on red

$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000,10)
If Not @error Then
    MouseClick("left",$coord[0],$coord[1])
EndIf

That example is in the help file, but uses MsgBox instead of MouseClick <_<

Link to comment
Share on other sites

hahaha, I love it how you edited your post to add 'please'

Click on red

$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000,10)
If Not @error Then
    MouseClick("left",$coord[0],$coord[1])
EndIf

That example is in the help file, but uses MsgBox instead of MouseClick <_<

nop, look here all my code(so far)

#include <GUIConstants.au3>
Global $readcolor
#Region ### START Koda GUI section ### Form=
$Powercutter = GUICreate("Powercutter", 234, 83, 193, 115)
$Button1 = GUICtrlCreateButton("Start", 8, 54, 99, 25, 0)
$Combo1 = GUICtrlCreateCombo("Please select", 8, 8, 217, 25)
Guictrlsetdata($Combo1, "Tree|Oak")
$lable = GUICtrlCreateLabel("Status: Still", 115, 54, 99, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$wait = 20; wait 20ms for next progressstep
$s = 0; progressbar-saveposition
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
        Case $button1
        _run()
    EndSwitch
WEnd


Func _run()

If GUICtrlRead($Combo1) = "Please Select" then Return
    $Progress1 = GUICtrlCreateProgress(8, 32, 212, 20)
    $read = GUICtrlRead($Combo1)
    GUICtrlSetData($lable, "Status: Setting Tree name as: " & $read)
    For $i = $s To 100
    $s = $i;save the current bar-position to $s
    $s=0
      GUICtrlSetData ($progress1,$i)
      Sleep($wait)
  Next
  Sleep(1000)
  
  GUICtrlSetData($lable, "Status: Still")
  GUICtrlDelete($Progress1)
  
  Sleep(1000)
    $Progress1 = GUICtrlCreateProgress(8, 32, 212, 20)
    GUICtrlSetData($lable, "Status: Loading tree infomation")
    For $i = $s To 100
    $s = $i;save the current bar-position to $s
    $s=0
      GUICtrlSetData ($progress1,$i)
      Sleep($wait)
  Next
  Sleep(1000)
  
  GUICtrlSetData($lable, "Status: Still")
  GUICtrlDelete($Progress1)
  Sleep(1000)
    
        $Progress1 = GUICtrlCreateProgress(8, 32, 212, 20)
    GUICtrlSetData($lable, "Status: Loading Anti-Randoms")
    For $i = $s To 100
    $s = $i;save the current bar-position to $s
    $s=0
      GUICtrlSetData ($progress1,$i)
      Sleep($wait)
  Next
  Sleep(1000)
  
  GUICtrlSetData($lable, "Status: Failed")
  GUICtrlDelete($Progress1)
  Sleep(1000)
  
  GUICtrlSetData($lable, "Status: Still")
  
MsgBox(48,"Internal Error","Powerminer has discovered an internal error" & @CRLF & @CRLF & "Code: 002050 Result: 01" & @CRLF & @CRLF & "Powerminer will continue after ok is pressed.")

_runpower()  

EndFunc


Func _runpower()
    
GUICtrlSetData($lable, "Status: Running")
If $readcolor = GUICtrlRead($Combo1) = "Tree" then 
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000,10)
    EndIf
If Not @error Then
    MouseClick("left",$coord[0],$coord[1])
EndIf

GUICtrlSetData($lable, "Status: Finished")
EndFunc
Link to comment
Share on other sites

But I already told you how to do it <_<

here's another example

TrayTip("Click on color", "Move your mouse over the color you want to click and press F10" & @CRLF & "Then press HOME to click and ESC to exit", 3)
Global $color


HotKeySet("{F10}", "getcolor")
HotKeySet("{home}", "click")
HotKeySet("{esc}", "quit")

While 1
    Sleep(100)
WEnd

Func getcolor()
    $pos = MouseGetPos()
    $color = PixelGetColor($pos[0], $pos[1])
EndFunc   ;==>getcolor
Func click()
    $coord = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color)
    If Not @error Then
        MouseClick("left", $coord[0], $coord[1])
    EndIf
EndFunc   ;==>click
Func quit()
    Exit
EndFunc   ;==>quit
Link to comment
Share on other sites

But I already told you how to do it <_<

here's another example

TrayTip("Click on color", "Move your mouse over the color you want to click and press F10" & @CRLF & "Then press HOME to click and ESC to exit", 3)
Global $color
HotKeySet("{F10}", "getcolor")
HotKeySet("{home}", "click")
HotKeySet("{esc}", "quit")

While 1
    Sleep(100)
WEnd

Func getcolor()
    $pos = MouseGetPos()
    $color = PixelGetColor($pos[0], $pos[1])
EndFunc   ;==>getcolor
Func click()
    $coord = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $color)
    If Not @error Then
        MouseClick("left", $coord[0], $coord[1])
    EndIf
EndFunc   ;==>click
Func quit()
    Exit
EndFunc   ;==>quit

ok can u make it so it clicks say purple in MY script.

Link to comment
Share on other sites

  • Moderators

Ashley, you've been here plenty of enough time, and have voiced your opinion openly for others to know how you feel about what they do or how they do it.

So allow me to return the favor. This is a "childs" function to learn, if you can't learn how to implement it into your script to do what you want without others writing it for you... maybe you should take up another hobby other than AutoIt.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ashley, you've been here plenty of enough time, and have voiced your opinion openly for others to know how you feel about what they do or how they do it.

So allow me to return the favor. This is a "childs" function to learn, if you can't learn how to implement it into your script to do what you want without others writing it for you... maybe you should take up another hobby other than AutoIt.

ok thanks for ur opinion, i ahve just one question left...

How can i use the code given to me and it clicks on the color like asked, but then how can i make it move do i diffrent pixel of the same color...

Link to comment
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...