Jump to content

Number Recognition, Read from the Screen


Recommended Posts

Hey Im working on making Autoit read numbers and keep track of them. Basically I want script that uses Pixel detection to read image numbers and convert them to real numbers that could be copied and pasted.

Example from full tilt poker:

$X1=5

$X2=1

$X3=2

$X4=5

$X5=2

$X6=0

$X7=4

$X8=1

$Y1=0

$Y2=3

$Y3=3

$Y4=3

$Y5=5

$Y6=7

$Y7=2

$Y8=4

$1sx=420

$1sy=307

$1col1=pixelgetcolor($1sx+$X1,$1sy+$Y1)

$1col2=pixelgetcolor($1sx+$X2,$1sy+$Y2)

$1col3=pixelgetcolor($1sx+$X3,$1sy+$Y3)

$1col4=pixelgetcolor($1sx+$X4,$1sy+$Y4)

$1col5=pixelgetcolor($1sx+$X5,$1sy+$Y5)

$1col6=pixelgetcolor($1sx+$X6,$1sy+$Y6)

$1col7=pixelgetcolor($1sx+$X7,$1sy+$Y7)

$1col8=pixelgetcolor($1sx+$X8,$1sy+$Y8)

If $1col2=16777215 and $1col4=16777215 and $1col7=16777215 and $1col8=16777215 Then

$NUMBERis=0

EndIf

If $1col1=16777215 and $1col2=16777215 and $1col5=16777215 and $1col6=16777215 Then

$NUMBERis=1

EndIf

If ........

$NUMBERis=3

If

$NUMBERis=4

and so on..........

How should I make this script so it shows me what number its is (1 or 0 or 2 or .. 9) in GUI so I can truck it from there and copy and paste it if I want to (number may change every sec). Thank you so much

keywen.com

Link to comment
Share on other sites

what is your question ...

you need help with reading numbers?

or you need help with gui commands?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

If you have some different numbers(images in this case) that random(it's doesn't matter) localized in different, but certain positions, you can solve this by next:

-measure sizes of pictures(controls) that you need and positions relative to window, and make screenshot of each images, or write info about region of screen by PixelGetColor.

For, example, take any card game, how you can recognize cards? -

- Enough to get and write all pixels that lies on diagonal line of each card.

_____________________________________________________________________________

Link to comment
Share on other sites

Sorry I wasnt clear

I want bot to do whats on a picture - Recognize numbers (pot amount) and tell me that on GUI. Lets say I know individual coordinates of each number how should rest of the script look like?

So far I made this but it doesnt work :D

#include <GUIConstants.au3>
HotkeySet ("{F6}", "Stop")
Func Stop ()
        Exit 0
EndFunc
$pot = 3
GUICreate("bot", 210, 200)
;labels
$lab = GUICtrlCreateLabel("Money in Play:", 50, 10, 80, 20)
$lab = GUICtrlCreateLabel("Pot Money: ", 50, 40, 80, 20)
$lab = GUICtrlCreateLabel("Called Money:", 50, 70, 80, 20)
$lab = GUICtrlCreateLabel("Raze by: ", 50, 100, 80, 20)
$lab = GUICtrlCreateLabel("Should Raze?:", 50, 130, 80, 20)
GUISetState(@SW_SHOW)
while 1
$1sx=420
$2sx=430
$3sx=437
$1sy=307
$potU=pixelgetcolor(416,306)
If $potU=209669 Then
$1sx=313
$2sx=323
$3sx=330
$1sy=370
 EndIf
$X1=5
$X2=1
$X3=2
$X4=5
$X5=2
$X6=0
$X7=4
$X8=1
$Y1=0
$Y2=3
$Y3=3
$Y4=3
$Y5=5
$Y6=7
$Y7=2
$Y8=4
$1col1=pixelgetcolor($1sx+$X1,$1sy+$Y1)
$1col2=pixelgetcolor($1sx+$X2,$1sy+$Y2)
$1col3=pixelgetcolor($1sx+$X3,$1sy+$Y3)
$1col4=pixelgetcolor($1sx+$X4,$1sy+$Y4)
$1col5=pixelgetcolor($1sx+$X5,$1sy+$Y5)
$1col6=pixelgetcolor($1sx+$X6,$1sy+$Y6)
$1col7=pixelgetcolor($1sx+$X7,$1sy+$Y7)
$1col8=pixelgetcolor($1sx+$X8,$1sy+$Y8)
$2col1=pixelgetcolor($2sx+$X1,$1sy+$Y1)
$2col2=pixelgetcolor($2sx+$X2,$1sy+$Y2)
$2col3=pixelgetcolor($2sx+$X3,$1sy+$Y3)
$2col4=pixelgetcolor($2sx+$X4,$1sy+$Y4)
$2col5=pixelgetcolor($2sx+$X5,$1sy+$Y5)
$2col6=pixelgetcolor($2sx+$X6,$1sy+$Y6)
$2col7=pixelgetcolor($2sx+$X7,$1sy+$Y7)
$2col8=pixelgetcolor($2sx+$X8,$1sy+$Y8)
$3col1=pixelgetcolor($3sx+$X1,$1sy+$Y1)
$3col2=pixelgetcolor($3sx+$X2,$1sy+$Y2)
$3col3=pixelgetcolor($3sx+$X3,$1sy+$Y3)
$3col4=pixelgetcolor($3sx+$X4,$1sy+$Y4)
$3col5=pixelgetcolor($3sx+$X5,$1sy+$Y5)
$3col6=pixelgetcolor($3sx+$X6,$1sy+$Y6)
$3col7=pixelgetcolor($3sx+$X7,$1sy+$Y7)
$3col8=pixelgetcolor($3sx+$X8,$1sy+$Y8)
$white=16777215
if $1col1 <> $white and $1col2=$white and $1col3 <> $white and $1col4=$white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8=$white then
 $pot=0
 EndIf
