Sign in to follow this  
Followers 0
sonicxtacy02

How to force autoit to close on error

17 posts in this topic

What i want is simple.. i want to force a script to close when an error happens instead of displaying the error message. Is this possible? My script is an ocr... if the number changes in the middle or the script running i get an error message (happens about 20% of the time). Sure would love the script to just close itself upon error. I thought there was an option to do this but i cant find it.

Share this post


Link to post
Share on other sites



Maybe this:

RunErrorsFatal

Sets if the script should terminate with a fatal error if a Run/RunWait function fails due to bad paths/file not found/Bad login IDs:

1 = fatal error (default)

0 = silent error (@error set to 1)

Share this post


Link to post
Share on other sites

Maybe this:

wont work, my errors are generally based on the invalid subscript in an array.. none of those reasons apply.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

meaby this

if @error  Then
    $_Acc1AttackCount = String(30)
exit 
    EndIf

this is an @error from my prog it closes the prog :P the $_Acc1AttackCount = String(30) is yust an peace of code mention the exit

Edited by Matthy

Share this post


Link to post
Share on other sites

What's up with people wanting stupid things concerning fatal errors? Write good code and you won't have to worry about this.

Share this post


Link to post
Share on other sites

What's up with people wanting stupid things concerning fatal errors? Write good code and you won't have to worry about this.

clearly you dont know what YOU are talking about. My code works and works as efficently as it can. It reads time remaining, ETA and distance to turn from a navigation application. The only reason my code throws an error is if 1 number outta about 20 read changes while the ocr is "reading". By all means if you know of a way of preventing an error of such nature from happening then contribute. If not by all means leave ur criticism at the door.

Share this post


Link to post
Share on other sites

clearly you dont know what YOU are talking about.

<egotistical retort>I suppose you're right, somebody who helps make this language would clearly not know how to write working code in it.</egotistical retort>

My code works and works as efficently as it can. It reads time remaining, ETA and distance to turn from a navigation application.

Well, no, it doesn't work if it's crashing.

The only reason my code throws an error is if 1 number outta about 20 read changes while the ocr is "reading".

The only reason your code throws an error is because you didn't check a condition that you need to be checking in order to prevent the error. It's your fault and your fault alone the code is failing.

By all means if you know of a way of preventing an error of such nature from happening then contribute.

The forum crystal ball has been stolen. Nobody here can help without seeing some code.

If not by all means leave ur criticism at the door.

Sorry, but no. What you are asking for is idiotic. Fix your code, don't ask for some crutch to hide the problem.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

<egotistical retort>I suppose you're right, somebody who helps make this language would clearly not know how to write working code in it.</egotistical retort>

Well, no, it doesn't work if it's crashing.

The only reason your code throws an error is because you didn't check a condition that you need to be checking in order to prevent the error. It's your fault and your fault alone the code is failing.

The forum crystal ball has been stolen. Nobody here can help without seeing some code.

Sorry, but no. What you are asking for is idiotic. Fix your code, don't ask for some crutch to hide the problem.

global $screen, $skin, $mouse, $cmd, $guidancemode, $guidancemode2, $picPos, $boxstartx=0, $boxstarty=0
global $leftcount=0
global $rightcount=0
global $upcount=0
global $downcount=0
global $direction
Global Const $StructDef_COPYDATA = "ptr;dword;ptr"
Global Const $WM_COPYDATA = 0x4A
Global Const $WM_CLOSE = 0x10
Global Const $STRUCTDEF_AU3MESSAGE = "char[255]"
#include <GUIConstants.au3>
AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("WinSearchChildren", 1)
AutoItSetOption("PixelCoordMode", 0)
$handle = WinGetHandle("iGuidance", "")

If @error Then
 ;MsgBox(4096, "Error", "Could not find the correct window")
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"iGuidance Handle Not Found")
Else
;msgbox(0,"TEST",$handle)
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"iGuidance Handle is "&$handle)
endif

; Create Reciver window
$hwmd_Reciver = GUICreate("Receiver")

GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc")
GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc")
Get_screen()
$screen=stringtrimleft($cmd,10)
;Get_skin()
;$skin=stringtrimleft($cmd,8)

winsetstate($handle,"", @SW_SHOW)
winactivate($handle)

if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"The Current Screen is "&$screen)
;msgbox(0,"test", $cmdlineraw)
if not $screen="" then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"The plugin is successfully communicating with RR")
Else
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Program Cannot communicate with RR")
endif

$offsetx=iniread("igaddon.ini","igaddon","Xoffset","0")
$offsety=iniread("igaddon.ini","igaddon","Yoffset","0")
$arrowmode=iniread("igaddon.ini","igaddon","arrowmode","0")
$numreader=iniread("igaddon.ini","igaddon","ocrmode","0")
$smoothfont=iniread("igaddon.ini","igaddon","smoothfont","false")

$guidancecheck=PixelGetColor(3,21)
if $guidancecheck=128 then 
    run("exec.exe SETIND;CUSTOMUTURNRIGHT;OFF||SETIND;CUSTOMUTURNLEFT;OFF||SETIND;CUSTOMBEARLEFT;OFF||SETIND;CUSTOMBEARRIGHT;OFF||SETIND;CUSTOMSTRAIGHTLEFT;OFF||SETIND;CUSTOMSTRAIGHTRIGHT;OFF||SETIND;CUSTOMROUNDLEFT;OFF||SETIND;CUSTOMROUNDRIGHT;OFF||SETIND;CUSTOMSTRAIGHT;OFF||SETIND;CUSTOMRIGHTTURN;OFF||SETIND;CUSTOMLEFTTURN;OFF||SETIND;CUSTOMSHARPRIGHT;OFF||SETIND;CUSTOMSHARPLEFT;OFF||SETLABEL;CUSTOMETA;||SETLABEL;CUSTOMREM;||SETLABEL;CUSTOMDISTANCETURN;||SETLABEL;CUSTOMINSTRUCTION;||SETVAR;IGINSTRUCTION;")
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Guidance Mode. Program Closing")
    exit
endif

if stringinstr($cmdlineraw, "pixelhunt") then
$gui=GUICreate("test transparentpic", 96, 96, 0+$offsetx, 60+$offsety)
$pic=GUICreate("", 96, 96, $offsetx-1, 39+$offsety,BitOr($WS_POPUP,$SS_GRAYFRAME),BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$handle)
GUICtrlCreatePic("debugbox.gif",0,0,0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_HIDE,$gui)

HotKeySet("{ESC}", "close")
HotKeySet("{LEFT}", "left")
HotKeySet("{RIGHT}", "right")
HotKeySet("{DOWN}", "down")
HotKeySet("{UP}", "up")
HotKeySet("{ENTER}","enter")
$picPos = WinGetPos($pic)
$guiPos = WinGetPos($gui)

do
    $msg = GUIGetMsg()
until $msg = $GUI_EVENT_CLOSE
Exit


EndIf

$whitepix=pixelSearch(0, 60, 108, 76, 16777215)
if @error then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Find The Arrow box.  Closing program")    
    exit
EndIf
;msgbox(0,"TEST", "X is "& $whitepix[0]&" Y is "& $whitepix[1])
winactivate($handle)
$blackpix=PixelGetColor($whitepix[0], $whitepix[1]-2)
;msgbox(0,"TEST", "blackpix is "&$blackpix)
if $blackpix=0 then 
    $boxstartx=$whitepix[0]-98
    $boxstarty=$whitepix[1]-2
;msgbox(0,"TEST", "startx is "&$boxstartx)
;msgbox(0,"TEST", "starty is "&$boxstarty)
Else
    if stringinstr($cmdlineraw,"debug") then 
        filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Find Arrow Box.  Closing program") 
        exit
    EndIf
endif

winactivate($handle)
;this gives the location of the eta box border- need $etaboxwhitepix[1] to determine ocr Y coords
$etaboxwhitepix=pixelsearch(0,40,2,600,16777215)
if @error then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Find Box Width.  Closing program")
    exit
EndIf
;msgbox(0,"TEST","ETABOX X is "&$etaboxwhitepix[0]&" and ETABOX Y is "&$etaboxwhitepix[1])
winactivate($handle)
$etaboxend=pixelsearch($etaboxwhitepix[0]+1,$etaboxwhitepix[1]+3,200,$etaboxwhitepix[1]+5,16777215)
if @error then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Find Box Width.  Closing program")
    exit
