Insolence Posted December 22, 2004 Share Posted December 22, 2004 (edited) Basically what I'm trying to do is look at the base pixels of each letter. Connecting as many as I can by searching 1 down 1 right then searching 1 up 1 left. Then saving the results wherever the correct pixel is found, returning stuff like such: D D R D D R R L U U (10 results hopefully, I think a few will be less)Right now it only reads 1 thing at a time, I can't figure out how to get from letter-to-letter.I think that will be enough to uniquely identify each letter, but I'm stuck as to how I'll scan each line of text, and efficiently.Here's the picture:http://www.insolence9.com/images/diabloii.bmp (255 KB, copy and paste)Here's the code so far (I've just been playing with it, a little commented out debuggers and such)expandcollapse popupSleep(2000) $color = 5263440 ;$msg = ReadText ( 61, 45, 339, 58, $color ) Y $begin = TimerStart() $msg = ReadText ( 70, 45, 339, 300, $color ) $dif = TimerStop($begin) MsgBox("", "", $msg & " scanned in: " & $dif) Func ReadText($startx, $starty, $endx, $endy, $color) $TopLeft = PixelSearch ( $startx, $starty, $endx, $endy, $color ) $String = "" $i = 0 $GoingDown = 1 For $i = 1 to 10 If $GoingDown = 1 Then $TopLeft_1D = PixelGetColor ( $TopLeft[0], $TopLeft[1] + 1 );Move 1 pixel down ;MouseMove( $TopLeft[0], $TopLeft[1] + 1, 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1D <> $color Then $TopLeft_1R = PixelGetColor ( $TopLeft[0] + 1, $TopLeft[1] );Move 1 pixel right ;MouseMove( $TopLeft[0] + 1, $TopLeft[1], 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1R <> $color Then $GoingDown = 0;We started going up, can't go down now. Else $TopLeft[0] = $TopLeft[0] + 1 $String = $String & "R";If successfully found a pixel right, add R to string EndIf Else $TopLeft[1] = $TopLeft[1] + 1 $String = $String & "D";If successfully found a pixel down, add D to the string EndIf Else ;We can't go down-right any more, so we're going up-left $TopLeft_1U = PixelGetColor ( $TopLeft[0], $TopLeft[1] - 1 );Move 1 pixel up ;MouseMove( $TopLeft[0], $TopLeft[1] - 1, 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1U <> $color Then $TopLeft_1L = PixelGetColor ( $TopLeft[0] - 1, $TopLeft[1] );Move 1 pixel left ;MouseMove( $TopLeft[0] - 1, $TopLeft[1], 10) ;Sleep(1000) ;MouseMove( 400, 400, 3) If $TopLeft_1L == $color Then $TopLeft[0] = $TopLeft[0] - 1 $String = $String & "L";If successfully found a pixel left, add L to string EndIf Else $TopLeft[1] = $TopLeft[1] - 1 $String = $String & "U";If successfully found a pixel up, add R to the string EndIf EndIf Next Return $String EndFuncI threw it in a function to make it a little more organized. Any problems you see, or suggestions you have, PLEASE don't hessitate to rip me to shreds Also, I tested this with the AU3Spy and the Magnifier enabled (hence the mouse moves) it helped quite a bit. Enable those commented out lines and use the magnifier to see what's going on. Edited December 22, 2004 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
grakker Posted December 23, 2004 Share Posted December 23, 2004 This thread might be interesting to what you are trying to dohttp://www.autoitscript.com/forum/index.ph...opic=5788&st=15 Link to comment Share on other sites More sharing options...
Insolence Posted December 23, 2004 Author Share Posted December 23, 2004 Thanks a ton for that link. I'll need to contact Larry. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted December 23, 2004 Author Share Posted December 23, 2004 Ehhh, bump* "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted December 23, 2004 Author Share Posted December 23, 2004 Thanks Larry, was waiting for ya I COULD use pixel variation, though, right? "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. 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