;1-
if $1col1 <> $white and $1col2 <> $white and $1col3=$white and $1col4 <> $white and $1col5=$white and $1col6 <> $white and $1col7 <> $white and $1col8 <> $white then
 $pot=1
 EndIf
;2-
if $1col1 <> $white and $1col2 <> $white and $1col3 <> $white and $1col4 <> $white and $1col5=$white and $1col6=$white and $1col7=$white then
 $pot=2
 EndIf
;3-
if $1col1 <> $white and $1col2 <> $white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8 <> $white then
 $pot=3
 EndIf
;4-
if $1col1 <> $white and $1col2=$white and $1col3 <> $white and $1col4 <> $white and $1col5=$white and $1col6 <> $white and $1col7=$white and $1col8 <> $white then
 $pot=4
 EndIf
;5-
if $1col1=$white and $1col2=$white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 <> $white and $1col8 <> $white then
 $pot=5
 EndIf
;6-
if $1col1 <> $white and $1col2=$white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 <> $white and $1col8=$white then
 $pot=6
 EndIf
;7-
if $1col1=$white and $1col2 <> $white and $1col3 <> $white and $1col4 <> $white and $1col5=$white and $1col6 <> $white and $1col7=$white and $1col8 <> $white then
 $pot=7
 EndIf
;8-
if $1col1 <> $white and $1col2=$white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8=$white then
 $pot=8
 EndIf
;9-
if $1col1 <> $white and $1col2=$white and $1col3 <> $white and $1col4=$white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8=$white then
 $pot=9
 EndIf
sleep(1000)
$1ur = GUICtrlCreateInput ($pot, 140,  10, 50, 25)
$1pot = GUICtrlCreateInput ($pot, 140,  40, 50, 25)
$1called = GUICtrlCreateInput ($pot, 140,  70, 50, 25)
$1raze = GUICtrlCreateInput ($pot, 140,  100, 50, 25)
$1ifraze = GUICtrlCreateInput ($pot, 140,  130, 50, 25)
WEnd

post-50894-1246054123_thumb.gif

Edited by nusaki

keywen.com

Link to comment
Share on other sites

This worKs great with MsgBoxes But can someone help me transfer this 2 GUI i really need help. Im new and stupid