EndIf
;msgbox(0,"TEST","ETABOXEND X is "&$etaboxend[0]&" and ETABOXEND Y is "&$etaboxend[1])
$boxwidth=$etaboxend[0]
if @error then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Find Box Width.  Closing program")
    exit
EndIf





if $arrowmode=0 then
if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Searching for White Arrows")
;Opt("PixelCoordMode", 2)

$uturnrt1=PixelGetColor($offsetx,$offsety)
$uturnrt2=pixelgetcolor($offsetx,$offsety)
$uturnrt3=PixelGetColor($offsetx,$offsety)
$uturnlt1=PixelGetColor($boxstartx+13+$offsetx,$boxstarty+60+$offsety)
$uturnlt2=PixelGetColor($boxstartx+30+$offsetx,$boxstarty+81+$offsety)
$uturnlt3=pixelgetcolor($boxstartx+44+$offsetx,$boxstarty+60+$offsety)
$left1=pixelgetcolor($boxstartx+22+$offsetx,$boxstarty+32+$offsety)
$left2=PixelGetColor($boxstartx+42+$offsetx,$boxstarty+17+$offsety)
$left3=PixelGetColor($boxstartx+41+$offsetx,$boxstarty+47+$offsety)
$right1=PixelGetColor($boxstartx+54+$offsetx,$boxstarty+16+$offsety)
$right2=PixelGetColor($boxstartx+55+$offsetx,$boxstarty+48+$offsety)
$right3=PixelGetColor($boxstartx+76+$offsetx,$boxstarty+32+$offsety)
$bearlt1=PixelGetColor($boxstartx+20+$offsetx,$boxstarty+43+$offsety)
$bearlt2=PixelGetColor($boxstartx+15+$offsetx,$boxstarty+13+$offsety)
$bearlt3=PixelGetColor($boxstartx+63+$offsetx,$boxstarty+85+$offsety)
$bearrt1=PixelGetColor($boxstartx+47+$offsetx,$boxstarty+18+$offsety)
$bearrt2=PixelGetColor($boxstartx+77+$offsetx,$boxstarty+14+$offsety)
$bearrt3=PixelGetColor($boxstartx+72+$offsetx,$boxstarty+43+$offsety)
$strlt1=pixelgetcolor($boxstartx+63+$offsetx,$boxstarty+9+$offsety)
$strlt2=pixelgetcolor($boxstartx+28+$offsetx,$boxstarty+41+$offsety)
$strrt1=PixelGetColor($boxstartx+41+$offsetx,$boxstarty+9+$offsety)
$strrt2=PixelGetColor($boxstartx+75+$offsetx,$boxstarty+40+$offsety)
$str1=PixelGetColor($boxstartx+49+$offsetx,$boxstarty+8+$offsety)
$str2=PixelGetColor($boxstartx+64+$offsetx,$boxstarty+33+$offsety)
$str3=pixelgetcolor($boxstartx+34+$offsetx,$boxstarty+32+$offsety)
$roundrt1=pixelgetcolor($boxstartx+53+$offsetx,$boxstarty+21+$offsety)
$roundrt2=PixelGetColor($boxstartx+22+$offsetx,$boxstarty+59+$offsety)
$roundrt3=PixelGetColor($boxstartx+62+$offsetx,$boxstarty+34+$offsety)
$roundlt1=pixelgetcolor($offsetx,$offsety)
$roundlt2=PixelGetColor($offsetx,$offsety)
$roundlt3=pixelgetcolor($offsetx,$offsety)
$destination1=PixelGetColor($boxstartx+49+$offsetx,$boxstarty+48+$offsety)
$sharprt1=pixelgetcolor($boxstartx+50+$offsetx,$boxstarty+63+$offsety)
$sharprt2=pixelgetcolor($boxstartx+74+$offsetx,$boxstarty+65+$offsety)
$sharplt1=pixelgetcolor($boxstartx+28+$offsetx,$boxstarty+39+$offsety)
$sharplt2=pixelgetcolor($boxstartx+42+$offsetx,$boxstarty+63+$offsety)

;$guidancemode=pixelgetcolor(8+$offsetx,25+$offsety)
;if $guidancemode=16384 then 
;   if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"guidance mode loop starting")
;   while $guidancemode=16384
;       guidance_loop() 
;   WEnd
;   if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"guidance mode loop ended")
;   sleep(2000)
;   grabfunc()
;ENDIF
run("exec.exe SETIND;CUSTOMUTURNRIGHT;OFF||SETIND;CUSTOMUTURNLEFT;OFF||SETIND;CUSTOMBEARLEFT;OFF||SETIND;CUSTOMBEARRIGHT;OFF||SETIND;CUSTOMSTRAIGHTLEFT;OFF||SETIND;CUSTOMSTRAIGHTRIGHT;OFF||SETIND;CUSTOMROUNDLEFT;OFF||SETIND;CUSTOMROUNDRIGHT;OFF||SETIND;CUSTOMSTRAIGHT;OFF||SETIND;CUSTOMRIGHTTURN;OFF||SETIND;CUSTOMLEFTTURN;OFF||SETIND;CUSTOMSHARPRIGHT;OFF||SETIND;CUSTOMSHARPLEFT;OFF||SETLABEL;CUSTOMDIRECTION;||SETLABEL;CUSTOMETA;||SETLABEL;CUSTOMREM;||SETLABEL;CUSTOMDISTANCETURN;||SETLABEL;CUSTOMINSTRUCTION;||SETVAR;IGINSTRUCTION;")
;msgbox(0,"TEST","indy is on!")
if $uturnrt1=4 and $uturnrt2=16777215 and $uturnrt3=16777215 then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"U-Turn Right")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;U-Turn Right")
    run("exec.exe SETIND;CUSTOMUTURNRIGHT;ON")
    $direction= "U-Turn Right"
elseif $uturnlt1=16777215 and $uturnlt2=8553089 and $uturnlt3=14013905 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"U-Turn Left")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;U-Turn Left")
    run("exec.exe SETIND;CUSTOMUTURNLEFT;ON")
    $direction= "U-Turn Left"
elseif $left1=16777215 and $left2=16777215 and $left3=12763842 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Left Turn")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Left Turn")
    run("exec.exe SETIND;CUSTOMLEFTTURN;ON")
    $direction= "Turn Left"
elseif $right1=16777215 and $right2=12961221 and $right3=16777215 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Right Turn")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Right Turn")
    run("exec.exe SETIND;CUSTOMRIGHTTURN;ON")
    $direction= "Turn Right"
elseif $bearlt1=16579836 and $bearlt2=16777215 and $bearlt3=14342874 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Bear Left")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Bear Left")
    run("exec.exe SETIND;CUSTOMBEARLEFT;ON")
    $direction= "Bear Left"
elseif $bearrt1=16777215 and $bearrt2=16777215 and $bearrt3=16579836 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Bear Right")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Bear Right")
    run("exec.exe SETIND;CUSTOMBEARRIGHT;ON")
    $direction= "Bear Right"
elseif $strlt1=16777215 and $strlt2=10329501 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Keep Straight Left")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Keep Straight Left")
    run("exec.exe SETIND;CUSTOMSTRAIGHTLEFT;ON")
    $direction= "Keep Straight Left"
elseif $strrt1=16777215 and $strrt2=11645361 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Keep Straight Right")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Keep Straight Right")
    run("exec.exe SETIND;CUSTOMSTRAIGHTRIGHT;ON")
    $direction= "Keep Straight Right"
elseif $str1=16185083 and $str2=7829358 and $str3=13750734 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Keep Straight")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Keep Straight")
    run("exec.exe SETIND;CUSTOMSTRAIGHT;ON")
    $direction= "Keep Straight"
elseif $roundrt1=7960950 and $roundrt2=16777215 and $roundrt3=13158598 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Right Around Circle")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Right Around Circle")
    run("exec.exe SETIND;CUSTOMROUNDRIGHT;ON")
    $direction= "Loop Round Right"
elseif $roundlt1=167747215 and $roundlt2=16777215 and $roundlt3=16777215 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Left Around Circle")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Left Around Circle")
    run("exec.exe SETIND;CUSTOMROUNDLEFT;ON")
    $direction= "Loop Round Left"
