Sign in to follow this  
Followers 0
KurtTheBain

Little Pixel by Image problem.

1 post in this topic

Lets say i have a image i wanna click on, but i wanna find it by it's pixel colors(yes more then one color)

 

How would i do this?

 

Please provide and example as im trying to figure it out.

 

Heres my code i want to implement it in:

 

Spoiler

#include <ImageSearch.au3>

Global $g_bPaused = False
HotKeySet("{F2}", "TogglePause")
HotKeySet("{F3}", "Main")
HotKeySet("{ESC}", "Terminate")
$color1 = 0x334409
$color2 = 0xD33B50
$color3 = 0x578EBE
$color4 = 0xAD636F
$color5 = 0xFFD166

While 1 ;loop forever to wait for the keypress
  Sleep(100) ;no need to kill the CPU
WEnd

Func TogglePause()
    $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
     WEnd
   TrayTip("Script","Du Pausede Scriptet.",1)
Sleep(20)
 EndFunc   ;==>TogglePause

 Func Terminate()
         TrayTip("Script","Scriptet er nu slukket, start det igen ved at klikke på på scriptet",1)
      Sleep(1)
   Exit
EndFunc   ;==>Terminate

Func Main()
  HotKeySet("{F3}") ;remove the hotkey so we don't jump around once we have started
While(1)
   $Variable = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color1)
If IsArray($Variable) = True Then
    MouseClick("Left", $Variable[0], $Variable[1],20,0)
Else
    $Variable = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color2)
    If IsArray($Variable) = True Then
        MouseClick("Left", $Variable[0], $Variable[1],20,0)
    Else
        $Variable = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color3)
        If IsArray($Variable) = True Then
            MouseClick("Left", $Variable[0], $Variable[1],20,0)
    Else
         $Variable = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color4)
                 If IsArray($Variable) = True Then
            MouseClick("Left", $Variable[0], $Variable[1],20,0)
    Else
         $Variable = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color5)
                 If IsArray($Variable) = True Then
            MouseClick("Left", $Variable[0], $Variable[1],20,0)
 EndIf
 EndIf
      EndIf
    EndIf
 EndIf
    TrayTip("Script","Du startede scriptet.",1)
    $min = 1000
    $max = 2000
    Sleep(Random($min, $max) * 1000)
    $iChar = Random(97, 122,1)
    Send(Chr($iChar))
    Send("{ENTER}")
 WEnd
EndFunc
 

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0