WinActivate("[CLASS:FTC_TableViewFull]","")$X1=5$X2=1$X3=2$X4=5$X5=2$X6=0$X7=4$X8=1$X9=2$Y1=0$Y2=3$Y3=3$Y4=3$Y5=5$Y6=7$Y7=2$Y8=4$Y9=4$white=16777215$1sx=420$2sx=430$3sx=437$1sy=307$potU=pixelgetcolor(416,306)If $potU <> $white Then$1sx=313$2sx=323$3sx=330$1sy=370 EndIf$1col1=pixelgetcolor($1sx+$X1,$1sy+$Y1)$1col2=pixelgetcolor($1sx+$X2,$1sy+$Y2)$1col3=pixelgetcolor($1sx+$X3,$1sy+$Y3)$1col4=pixelgetcolor($1sx+$X4,$1sy+$Y4)$1col5=pixelgetcolor($1sx+$X5,$1sy+$Y5)$1col6=pixelgetcolor($1sx+$X6,$1sy+$Y6)$1col7=pixelgetcolor($1sx+$X7,$1sy+$Y7)$1col8=pixelgetcolor($1sx+$X8,$1sy+$Y8)$1col9=pixelgetcolor($1sx+$X9,$1sy+$Y9)$2col1=pixelgetcolor($2sx+$X1,$1sy+$Y1)$2col2=pixelgetcolor($2sx+$X2,$1sy+$Y2)$2col3=pixelgetcolor($2sx+$X3,$1sy+$Y3)$2col4=pixelgetcolor($2sx+$X4,$1sy+$Y4)$2col5=pixelgetcolor($2sx+$X5,$1sy+$Y5)$2col6=pixelgetcolor($2sx+$X6,$1sy+$Y6)$2col7=pixelgetcolor($2sx+$X7,$1sy+$Y7)$2col8=pixelgetcolor($2sx+$X8,$1sy+$Y8)$2col9=pixelgetcolor($2sx+$X9,$1sy+$Y9)$3col1=pixelgetcolor($3sx+$X1,$1sy+$Y1)$3col2=pixelgetcolor($3sx+$X2,$1sy+$Y2)$3col3=pixelgetcolor($3sx+$X3,$1sy+$Y3)$3col4=pixelgetcolor($3sx+$X4,$1sy+$Y4)$3col5=pixelgetcolor($3sx+$X5,$1sy+$Y5)$3col6=pixelgetcolor($3sx+$X6,$1sy+$Y6)$3col7=pixelgetcolor($3sx+$X7,$1sy+$Y7)$3col8=pixelgetcolor($3sx+$X8,$1sy+$Y8)$3col9=pixelgetcolor($3sx+$X9,$1sy+$Y9);0if $1col1 <> $white and $1col2=$white and $1col3 <> $white and $1col4=$white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8=$white and $1col9 <> $white Then    MsgBox (0,"","0")EndIf;1if $1col1 <> $white and $1col2 <> $white and $1col3=$white and $1col4 <> $white and $1col5=$white and $1col6 <> $white and $1col7 <> $white and $1col8 <> $white and $1col9=$white Then MsgBox (0,"","1")EndIf;2if $1col1 <> $white and $1col2 <> $white and $1col3 <> $white and $1col4 <> $white and $1col5=$white and $1col6=$white and $1col7=$white and $1col8 <> $white and $1col9=$white Then    MsgBox (0,"","2")EndIf;3if $1col1 <> $white and $1col2 <> $white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8 <> $white and $1col9 <> $white Then  MsgBox (0,"","3")EndIf;4if $1col1 <> $white and $1col2=$white and $1col3 <> $white and $1col4 <> $white and $1col5=$white and $1col6 <> $white and $1col7=$white and $1col8 <> $white and $1col9 <> $white Then MsgBox (0,"","4")EndIf;5if $1col1=$white and $1col2=$white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 <> $white and $1col8 <> $white and $1col9 <> $white Then MsgBox (0,"","5")EndIf;6if $1col1 <> $white and $1col2=$white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 <> $white and $1col8=$white and $1col9 <> $white Then MsgBox (0,"","6")EndIf;7if $1col1=$white and $1col2 <> $white and $1col3 <> $white and $1col4 <> $white and $1col5=$white and $1col6 <> $white and $1col7=$white and $1col8 <> $white and $1col9 <> $white Then MsgBox (0,"","7")EndIf;8if $1col1 <> $white and $1col2=$white and $1col3=$white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8=$white and $1col9 <> $white Then    MsgBox (0,"","8")EndIf;9if $1col1 <> $white and $1col2=$white and $1col3 <> $white and $1col4=$white and $1col5 <> $white and $1col6 <> $white and $1col7=$white and $1col8=$white and $1col9=$white Then   MsgBox (0,"","9")EndIf

keywen.com

Link to comment
Share on other sites

so he need gui example, nice to know :D

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
Global $X1=5,$X2=1,$X3=2,$X4=5,$X5=2,$X6=0,$X7=4,$X8=1,$X9=2
Global $Y1=0,$Y2=3,$Y3=3,$Y4=3,$Y5=5,$Y6=7,$Y7=2,$Y8=4,$Y9=4
Global $white=16777215
Global $1sx=420,$2sx=430,$3sx=437,$1sy=307

GUICreate("My GUI")
$input = GUICtrlCreateInput("", 10, 35, 100, 20,$ES_READONLY)
GUISetState(@SW_SHOW)

WinActivate("[CLASS:FTC_TableViewFull]","")
$potU=pixelgetcolor(416,306)
If $potU <> $white Then
    $1sx=313
    $2sx=323
    $3sx=330
    $1sy=370
EndIf