elseif $destination1=13959168 Then
    run("exec.exe SETIND;CUSTOMDESTINATION;ON")
    $direction= "Destination"
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Destination Ahead")
elseif $sharprt1=5987161 and $sharprt2=16777215 Then
    run("exec.exe SETIND;CUSTOMSHARPRIGHT;ON")
    $direction= "Sharp Right"
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Sharp Right")
elseif $sharplt1=16777215 and $sharplt2=9934743 Then
    run("exec.exe SETIND;CUSTOMSHARPLEFT;ON")
    $direction= "Sharp Left"
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Sharp Left")
        
ENDIF   
elseif $arrowmode=1 Then
if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Searching for Black Arrows")
$uturnrt1=PixelGetColor($offsetx,$offsety)
$uturnrt2=pixelgetcolor($offsetx,$offsety)
$uturnrt3=PixelGetColor($offsetx,$offsety)
$uturnlt1=PixelGetColor($boxstartx+30+$offsetx,$boxstarty+54+$offsety)
$uturnlt2=PixelGetColor($boxstartx+39+$offsetx,$boxstarty+68+$offsety)
$uturnlt3=pixelgetcolor($boxstartx+48+$offsetx,$boxstarty+23+$offsety)
$left1=pixelgetcolor($boxstartx+40+$offsetx,$boxstarty+29+$offsety)
$left2=PixelGetColor($boxstartx+25+$offsetx,$boxstarty+40+$offsety)
$left3=PixelGetColor($boxstartx+62+$offsetx,$boxstarty+67+$offsety)
$right1=PixelGetColor($boxstartx+57+$offsetx,$boxstarty+28+$offsety)
$right2=PixelGetColor($boxstartx+71+$offsetx,$boxstarty+38+$offsety)
$right3=PixelGetColor($boxstartx+57+$offsetx,$boxstarty+50+$offsety)
$bearlt1=PixelGetColor($boxstartx+30+$offsetx,$boxstarty+31+$offsety)
$bearlt2=PixelGetColor($boxstartx+48+$offsetx,$boxstarty+35+$offsety)
$bearlt3=PixelGetColor($boxstartx+59+$offsetx,$boxstarty+71+$offsety)
$bearrt1=PixelGetColor($boxstartx+66+$offsetx,$boxstarty+31+$offsety)
$bearrt2=PixelGetColor($boxstartx+63+$offsetx,$boxstarty+49+$offsety)
$bearrt3=PixelGetColor($boxstartx+38+$offsetx,$boxstarty+25+$offsety)
$strlt1=pixelgetcolor($boxstartx+51+$offsetx,$boxstarty+22+$offsety)
$strlt2=pixelgetcolor($boxstartx+26+$offsetx,$boxstarty+41+$offsety)
$strrt1=PixelGetColor($boxstartx+47+$offsetx,$boxstarty+22+$offsety)
$strrt2=PixelGetColor($boxstartx+70+$offsetx,$boxstarty+40+$offsety)
$str1=PixelGetColor($boxstartx+49+$offsetx,$boxstarty+22+$offsety)
$str2=PixelGetColor($boxstartx+60+$offsetx,$boxstarty+37+$offsety)
$str3=pixelgetcolor($boxstartx+48+$offsetx,$boxstarty+71+$offsety)
$roundrt1=pixelgetcolor($boxstartx+31+$offsetx,$boxstarty+31+$offsety)
$roundrt2=PixelGetColor($boxstartx+66+$offsetx,$boxstarty+36+$offsety)
$roundrt3=PixelGetColor($boxstartx+41+$offsetx,$boxstarty+37+$offsety)
$roundlt1=pixelgetcolor($offsetx,$offsety)
$roundlt2=PixelGetColor($offsetx,$offsety)
$roundlt3=pixelgetcolor($offsetx,$offsety)
$destination1=PixelGetColor($boxstartx+48+$offsetx,$boxstarty+57+$offsety)
$sharprt1=pixelgetcolor($boxstartx+63+$offsetx,$boxstarty+47+$offsety)
$sharprt2=pixelgetcolor($boxstartx+64+$offsetx,$boxstarty+47+$offsety)
$sharplt1=pixelgetcolor($boxstartx+33+$offsetx,$boxstarty+47+$offsety)
$sharplt2=pixelgetcolor($boxstartx+48+$offsetx,$boxstarty+59+$offsety)

;$guidancemode=pixelgetcolor(8+$offsetx,25+$offsety)
;if $guidancemode=16384 then 
;   if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"guidance mode loop starting")
;   while $guidancemode=16384
;       guidance_loop() 
;   WEnd
;   if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"guidance mode loop ended")
;   sleep(2000)
;   grabfunc()
;ENDIF
run("exec.exe SETIND;CUSTOMUTURNRIGHT;OFF||SETIND;CUSTOMUTURNLEFT;OFF||SETIND;CUSTOMBEARLEFT;OFF||SETIND;CUSTOMBEARRIGHT;OFF||SETIND;CUSTOMSTRAIGHTLEFT;OFF||SETIND;CUSTOMSTRAIGHTRIGHT;OFF||SETIND;CUSTOMROUNDLEFT;OFF||SETIND;CUSTOMROUNDRIGHT;OFF||SETIND;CUSTOMSTRAIGHT;OFF||SETIND;CUSTOMRIGHTTURN;OFF||SETIND;CUSTOMLEFTTURN;OFF||SETIND;CUSTOMSHARPRIGHT;OFF||SETIND;CUSTOMSHARPLEFT;OFF||SETLABEL;CUSTOMETA;||SETLABEL;CUSTOMREM;||SETLABEL;CUSTOMDISTANCETURN;||SETLABEL;CUSTOMINSTRUCTION;||SETVAR;IGINSTRUCTION;")
;msgbox(0,"TEST","indy is on!")
if $uturnrt1=4 and $uturnrt2=16777215 and $uturnrt3=16777215 then 
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"U-Turn Right")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;U-Turn Right")
    run("exec.exe SETIND;CUSTOMUTURNRIGHT;ON")
    $direction= "U-Turn Right"
elseif $uturnlt1=5853220 and $uturnlt2=0 and $uturnlt3=197380 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"U-Turn Left")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;U-Turn Left")
    run("exec.exe SETIND;CUSTOMUTURNLEFT;ON")
    $direction= "U-Turn Left"
elseif $left1=131587 and $left2=131587 and $left3=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Left Turn")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Left Turn")
    run("exec.exe SETIND;CUSTOMLEFTTURN;ON")
    $direction= "Turn Left"
elseif $right1=263172 and $right2=0 and $right3=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Right Turn")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Right Turn")
    run("exec.exe SETIND;CUSTOMRIGHTTURN;ON")
    $direction= "Turn Right"
elseif $bearlt1=5261348 and $bearlt2=395020 and $bearlt3=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Bear Left")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Bear Left")
    run("exec.exe SETIND;CUSTOMBEARLEFT;ON")
    $direction= "Bear Left"
elseif $bearrt1=8219933 and $bearrt2=0 and $bearrt3=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Bear Right")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Bear Right")
    run("exec.exe SETIND;CUSTOMBEARRIGHT;ON")
    $direction= "Bear Right"
elseif $strlt1=461073 and $strlt2=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Keep Straight Left")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Keep Straight Left")
    run("exec.exe SETIND;CUSTOMSTRAIGHTLEFT;ON")
    $direction= "Keep Straight Left"
elseif $strrt1=6445092 and $strrt2=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Keep Straight Right")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Keep Straight Right")
    run("exec.exe SETIND;CUSTOMSTRAIGHTRIGHT;ON")
    $direction= "Keep Straight Right"
elseif $str1=461073 and $str2=197637 and $str3=0 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Keep Straight")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Keep Straight")
    run("exec.exe SETIND;CUSTOMSTRAIGHT;ON")
    $direction= "Keep Straight"
elseif $roundrt1=0 and $roundrt2=65793 and $roundrt3=2959641 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Right Around Circle")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Right Around Circle")
    run("exec.exe SETIND;CUSTOMROUNDRIGHT;ON")
    $direction= "Loop Round Right"
elseif $roundlt1=167747215 and $roundlt2=16777215 and $roundlt3=16777215 Then
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Left Around Circle")
;run("C:\program Files\road runner\exec.exe MENU;turnbox.skin||SETLABEL;!turn;Left Around Circle")
    run("exec.exe SETIND;CUSTOMROUNDLEFT;ON")
    $direction= "Loop Round Left"
