brizoke Posted May 8, 2007 Posted May 8, 2007 I saw this ocr code on here and want to understand something about it. CODEFunc _OCR($Ax, $Ay, $Dx, $Dy) $width = $Dx - $Ax $length = $Dy - $Ay Dim $char[$width][$length] For $xwidth = 0 To $width - 1 For $xlength = 0 To $length - 1 $char[$xwidth][$xlength] = Hex(PixelGetColor($Ax, $Ay), 6) $Ay = $Ay + 1 Next $Ax = $Ax + 1 $Ay = $Ay - $length Next ;scans entire area What I don't understand is how this piece of code works. In the second for loop, $xlength starts at zero and is supposed to stop at $length , but the loop gets incremented by - 1. Shouldn't that be + 1. I am sorry if this is a dumb question, but if someone can illistrate it for me I would really appreciate it.
herewasplato Posted May 9, 2007 Posted May 9, 2007 (edited) If you are speaking of this line:For $xlength = 0 To $length - 1oÝ÷ Ù8bJÖ¬jëh×6For $xlength = 0 To ($length - 1) xlength does not get decremented by 1 [or as you put it "incremented by -1"] -MSP- Edit: to decrement you would use Step -1, I think... Edited May 9, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
brizoke Posted May 9, 2007 Author Posted May 9, 2007 If you are speaking of this line:For $xlength = 0 To $length - 1oÝ÷ Ù8bJÖ¬jëh×6For $xlength = 0 To ($length - 1) xlength does not get decremented by 1 [or as you put it "incremented by -1"] -MSP- Edit: to decrement you would use Step -1, I think... Thank you very much. I see now that there is no Step in the loop. I am very new to this obviously. I really appreciate your help.
herewasplato Posted May 9, 2007 Posted May 9, 2007 You are welcome... and welcome to the forum. Hang around, it is a great community. [size="1"][font="Arial"].[u].[/u][/font][/size]
i542 Posted May 9, 2007 Posted May 9, 2007 (edited) You are welcome... and welcome to the forum.Hang around, it is a great community.Agree.i542P.S. Don't be as others: post a question and leave. Edited May 9, 2007 by i542 I can do signature me.
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