Jump to content

Color check


 Share

Recommended Posts

Hi! I have made two diffrent scripts to check colores on 4 different placeses. The only problem is that none of the two diffrent scripts (see under) seems to work. I am new to Autoit so i have realy no idea about what is going on, but I hope some of you guys understand what i am trying to do with looking at the scripts under and see whats wrong about it. And also if someone can tell me if the sleep statement is actualy necessary that would be great! Because the faster the program checks the colores of the 4 different places, the better it is :) Thank you in advance!

script 1:

#include <MsgBoxConstants.au3>

HotKeySet("{F1}", "FindCol1")
HotKeySet("{ESC}", "Terminate")


Dim $xX = 1300, $yY = 365

Func FindCol1()
    Check($xX, $yY)
EndFunc

Func Check1($X, $Y)
        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is", $var)
        MsgBox(0, "The hex color is", Hex($var, 6))
EndFunc

Dim $xX = 1190, $yY = 365

Func FindCol2()
    Check($xX, $yY)
EndFunc

Func Check2($X, $Y)
        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is", $var)
        MsgBox(0, "The hex color is", Hex($var, 6))
EndFunc

Dim $xX =1070, $yY = 365

Func FindCol3()
    Check($xX, $yY)
EndFunc

Func Check3($X, $Y)
        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is", $var)
        MsgBox(0, "The hex color is", Hex($var, 6))
EndFunc

Dim $xX = 960, $yY = 365

Func FindCol4()
    Check($xX, $yY)
EndFunc

Func Check4($X, $Y)
        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is", $var)
        MsgBox(0, "The hex color is", Hex($var, 6))
EndFunc


Func Terminate()
    Exit
EndFunc

 

script 2:

#include <MsgBoxConstants.au3>

HotKeySet("{F1}", "FindCol")
HotKeySet("{ESC}", "Terminate")


Dim $xX = 1300, $yY = 365

While 1
    Sleep(500)
WEnd

Func FindCol()
    Check($xX, $yY)
EndFunc

Func Check($X, $Y)
    Do
        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is1", $var)
        MsgBox(0, "The hex color is1", Hex($var, 6))
        Dim $xX = 1300, $yY = 365

        sleep(500)

        Check($xX, $yY)

        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is2", $var)
        MsgBox(0, "The hex color is2", Hex($var, 6))
        Dim $xX = 1190, $yY = 365

        sleep(500)

        Check($xX, $yY)

        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is3", $var)
        MsgBox(0, "The hex color is3", Hex($var, 6))
        Dim $xX = 1080, $yY = 365

        sleep(500)

        Check($xX, $yY)

        $var = PixelGetColor($X, $Y)
        MsgBox(0, "The decmial color is4", $var)
        MsgBox(0, "The hex color is4", Hex($var, 6))
        Dim $xX = 970, $yY = 365

        Check($xX, $yY)

        sleep(500)

    Until _IsPressed("71")
EndFunc

 

 

Link to comment
Share on other sites

  • Developers

Correct,

Script one doesn't run anything and ends right away.
script 2 restarts Check(() endlessly so will end in a recursion stack error.

What are you trying to do?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This works:

#include <MsgBoxConstants.au3>

HotKeySet("{F1}", "Check")
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(500)
WEnd

Func Check()
    Do
        $var = PixelGetColor(1300, 365)
        MsgBox(0, "The decmial color is1", $var)
        MsgBox(0, "The hex color is1", Hex($var, 6))
        Dim $xX = 1300, $yY = 365

        $var = PixelGetColor(1190, 365)
        MsgBox(0, "The decmial color is2", $var)
        MsgBox(0, "The hex color is2", Hex($var, 6))
        Dim $xX = 1190, $yY = 365

        $var = PixelGetColor(1080, 365)
        MsgBox(0, "The decmial color is3", $var)
        MsgBox(0, "The hex color is3", Hex($var, 6))

        $var = PixelGetColor(970, 365)
        MsgBox(0, "The decmial color is4", $var)
        MsgBox(0, "The hex color is4", Hex($var, 6))

    Until $var = 10

EndFunc

 

Link to comment
Share on other sites

  • Developers

@nodefreak,
Please stop with sending these PM's and start first with reading our forum rules.

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...