elseif $destination1=14026760 Then
    run("exec.exe SETIND;CUSTOMDESTINATION;ON")
    $direction= "Destination"
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Destination Ahead")
elseif $sharprt1=0 and $sharprt2=197380 Then
    run("exec.exe SETIND;CUSTOMSHARPRIGHT;ON")
    $direction= "Sharp Right"
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Sharp Right")
elseif $sharplt1=197380 and $sharplt2=11375379 Then
    run("exec.exe SETIND;CUSTOMSHARPLEFT;ON")
    $direction= "Sharp Left"
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Sharp Left")
        
ENDIF
endif

if $numreader=1 then 
    if $smoothfont="true" then
        $distancetob4=_OCRSMOOTH(100+$offsetx,63+$offsety,233+$offsetx,98+$offsety)
    Else
        $distancetob4=_OCR(100+$offsetx,63+$offsety,233+$offsetx,98+$offsety)
    EndIf
    if stringinstr($distancetob4,".") Then
        $distanceto = $distancetob4&" Miles"
    Else
        $distanceto = $distancetob4&" Feet"
    ENDIF
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Distance to Turn is "&$distanceto)
    run("exec.exe SETLABEL;CUSTOMDISTANCETURN;"&$distanceto)
    run("exec.exe SETLABEL;CUSTOMINSTRUCTION;"&$direction&" in "&$distanceto)
    run("exec.exe SETVAR;IGINSTRUCTION;="&$direction&" in "&$distanceto)
    
;msgbox(0,"TEST",$distanceto)
    if $smoothfont="true" then
        $remb4=_OCRWHITESMOOTH($etaboxwhitepix[0]+5+$boxwidth, $etaboxwhitepix[1]+3, $etaboxwhitepix[0]+5+$boxwidth+$boxwidth, $etaboxwhitepix[1]+35)
        if @error then 
            if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Read Time Remaining.  Closing program")   
            exit
        EndIf
    Else
        $remb4=_OCRWHITE($etaboxwhitepix[0]+5+$boxwidth, $etaboxwhitepix[1]+3, $etaboxwhitepix[0]+5+$boxwidth+$boxwidth, $etaboxwhitepix[1]+35)
        if @error then 
            if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Read Time Remaining.  Closing program")   
            exit
        EndIf
    endif
;msgbox(0,"TEST",$remb4)
    if stringinstr($remb4,".")Then $remb4=stringreplace($remb4,".","")
    $remcount=stringlen($remb4)
    $remsplit=stringreplace($remb4,".","")
    $remsplit=stringsplit($remsplit,"")
    $rem=$remsplit[1]&$remsplit[2]&":"&$remsplit[3]&$remsplit[4]
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Time Remaining is "&$rem)
    Run("exec.exe SETLABEL;CUSTOMREM;"&$REM)
;msgbox(0,"rem", $rem)
    if $smoothfont="true" then
        $etab4=_OCRWHITESMOOTH($etaboxwhitepix[0]+5, $etaboxwhitepix[1]+3, $etaboxwhitepix[0]+5+$boxwidth, $etaboxwhitepix[1]+35)
        if @error then 
            if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Read Estimated Time Remaining.  Closing program") 
            exit
        EndIf
    Else
        $etab4=_OCRWHITE($etaboxwhitepix[0]+5, $etaboxwhitepix[1]+3, $etaboxwhitepix[0]+5+$boxwidth, $etaboxwhitepix[1]+35)
        if @error then 
            if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Cannot Read Estimated Time Remaining.  Closing program") 
            exit
        EndIf
    ENDIF
;msgbox(0,"test",$etab4)
    if stringinstr($etab4,".")Then $etab4=stringreplace($etab4,".","")
    $etasplit=StringSplit($etab4,"")
    $etacount=stringlen($etab4)
    if $etacount>5 then
        $eta=$etasplit[1]&$etasplit[2]&":"&$etasplit[3]&$etasplit[4]&" "&$etasplit[5]&$etasplit[6]
    else 
        $eta=$etasplit[1]&":"&$etasplit[2]&$etasplit[3]&" "&$etasplit[4]&$etasplit[5]
    endif
    $curhour=@HOUR
    if $curhour="00" Then
        $curhour="12"
    elseif $curhour="13" then
        $curhour="1"
    elseif $curhour="14" then
        $curhour="2"
    elseif $curhour="15" then
        $curhour="3"
    elseif $curhour="16" then
        $curhour="4"
    elseif $curhour="17" then
        $curhour="5"
    elseif $curhour="18" then
        $curhour="6"
    elseif $curhour="19" then
        $curhour="7"
    elseif $curhour="20" then
        $curhour="8"
    elseif $curhour="21" then
        $curhour="9"
    elseif $curhour="22" then
        $curhour="10"
    elseif $curhour="23" then
        $curhour="11"
    EndIf
;msgbox(0,"current hour", $curhour)
    if $remsplit[1]= 0 or 1 then
        if $remsplit[2]> 0 Then
            if $curhour= 10 or 11 or 12 Then
                $eta="1"&$eta
            Else
                $eta=$eta
            endif
        endif
    endif 
    run("exec.exe SETLABEL;CUSTOMETA;"&$eta)
    if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"ETA is "&$eta)
;MsgBox(0,"eta",$eta)
;$destb4=_OCRWHITE(405+$offsetx, 441+$offsety, 592+$offsetx, 470+$offsety)
;$deststrip=stringsplit($destb4,"")
;if $deststrip[1]="." then $destb4=stringtrimleft($destb4)
;if stringinstr($destb4,".") then 
;   $destb4=stringreplace($destb4,".","")
;   $havedot=True
;Else
;   $havedot=False
;ENDIF
;$destcount=stringlen($destb4)
;$destsplit=StringSplit($destb4,"")
;if $destcount=2 Then
;   if $havedot=true then
;       $dest=$destsplit[1]&"."&$destsplit[2]&" Miles"
;   Else
;       $dest=$destsplit[1]&$destsplit[2]&" Miles"
;   EndIf
;elseif $destcount=3 Then
;   if $havedot=true Then
;       $dest=$destsplit[1]&"."&$destsplit[2]&$destsplit[3]&" Miles"
;   Else
;       $dest=$destsplit[1]&$destsplit[2]&$destsplit[3]&" Feet"
;   endif
;ElseIf $destcount=4 Then
;   $dest=$destsplit[1]&$destsplit[2]&$destsplit[3]&$destsplit[4]&" Feet"
;endif
        
;msgbox(0,"DEST", $dest)
ENDIF
if stringinstr($cmdlineraw,"debug") then filewriteline("debug.txt", @mon&"/"&@mday&"/"&@YEAR&"@"&@hour&":"&@min&":"&@sec&"- "&"Capture Complete. Program Closing")
    
;sleep(20000)
;WEnd
; Message Handler
Func _GUIRegisterMsgProc($hWnd, $MsgID, $WParam, $LParam)
    If $MsgID = $WM_COPYDATA Then
; We Recived a WM_COPYDATA Message
; $LParam = Poiter to a COPYDATA Struct
        $vs_cds = DllStructCreate($StructDef_COPYDATA, $LParam)
; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct
        $vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3))

        $SciTECmdLen = DllStructGetData($vs_cds, 2)
        $cmd = StringLeft(DllStructGetData($vs_msg, 1), $SciTECmdLen)
; Display what we have recived
;msgbox(0,"TEST",$cmd)

    ElseIf $MsgID = $WM_CLOSE Then
; We Recived a WM_CLOSE Message
        Exit
    EndIf
EndFunc;==>_GUIRegisterMsgProc

Func Get_screen()
    Run("C:\Program Files\Road Runner\exec.exe REQUEST;Receiver;RRSCREEN")
    sleep(1000)
;msgbox(0,"REST",$cmd)
EndFunc

Func Get_skin()
    Run("C:\Program Files\Road Runner\exec.exe REQUEST;Receiver;RRSKIN")
    sleep(1000)
;msgbox(0,"REST",$cmd)
EndFunc

Func Get_ighwnd()
    Run("C:\Program Files\Road Runner\exec.exe REQUEST;Receiver;IGHWND")
    sleep(1000)