Do
    $msg = GUIGetMsg()
    If WinActive("[CLASS:FTC_TableViewFull]","") Then
        $1col1=pixelgetcolor($1sx+$X1,$1sy+$Y1)
        $1col2=pixelgetcolor($1sx+$X2,$1sy+$Y2)
        $1col3=pixelgetcolor($1sx+$X3,$1sy+$Y3)
        $1col4=pixelgetcolor($1sx+$X4,$1sy+$Y4)
        $1col5=pixelgetcolor($1sx+$X5,$1sy+$Y5)
        $1col6=pixelgetcolor($1sx+$X6,$1sy+$Y6)
        $1col7=pixelgetcolor($1sx+$X7,$1sy+$Y7)
        $1col8=pixelgetcolor($1sx+$X8,$1sy+$Y8)
        $1col9=pixelgetcolor($1sx+$X9,$1sy+$Y9)

        $2col1=pixelgetcolor($2sx+$X1,$1sy+$Y1)
        $2col2=pixelgetcolor($2sx+$X2,$1sy+$Y2)
        $2col3=pixelgetcolor($2sx+$X3,$1sy+$Y3)
        $2col4=pixelgetcolor($2sx+$X4,$1sy+$Y4)
        $2col5=pixelgetcolor($2sx+$X5,$1sy+$Y5)
        $2col6=pixelgetcolor($2sx+$X6,$1sy+$Y6)
        $2col7=pixelgetcolor($2sx+$X7,$1sy+$Y7)
        $2col8=pixelgetcolor($2sx+$X8,$1sy+$Y8)
        $2col9=pixelgetcolor($2sx+$X9,$1sy+$Y9)

        $3col1=pixelgetcolor($3sx+$X1,$1sy+$Y1)
        $3col2=pixelgetcolor($3sx+$X2,$1sy+$Y2)
        $3col3=pixelgetcolor($3sx+$X3,$1sy+$Y3)
        $3col4=pixelgetcolor($3sx+$X4,$1sy+$Y4)
        $3col5=pixelgetcolor($3sx+$X5,$1sy+$Y5)
        $3col6=pixelgetcolor($3sx+$X6,$1sy+$Y6)
        $3col7=pixelgetcolor($3sx+$X7,$1sy+$Y7)
        $3col8=pixelgetcolor($3sx+$X8,$1sy+$Y8)
        $3col9=pixelgetcolor($3sx+$X9,$1sy+$Y9)
        _number()
    EndIf
Until $msg = $GUI_EVENT_CLOSE




Func _number()
    Select
        Case $1col1 <> $white and $1col2 =  $white and $1col3 <> $white and $1col4 =  $white and $1col5 <> $white and $1col6 <> $white and $1col7 =  $white and $1col8 =  $white and $1col9 <> $white
            $number = 0
        Case $1col1 <> $white and $1col2 <> $white and $1col3 =  $white and $1col4 <> $white and $1col5 =  $white and $1col6 <> $white and $1col7 <> $white and $1col8 <> $white and $1col9 =  $white
            $number = 1
        Case $1col1 <> $white and $1col2 <> $white and $1col3 <> $white and $1col4 <> $white and $1col5 =  $white and $1col6 =  $white and $1col7 =  $white and $1col8 <> $white and $1col9 =  $white
            $number = 2
        Case $1col1 <> $white and $1col2 <> $white and $1col3 =  $white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 =  $white and $1col8 <> $white and $1col9 <> $white
            $number = 3
        Case $1col1 <> $white and $1col2 =  $white and $1col3 <> $white and $1col4 <> $white and $1col5 =  $white and $1col6 <> $white and $1col7 =  $white and $1col8 <> $white and $1col9 <> $white
            $number = 4
        Case $1col1 =  $white and $1col2 =  $white and $1col3 =  $white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 <> $white and $1col8 <> $white and $1col9 <> $white
            $number = 5
        Case $1col1 <> $white and $1col2 =  $white and $1col3 =  $white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 <> $white and $1col8 =  $white and $1col9 <> $white
            $number = 6
        Case $1col1 =  $white and $1col2 <> $white and $1col3 <> $white and $1col4 <> $white and $1col5 =  $white and $1col6 <> $white and $1col7 =  $white and $1col8 <> $white and $1col9 <> $white
            $number = 7
        Case $1col1 <> $white and $1col2 =  $white and $1col3 =  $white and $1col4 <> $white and $1col5 <> $white and $1col6 <> $white and $1col7 =  $white and $1col8 =  $white and $1col9 <> $white
            $number = 8
        Case $1col1 <> $white and $1col2 =  $white and $1col3 <> $white and $1col4 =  $white and $1col5 <> $white and $1col6 <> $white and $1col7 =  $white and $1col8 =  $white and $1col9 =  $white
            $number = 9
        Case Else
            $number = "ERROR"
    EndSelect
    If GUICtrlRead($input) <> $number Then GUICtrlSetData ($input, $number)
EndFunc

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

boqQ OMG MAN THANKS SO MUCH. You have done lots of work, I greatly appreciate it, sorry was busy and didnt have chance to look at this post until today. Scrip shows me error but ill fix it. Thank you again, now I know where to start :)

keywen.com

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