;msgbox(0,"REST",$cmd)
EndFunc 

Func close()
    $msg = $GUI_EVENT_CLOSE
EndFunc

Func left ()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]-1,$picPos[1])
    $leftcount= $leftcount+1
EndFunc

Func right()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]+1,$picPos[1])
    $rightcount= $rightcount+1
EndFunc

Func down()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]+1)
    $downcount= $downcount+1
EndFunc

Func up()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]-1)
    $upcount= $upcount+1
EndFunc

func enter()
    $setx= $leftcount-$rightcount
    $sety= $downcount-$upcount
    hotkeyset("{ENTER}")
    MsgBox(0,"iGaddon", "Xoffset should be " & $setx&", Yoffset should be "&$sety)
    msgbox(0,"iGaddon", "Click ok... then press ESC, then run the program in debug mode to check if arrow is found")
EndFunc

Func _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 
    

    $p = 1
    Dim $row[$width]
    For $xwidth = 0 To $width - 1
        
        For $xlength = 0 To $length - 1
            If $char[$xwidth][$xlength] = "202020" Then
                If $p = 1 Then
                    $div = $xwidth
                    $p += 2
                EndIf
                $x = $xwidth - $div
                $row[$x] +=1
                
            EndIf
            
        Next
    Next
;seriales the array
    
    Dim $result
    For $xwidth = 0 To $width - 1
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 5 And $row[$xwidth+2] = 5 And $row[$xwidth+3] = 5 And $row[$xwidth+4] = 5 Then
            $result &= "."
        EndIf
        
        If $row[$xwidth] = 11 And $row[$xwidth+1] = 17 And $row[$xwidth+2] = 21 And $row[$xwidth+3] = 23 And $row[$xwidth+4] = 23 And $row[$xwidth+5] = 12 And $row[$xwidth+6] = 10 And $row[$xwidth+7] = 8 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 10 And $row[$xwidth+10] = 12 And $row[$xwidth+11] = 23 And $row[$xwidth+12] = 23 And $row[$xwidth+13] = 21 And $row[$xwidth+14] = 17 And $row[$xwidth+15] = 11 Then
            $result &= "0"
        EndIf
        
        
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 4 And $row[$xwidth+3] = 4 And $row[$xwidth+4] = 5 And $row[$xwidth+5] = 4 And $row[$xwidth+6] = 24 And $row[$xwidth+7] = 25 And $row[$xwidth+8] = 25 And $row[$xwidth+9] = 25 And $row[$xwidth+10] = 25 Then
        $result &= "1"
        EndIf
        
    
        If $row[$xwidth] = 2 And $row[$xwidth+1] = 8 And $row[$xwidth+2] = 11 And $row[$xwidth+3] = 14 And $row[$xwidth+4] = 16 And $row[$xwidth+5] = 17 And $row[$xwidth+6] = 16 And $row[$xwidth+7] = 15 And $row[$xwidth+8] = 15 And $row[$xwidth+9] = 15 And $row[$xwidth+10] = 17 And $row[$xwidth+11] = 20 And $row[$xwidth+12] = 18 And $row[$xwidth+13] = 17 And $row[$xwidth+14] = 15 And $row[$xwidth+15] = 11 Then
            $result &= "2"
        EndIf
            
        
        If $row[$xwidth] = 2 And $row[$xwidth+1] = 7 And $row[$xwidth+2] = 10 And $row[$xwidth+3] = 13 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 13 And $row[$xwidth+6] = 10 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 20 And $row[$xwidth+11] = 23 And $row[$xwidth+12] = 22 And $row[$xwidth+13] = 18 And $row[$xwidth+14] = 13 And $row[$xwidth+15] = 6 Then
            $result &= "3"
        EndIf
        
            
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 6 And $row[$xwidth+2] = 8 And $row[$xwidth+3] = 9 And $row[$xwidth+4] = 11 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 11 And $row[$xwidth+7] = 11 And $row[$xwidth+8] = 11 And $row[$xwidth+9] = 11 And $row[$xwidth+10] = 25 And $row[$xwidth+11] = 25 And $row[$xwidth+12] = 25 And $row[$xwidth+13] = 25 And $row[$xwidth+14] = 25 And $row[$xwidth+15] = 4 And $row[$xwidth+16] = 4 And $row[$xwidth+17] = 4 Then
            $result &= "4"
        EndIf

        
        If $row[$xwidth] = 2 And $row[$xwidth+1] = 7 And $row[$xwidth+2] = 13 And $row[$xwidth+3] = 19 And $row[$xwidth+4] = 21 And $row[$xwidth+5] = 20 And $row[$xwidth+6] = 18 And $row[$xwidth+7] = 14 And $row[$xwidth+8] = 13 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 17 And $row[$xwidth+11] = 21 And $row[$xwidth+12] = 20 And $row[$xwidth+13] = 18 And $row[$xwidth+14] = 15 And $row[$xwidth+15] = 6 Then
            $result &= "5"
        EndIf
        
                
        If $row[$xwidth] = 11 And $row[$xwidth+1] = 17 And $row[$xwidth+2] = 19 And $row[$xwidth+3] = 21 And $row[$xwidth+4] = 23 And $row[$xwidth+5] = 14 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 13 And $row[$xwidth+10] = 18 And $row[$xwidth+11] = 21 And $row[$xwidth+12] = 20 And $row[$xwidth+13] = 17 And $row[$xwidth+14] = 13 And $row[$xwidth+15] = 6 Then
            $result &= "6"
        EndIf
        
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 5 And $row[$xwidth+2] = 5 And $row[$xwidth+3] = 10 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 16 And $row[$xwidth+6] = 18 And $row[$xwidth+7] = 20 And $row[$xwidth+8] = 17 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 13 And $row[$xwidth+11] = 11 And $row[$xwidth+12] = 9 And $row[$xwidth+13] = 7 And $row[$xwidth+14] = 6 And $row[$xwidth+15] = 5 Then
            $result &= "7"
        EndIf
        
                
        If $row[$xwidth] = 6 And $row[$xwidth+1] = 13 And $row[$xwidth+2] = 19 And $row[$xwidth+3] = 22 And $row[$xwidth+4] = 23 And $row[$xwidth+5] = 20 And $row[$xwidth+6] = 14 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 20 And $row[$xwidth+11] = 23 And $row[$xwidth+12] = 22 And $row[$xwidth+13] = 18 And $row[$xwidth+14] = 13 And $row[$xwidth+15] = 6 Then
            $result &= "8"
        EndIf
        
                
        If $row[$xwidth] = 6 And $row[$xwidth+1] = 13 And $row[$xwidth+2] = 17 And $row[$xwidth+3] = 20 And $row[$xwidth+4] = 21 And $row[$xwidth+5] = 18 And $row[$xwidth+6] = 13 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 12 And $row[$xwidth+10] = 14 And $row[$xwidth+11] = 23 And $row[$xwidth+12] = 21 And $row[$xwidth+13] = 19 And $row[$xwidth+14] = 17 And $row[$xwidth+15] = 11 Then
            $result &= "9"
        EndIf
        
        If $row[$xwidth] = 10 And $row[$xwidth+1] = 10 And $row[$xwidth+2] = 10 And $row[$xwidth+3] = 10 And $row[$xwidth+4] = 10 Then
            $result &= ":"
        EndIf
                
        
        
    Next
    
    Return $result

    EndFunc
    
Func _OCRSMOOTH($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 
    

    $p = 1
    Dim $row[$width]
    For $xwidth = 0 To $width - 1
        
        For $xlength = 0 To $length - 1
            If $char[$xwidth][$xlength] = "202020" Then
                If $p = 1 Then
                    $div = $xwidth
                    $p += 2
                EndIf
                $x = $xwidth - $div
                $row[$x] +=1
                
            EndIf
            
        Next
    Next
;seriales the array
    
    Dim $result
    For $xwidth = 0 To $width - 1
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 5 And $row[$xwidth+2] = 5 And $row[$xwidth+3] = 5 And $row[$xwidth+4] = 5 Then
            $result &= "."
        EndIf
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 15 And $row[$xwidth+2] = 19 And $row[$xwidth+3] = 21 And $row[$xwidth+4] = 23 And $row[$xwidth+5] = 8 And $row[$xwidth+6] = 6 And $row[$xwidth+7] = 8 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 6 And $row[$xwidth+10] = 8 And $row[$xwidth+11] = 23 And $row[$xwidth+12] = 21 And $row[$xwidth+13] = 19 And $row[$xwidth+14] = 15 And $row[$xwidth+15] = 5 Then
            $result &= "0"
        EndIf
        
        
        If $row[$xwidth] = 3 And $row[$xwidth+1] = 3 And $row[$xwidth+2] = 3 And $row[$xwidth+3] = 3 And $row[$xwidth+4] = 3 And $row[$xwidth+5] = 3 And $row[$xwidth+6] = 23 And $row[$xwidth+7] = 25 And $row[$xwidth+8] = 25 And $row[$xwidth+9] = 25 And $row[$xwidth+10] = 25 Then
        $result &= "1"
        EndIf
        
    
        If $row[$xwidth] = 1 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 8 And $row[$xwidth+3] = 12 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 16 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 13 And $row[$xwidth+8] = 13 And $row[$xwidth+9] = 13 And $row[$xwidth+10] = 12 And $row[$xwidth+11] = 18 And $row[$xwidth+12] = 18 And $row[$xwidth+13] = 15 And $row[$xwidth+14] = 13 And $row[$xwidth+15] = 7 Then
            $result &= "2"
        EndIf
            
        
        If $row[$xwidth] = 3 And $row[$xwidth+1] = 7 And $row[$xwidth+2] = 9 And $row[$xwidth+3] = 12 And $row[$xwidth+4] = 10 And $row[$xwidth+5] = 6 And $row[$xwidth+6] = 9 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 10 And $row[$xwidth+9] = 16 And $row[$xwidth+10] = 21 And $row[$xwidth+11] = 19 And $row[$xwidth+12] = 15 And $row[$xwidth+13] = 9 And $row[$xwidth+14] = 2 Then
            $result &= "3"
        EndIf
        
            
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 5 And $row[$xwidth+2] = 7 And $row[$xwidth+3] = 8 And $row[$xwidth+4] = 9 And $row[$xwidth+5] = 9 And $row[$xwidth+6] = 9 And $row[$xwidth+7] = 9 And $row[$xwidth+8] = 9 And $row[$xwidth+9] = 9 And $row[$xwidth+10] = 24 And $row[$xwidth+11] = 25 And $row[$xwidth+12] = 25 And $row[$xwidth+13] = 25 And $row[$xwidth+14] = 25 And $row[$xwidth+15] = 4 And $row[$xwidth+16] = 4 And $row[$xwidth+17] = 4 Then
            $result &= "4"
        EndIf

        
        If $row[$xwidth] = 3 And $row[$xwidth+1] = 8 And $row[$xwidth+2] = 14 And $row[$xwidth+3] = 20 And $row[$xwidth+4] = 17 And $row[$xwidth+5] = 15 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 20 And $row[$xwidth+11] = 19 And $row[$xwidth+12] = 17 And $row[$xwidth+13] = 13 And $row[$xwidth+14] = 3 Then
            $result &= "5"
        EndIf
        
                
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 14 And $row[$xwidth+2] = 17 And $row[$xwidth+3] = 21 And $row[$xwidth+4] = 18 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 9 And $row[$xwidth+7] = 11 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 10 And $row[$xwidth+10] = 13 And $row[$xwidth+11] = 19 And $row[$xwidth+12] = 16 And $row[$xwidth+13] = 13 And $row[$xwidth+14] = 8 And $row[$xwidth+15] = 2 Then
            $result &= "6"
        EndIf
        
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 5 And $row[$xwidth+2] = 5 And $row[$xwidth+3] = 7 And $row[$xwidth+4] = 12 And $row[$xwidth+5] = 15 And $row[$xwidth+6] = 17 And $row[$xwidth+7] = 19 And $row[$xwidth+8] = 14 And $row[$xwidth+9] = 11 And $row[$xwidth+10] = 11 And $row[$xwidth+11] = 10 And $row[$xwidth+12] = 8 And $row[$xwidth+13] = 6 And $row[$xwidth+14] = 5 And $row[$xwidth+15] = 4 Then
            $result &= "7"
        EndIf
        
                
        If $row[$xwidth] = 2 And $row[$xwidth+1] = 7 And $row[$xwidth+2] = 16 And $row[$xwidth+3] = 19 And $row[$xwidth+4] = 22 And $row[$xwidth+5] = 18 And $row[$xwidth+6] = 10 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 10 And $row[$xwidth+10] = 18 And $row[$xwidth+11] = 22 And $row[$xwidth+12] = 19 And $row[$xwidth+13] = 16 And $row[$xwidth+14] = 7 And $row[$xwidth+15] = 2 Then
            $result &= "8"
        EndIf
        
                
        If $row[$xwidth] = 2 And $row[$xwidth+1] = 8 And $row[$xwidth+2] = 13 And $row[$xwidth+3] = 16 And $row[$xwidth+4] = 19 And $row[$xwidth+5] = 13 And $row[$xwidth+6] = 11 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 11 And $row[$xwidth+9] = 9 And $row[$xwidth+10] = 11 And $row[$xwidth+11] = 18 And $row[$xwidth+12] = 21 And $row[$xwidth+13] = 17 And $row[$xwidth+14] = 14 And $row[$xwidth+15] = 5 Then
            $result &= "9"
        EndIf
        
        If $row[$xwidth] = 10 And $row[$xwidth+1] = 10 And $row[$xwidth+2] = 10 And $row[$xwidth+3] = 10 And $row[$xwidth+4] = 10 Then
            $result &= ":"
        EndIf
                
        
        
    Next
    
    Return $result

    EndFunc
    
Func _OCRWHITE($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 
    

    $p = 1
    Dim $row[$width]
    For $xwidth = 0 To $width - 1
        
        For $xlength = 0 To $length - 1
            If $char[$xwidth][$xlength] = "FFFFFF" Then
                If $p = 1 Then
                    $div = $xwidth
                    $p += 2
                EndIf
                $x = $xwidth - $div
                $row[$x] +=1
                
            EndIf
            
        Next
    Next
;seriales the array
    
    Dim $result
    For $xwidth = 0 To $width - 1
        
        
        If $row[$xwidth] = 10 And $row[$xwidth+1] = 16 And $row[$xwidth+2] = 18 And $row[$xwidth+3] = 20 And $row[$xwidth+4] = 12 And $row[$xwidth+5] = 8 And $row[$xwidth+6] = 8 And $row[$xwidth+7] = 8 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 12 And $row[$xwidth+10] = 20 And $row[$xwidth+11] = 18 And $row[$xwidth+12] = 16 And $row[$xwidth+13] = 10 Then
            $result &= "0"
        EndIf
        
        
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 4 And $row[$xwidth+3] = 4 And $row[$xwidth+4] = 5 And $row[$xwidth+5] = 5 And $row[$xwidth+6] = 22 And $row[$xwidth+7] = 22 And $row[$xwidth+8] = 22 And $row[$xwidth+9] = 22 Then
        $result &= "1"
        EndIf
        
    
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 9 And $row[$xwidth+2] = 12 And $row[$xwidth+3] = 13 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 13 And $row[$xwidth+6] = 13 And $row[$xwidth+7] = 13 And $row[$xwidth+8] = 13 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 16 And $row[$xwidth+11] = 15 And $row[$xwidth+12] = 13 And $row[$xwidth+13] = 9 Then
            $result &= "2"
        EndIf
            
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 9 And $row[$xwidth+2] = 11 And $row[$xwidth+3] = 12 And $row[$xwidth+4] = 10 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 11 And $row[$xwidth+7] = 11 And $row[$xwidth+8] = 13 And $row[$xwidth+9] = 17 And $row[$xwidth+10] = 19 And $row[$xwidth+11] = 16 And $row[$xwidth+12] = 12 And $row[$xwidth+13] = 5 Then
            $result &= "3"
        EndIf
        
            
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 6 And $row[$xwidth+2] = 8 And $row[$xwidth+3] = 9 And $row[$xwidth+4] = 9 And $row[$xwidth+5] = 9 And $row[$xwidth+6] = 10 And $row[$xwidth+7] = 9 And $row[$xwidth+8] = 9 And $row[$xwidth+9] = 22 And $row[$xwidth+10] = 22 And $row[$xwidth+11] = 22 And $row[$xwidth+12] = 22 And $row[$xwidth+13] = 4 And $row[$xwidth+14] = 4 And $row[$xwidth+15] = 4 Then
            $result &= "4"
        EndIf

        
        If $row[$xwidth] = 6 And $row[$xwidth+1] = 14 And $row[$xwidth+2] = 18 And $row[$xwidth+3] = 19 And $row[$xwidth+4] = 18 And $row[$xwidth+5] = 13 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 14 And $row[$xwidth+10] = 14 And $row[$xwidth+11] = 17 And $row[$xwidth+12] = 15 And $row[$xwidth+13] = 13 And $row[$xwidth+14] = 6 Then
            $result &= "5"
        EndIf
        
                
        If $row[$xwidth] = 10 And $row[$xwidth+1] = 15 And $row[$xwidth+2] = 18 And $row[$xwidth+3] = 20 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 13 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 15 And $row[$xwidth+10] = 17 And $row[$xwidth+11] = 17 And $row[$xwidth+12] = 14 And $row[$xwidth+13] = 8 Then
            $result &= "6"
        EndIf
        
        
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 4 And $row[$xwidth+3] = 9 And $row[$xwidth+4] = 12 And $row[$xwidth+5] = 15 And $row[$xwidth+6] = 17 And $row[$xwidth+7] = 14 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 10 And $row[$xwidth+10] = 8 And $row[$xwidth+11] = 6 And $row[$xwidth+12] = 5 And $row[$xwidth+13] = 4 Then
            $result &= "7"
        EndIf
        
                
        If $row[$xwidth] = 10 And $row[$xwidth+1] = 15 And $row[$xwidth+2] = 19 And $row[$xwidth+3] = 20 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 9 And $row[$xwidth+6] = 9 And $row[$xwidth+7] = 9 And $row[$xwidth+8] = 9 And $row[$xwidth+9] = 13 And $row[$xwidth+10] = 20 And $row[$xwidth+11] = 19 And $row[$xwidth+12] = 15 And $row[$xwidth+13] = 10 Then
            $result &= "8"
        EndIf
        
                
        If $row[$xwidth] = 8 And $row[$xwidth+1] = 14 And $row[$xwidth+2] = 17 And $row[$xwidth+3] = 18 And $row[$xwidth+4] = 15 And $row[$xwidth+5] = 12 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 13 And $row[$xwidth+9] = 13 And $row[$xwidth+10] = 20 And $row[$xwidth+11] = 18 And $row[$xwidth+12] = 16 And $row[$xwidth+13] = 11 Then
            $result &= "9"
        EndIf
        
;If $row[$xwidth] = 8 And $row[$xwidth+1] = 8 And $row[$xwidth+2] = 8 And $row[$xwidth+3] = 8 Then
;   $result &= ":"
;EndIf
                
        If $row[$xwidth] = 22 And $row[$xwidth+1] = 22 And $row[$xwidth+2] = 22 And $row[$xwidth+3] = 22 And $row[$xwidth+4] = 8 And $row[$xwidth+5] = 8 And $row[$xwidth+6] = 8 And $row[$xwidth+7] = 8 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 8 And $row[$xwidth+10] = 8 And $row[$xwidth+11] = 10 And $row[$xwidth+12] = 10 And $row[$xwidth+13] = 12 And $row[$xwidth+14] = 11 And $row[$xwidth+15] = 9 And $row[$xwidth+16] = 6 Then
            $result &= "P"
        EndIf
        
        If $row[$xwidth] = 22 And $row[$xwidth+1] = 22 And $row[$xwidth+2] = 22 And $row[$xwidth+3] = 22 And $row[$xwidth+4] = 5 And $row[$xwidth+5] = 9 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 13 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 10 And $row[$xwidth+10] = 5 And $row[$xwidth+11] = 10 And $row[$xwidth+12] = 12 And $row[$xwidth+13] = 13 And $row[$xwidth+14] = 12 And $row[$xwidth+15] = 9 And $row[$xwidth+16] = 5 And $row[$xwidth+17] = 22 And $row[$xwidth+18] = 22 And $row[$xwidth+19] = 22 And $row[$xwidth+20] = 22 Then
            $result &= "M"
        EndIf
        
        If $row[$xwidth] = 1 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 7 And $row[$xwidth+3] = 10 And $row[$xwidth+4] = 12 And $row[$xwidth+5] = 12 And $row[$xwidth+6] = 14 And $row[$xwidth+7] = 16 And $row[$xwidth+8] = 14 And $row[$xwidth+9] = 11 And $row[$xwidth+10] = 8 And $row[$xwidth+11] = 11 And $row[$xwidth+12] = 14 And $row[$xwidth+13] = 16 And $row[$xwidth+14] = 13 And $row[$xwidth+15] = 12 And $row[$xwidth+16] = 12 And $row[$xwidth+17] = 10 And $row[$xwidth+18] = 7 And $row[$xwidth+19] = 4 And $row[$xwidth+20] = 1 Then
            $result &= "A"
        EndIf
        
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 4 And $row[$xwidth+3] = 4 Then
            $result &= "."
        EndIf
        
        
    Next
    
    Return $result

    EndFunc
    
Func _OCRWHITESMOOTH($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 
    

    $p = 1
    Dim $row[$width]
    For $xwidth = 0 To $width - 1
        
        For $xlength = 0 To $length - 1
            If $char[$xwidth][$xlength] = "FFFFFF" Then
                If $p = 1 Then
                    $div = $xwidth
                    $p += 2
                EndIf
                $x = $xwidth - $div
                $row[$x] +=1
                
            EndIf
            
        Next
    Next
;seriales the array
    
    Dim $result
    For $xwidth = 0 To $width - 1
        
        
        If $row[$xwidth] = 5 And $row[$xwidth+1] = 14 And $row[$xwidth+2] = 16 And $row[$xwidth+3] = 18 And $row[$xwidth+4] = 8 And $row[$xwidth+5] = 6 And $row[$xwidth+6] = 8 And $row[$xwidth+7] = 8 And $row[$xwidth+8] = 6 And $row[$xwidth+9] = 8 And $row[$xwidth+10] = 18 And $row[$xwidth+11] = 16 And $row[$xwidth+12] = 14 And $row[$xwidth+13] = 4 Then
            $result &= "0"
        EndIf
        
        
        If $row[$xwidth] = 3 And $row[$xwidth+1] = 3 And $row[$xwidth+2] = 3 And $row[$xwidth+3] = 3 And $row[$xwidth+4] = 3 And $row[$xwidth+5] = 3 And $row[$xwidth+6] = 21 And $row[$xwidth+7] = 22 And $row[$xwidth+8] = 22 And $row[$xwidth+9] = 22 Then
        $result &= "1"
        EndIf
        
    
        If $row[$xwidth] = 6 And $row[$xwidth+1] = 9 And $row[$xwidth+2] = 12 And $row[$xwidth+3] = 10 And $row[$xwidth+4] = 11 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 11 And $row[$xwidth+7] = 10 And $row[$xwidth+8] = 11 And $row[$xwidth+9] = 16 And $row[$xwidth+10] = 13 And $row[$xwidth+11] = 11 And $row[$xwidth+12] = 6 Then
            $result &= "2"
        EndIf
            
        
        If $row[$xwidth] = 6 And $row[$xwidth+1] = 8 And $row[$xwidth+2] = 11 And $row[$xwidth+3] = 7 And $row[$xwidth+4] = 6 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 11 And $row[$xwidth+7] = 9 And $row[$xwidth+8] = 14 And $row[$xwidth+9] = 18 And $row[$xwidth+10] = 14 And $row[$xwidth+11] = 8 And $row[$xwidth+12] = 1 Then
            $result &= "3"
        EndIf
        
            
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 5 And $row[$xwidth+2] = 7 And $row[$xwidth+3] = 7 And $row[$xwidth+4] = 8 And $row[$xwidth+5] = 7 And $row[$xwidth+6] = 8 And $row[$xwidth+7] = 7 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 21 And $row[$xwidth+10] = 22 And $row[$xwidth+11] = 22 And $row[$xwidth+12] = 22 And $row[$xwidth+13] = 4 And $row[$xwidth+14] = 4 And $row[$xwidth+15] = 4 Then
            $result &= "4"
        EndIf

        
        If $row[$xwidth] = 8 And $row[$xwidth+1] = 16 And $row[$xwidth+2] = 17 And $row[$xwidth+3] = 13 And $row[$xwidth+4] = 10 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 10 And $row[$xwidth+9] = 12 And $row[$xwidth+10] = 15 And $row[$xwidth+11] = 14 And $row[$xwidth+12] = 11 And $row[$xwidth+13] = 2 Then
            $result &= "5"
        EndIf
        
                
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 13 And $row[$xwidth+2] = 16 And $row[$xwidth+3] = 16 And $row[$xwidth+4] = 10 And $row[$xwidth+5] = 9 And $row[$xwidth+6] = 10 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 11 And $row[$xwidth+9] = 9 And $row[$xwidth+10] = 17 And $row[$xwidth+11] = 13 And $row[$xwidth+12] = 10 And $row[$xwidth+13] = 2 Then
            $result &= "6"
        EndIf
        
        
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 4 And $row[$xwidth+3] = 6 And $row[$xwidth+4] = 11 And $row[$xwidth+5] = 14 And $row[$xwidth+6] = 16 And $row[$xwidth+7] = 11 And $row[$xwidth+8] = 10 And $row[$xwidth+9] = 8 And $row[$xwidth+10] = 7 And $row[$xwidth+11] = 5 And $row[$xwidth+12] = 4 And $row[$xwidth+13] = 3 Then
            $result &= "7"
        EndIf
        
                
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 11 And $row[$xwidth+2] = 15 And $row[$xwidth+3] = 19 And $row[$xwidth+4] = 8 And $row[$xwidth+5] = 7 And $row[$xwidth+6] = 9 And $row[$xwidth+7] = 9 And $row[$xwidth+8] = 7 And $row[$xwidth+9] = 9 And $row[$xwidth+10] = 19 And $row[$xwidth+11] = 15 And $row[$xwidth+12] = 12 And $row[$xwidth+13] = 4 Then
            $result &= "8"
        EndIf
        
                
        If $row[$xwidth] = 2 And $row[$xwidth+1] = 10 And $row[$xwidth+2] = 13 And $row[$xwidth+3] = 17 And $row[$xwidth+4] = 9 And $row[$xwidth+5] = 11 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 10 And $row[$xwidth+8] = 9 And $row[$xwidth+9] = 10 And $row[$xwidth+10] = 16 And $row[$xwidth+11] = 17 And $row[$xwidth+12] = 14 And $row[$xwidth+13] = 5 Then
            $result &= "9"
        EndIf
        
;If $row[$xwidth] = 8 And $row[$xwidth+1] = 8 And $row[$xwidth+2] = 8 And $row[$xwidth+3] = 8 Then
;   $result &= ":"
;EndIf
                
        If $row[$xwidth] = 22 And $row[$xwidth+1] = 22 And $row[$xwidth+2] = 22 And $row[$xwidth+3] = 22 And $row[$xwidth+4] = 8 And $row[$xwidth+5] = 8 And $row[$xwidth+6] = 8 And $row[$xwidth+7] = 8 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 8 And $row[$xwidth+10] = 7 And $row[$xwidth+11] = 6 And $row[$xwidth+12] = 8 And $row[$xwidth+13] = 11 And $row[$xwidth+14] = 10 And $row[$xwidth+15] = 8 And $row[$xwidth+16] = 2 Then
            $result &= "P"
        EndIf
        
        If $row[$xwidth] = 22 And $row[$xwidth+1] = 22 And $row[$xwidth+2] = 22 And $row[$xwidth+3] = 22 And $row[$xwidth+4] = 5 And $row[$xwidth+5] = 7 And $row[$xwidth+6] = 11 And $row[$xwidth+7] = 10 And $row[$xwidth+8] = 8 And $row[$xwidth+9] = 8 And $row[$xwidth+10] = 5 And $row[$xwidth+11] = 8 And $row[$xwidth+12] = 8 And $row[$xwidth+13] = 10 And $row[$xwidth+14] = 11 And $row[$xwidth+15] = 7 And $row[$xwidth+16] = 5 And $row[$xwidth+17] = 22 And $row[$xwidth+18] = 22 And $row[$xwidth+19] = 22 And $row[$xwidth+20] = 22 Then
            $result &= "M"
        EndIf
        
        If $row[$xwidth] = 3 And $row[$xwidth+1] = 6 And $row[$xwidth+2] = 9 And $row[$xwidth+3] = 9 And $row[$xwidth+4] = 9 And $row[$xwidth+5] = 12 And $row[$xwidth+6] = 13 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 9 And $row[$xwidth+9] = 8 And $row[$xwidth+10] = 9 And $row[$xwidth+11] = 12 And $row[$xwidth+12] = 13 And $row[$xwidth+13] = 12 And $row[$xwidth+14] = 9 And $row[$xwidth+15] = 9 And $row[$xwidth+16] = 9 And $row[$xwidth+17] = 6 And $row[$xwidth+18] = 3 Then
            $result &= "A"
        EndIf
        
        If $row[$xwidth] = 4 And $row[$xwidth+1] = 4 And $row[$xwidth+2] = 4 And $row[$xwidth+3] = 4 Then
            $result &= "."
        EndIf
        
        
    Next
    
    Return $result

    EndFunc

there's the code.... dirty i know but it does work as long as the number doesnt change while the ocr is checking the pixel columns. The problem occurs when the ocrwhitesmooth(or ocrwhite. same function just different definitions) function is working(declaring $rem or $eta), this function checks two different areas on the screen for the pixels. And my problem isnt that its exceeding the array... its that there ends up being one or more LESS in the array. Now i could fill those bits with false data but that would defeat the purpose of what i'm trying to do with the numbers once they're detected.

Edited by sonicxtacy02

Share this post


Link to post
Share on other sites

Good luck getting help with a 1,000+ line sample script.

Share this post


Link to post
Share on other sites

The forum crystal ball has been stolen. Nobody here can help without seeing some code.

I've got and I'm not giving it up. Its well hidden at the moment..... :P


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

close on error you ask, well my understanding of error is when u write a 1000+ line script and you screw up and dont debug it im sure when u run it , and theres an syntax error it will close itself :P

Share this post


Link to post
Share on other sites

You suggested i post the code and i posted the code. i could have posted a snippet or just the function but there's no flaw in the function itself (i didnt even write the function.. its one donated by another member of the forums... many people use it). But the fact remains that if i'm reading from a still shot the whole script works 100% of the time. There are no syntax errors and no errors regarding the array indexes. However... if i'm traveling down the road (thus making the eta and time remaining numbers change) i get this (or similar) error.

Posted Image

Share this post


Link to post
Share on other sites

...there's no flaw in the function itself (i didnt even write the function.. its one donated by another member of the forums... many people use it)...

By definition, if it crashes, it is flawed. There are plenty of posts with flawed code and plenty of people using that code as is. I've posted a lot of "flawed code" with little or no error checking. I left that to the person that needed the code.

...that said, you are probably not going to get what you asked for - i.e. a "native" way to have AutoIt exit when an error like that happens. You have a couple of choices. One has been pointed out several times: fix the code so that it can handle the data changing while the code is running... or have your code launch a second script that does nothing but watch for various "AutoIt error" windows, closes them and restarts your main script - if desired.

One thing that you could change that will speed up your script - remove all of the useless EndIf from "single line If statements".

Remarks

This version of the If statement is used to execute a single statement without the overhead of an EndIf.

If $row[$xwidth] = 10 And $row[$xwidth+1] = 15 And $row[$xwidth+2] = 18 And $row[$xwidth+3] = 20 And $row[$xwidth+4] = 13 And $row[$xwidth+5] = 13 And $row[$xwidth+6] = 12 And $row[$xwidth+7] = 12 And $row[$xwidth+8] = 12 And $row[$xwidth+9] = 15 And $row[$xwidth+10] = 17 And $row[$xwidth+11] = 17 And $row[$xwidth+12] = 14 And $row[$xwidth+13] = 8 Then $result &= "6"
...that is a single line If statement...

P.S. I do not know how to fix the flawed code or I would have posted a solution. I am confident that it can be done, because I have confidence in those that say it can be done. Make sense?


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

How about this: Have it check twice, compare that the results are the same, proceed. If results are different, recheck.

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