Leaderboard
Popular Content
Showing content with the highest reputation on 11/04/2024 in all areas
-
Just uploaded SciTEx86.zip & SciTEx64.zip which contain the Latest SciTE 5.5.3 versions released 9 October 2024.3 points
-
from what I understand you want their names to make in the respective EdlFile ...but you know the final answer2 points
-
OCR from a small area
ioa747 and one other reacted to argumentum for a topic
Func _NumberFromPattern(ByRef $hBitmap, $X0, $Y0, $iAlphaColor = 4278255360) Local $a3[] = ["0,4", "6,9"] Local $a7[] = ["0,0", "13,0"] Local $a4[] = ["9,0", "0,9"] Local $aTemp, $aSplit, $iCount For $n = 0 To 9 $iCount = 0 $aTemp = Eval('a' & $n) If Not UBound($aTemp) Then ContinueLoop ; array for digit not declared For $i = 0 To UBound($aTemp) - 1 $aSplit = StringSplit($aTemp[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = $iAlphaColor Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return $n Next Return "" EndFunc ;==>_NumberFromPattern my contribution ?2 points -
Here my two cents. #include <GDIPlus.au3> Example() Func Example() _GDIPlus_Startup() ;initialize GDI+ Local Const $iWidth = 150, $iHeight = 150 Local $iColor = 0 Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\TestImage.png") Local $Y0 = 0 For $iY = 0 To $iHeight - 1 For $iX = 0 To $iWidth - 1 $iColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ;get current pixel color If $iColor = 4278255360 Then ;~ _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFFFF0000) ;~ ConsoleWrite($iX & "," & $iY & @CRLF) $Y0 = $iY ExitLoop 2 EndIf Next Next ;Find X Local $X0 = 0 For $iX = 0 To $iWidth - 1 For $iY = 0 To $iHeight - 1 $iColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ;get current pixel color If $iColor = 4278255360 Then ;~ _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFFFF0000) ;~ ConsoleWrite($iX & "," & $iY & @CRLF) $X0 = $iX ExitLoop 2 EndIf Next Next ;~ _GDIPlus_BitmapSetPixel($hBitmap, $X0, $Y0, 0xFFFF0000) ConsoleWrite("TOP CORNER TEXT: " & $X0 & "," & $Y0 & @CRLF) Local $iFieldSizePixel14 = 16 Local $sNumber = "" For $iX = $X0 To $iWidth - 1 Step $iFieldSizePixel14 $sNumber &= _NumberFromPattern($hBitmap, $iX, $Y0) Next ConsoleWrite("Number: " & $sNumber & @CRLF) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==>Example Func _NumberFromPattern(ByRef $hBitmap, $X0, $Y0) Local $a3[] = ["0,4", "6,9"] Local $a7[] = ["0,0", "13,0"] Local $a4[] = ["9,0", "0,9"] Local $aSplit = 0 Local $iCount = 0 For $i = 0 To UBound($a3) - 1 $aSplit = StringSplit($a3[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 3 $iCount = 0 For $i = 0 To UBound($a7) - 1 $aSplit = StringSplit($a7[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 7 $iCount = 0 For $i = 0 To UBound($a4) - 1 $aSplit = StringSplit($a4[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 4 Return "" EndFunc ;==>_NumberFromPattern Using the image from here. You just need to build the pattern for the other numbers and try to make them unique. Saludos2 points
-
Try this part (it's one of the first ones I did) which piece only does the delimitation of the number area (and not the recognition of the pattern) where the procedures are a bit more simplified and it goes step by step, so you can figure out what the procedures are doing. #AutoIt3Wrapper_UseX64=N #include <WinAPI.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <Array.au3> #include <File.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> $aTSR = _GetTotalScreenResolution() ConsoleWrite("before -> Total Screen Resolution: " & $aTSR[0] & " x " & $aTSR[1] & @CRLF) ; Initialization DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 $aTSR = _GetTotalScreenResolution() ConsoleWrite("after -> Total Screen Resolution: " & $aTSR[0] & " x " & $aTSR[1] & @CRLF) ConsoleWrite("Desktop: " & @DesktopWidth & "x" & @DesktopHeight & @CRLF) ConsoleWrite("" & @CRLF) Global $hDLL = DllOpen("user32.dll") HotKeySet("{END}", "_Main") ; * <- selection of outer area with margin HotKeySet("{ESC}", "_Exit") ;********************************** While 1 Switch GUIGetMsg() Case -3 ;$GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;********************************** _Exit() Func _Exit() DllClose($hDLL) Exit EndFunc ;==>_Exit Func _Main() ; Main Program Local $aArea = SelectArea() ; Define the area to scan Local $hColor = 0x00FF00 ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($aArea) ;_ArrayDisplay($aColorMap) ; set outer area manual ;_Test(61, 212, 287, 498) _Test($aArea[0], $aArea[1], $aArea[2], $aArea[3]) EndFunc ;==>_Main Func _Test($iLeft, $iTop, $iRight, $iBottom, $hColor = 0x00FF00) Local $aArea = [$iLeft, $iTop, $iRight, $iBottom] ; area to scan ; Capture the color map for the specified area Local $colorMap = CaptureAreaColorMap($aArea) ; _ArrayDisplay($colorMap) ; and then try to find digit positions Local $aNumArea = FindGreenBoundariesUsingColorMap($colorMap, $aArea, $hColor) ;Local $aNumArea = [$firstRow, $lastRow, $firstCol, $lastCol] Local $aMarkArea[4] = [$aArea[0] + $aNumArea[2], $aArea[1] + $aNumArea[0], _ $aNumArea[3] - $aNumArea[2] + 1, $aNumArea[1] - $aNumArea[0] + 1] DRC($aMarkArea, 0xFF0000, "Color_Gui") ConsoleWrite("$MarkArea: x=" & $aMarkArea[0] & ", y=" & $aMarkArea[1] & ", w=" & $aMarkArea[2] & ", h=" & $aMarkArea[3] & @CRLF) EndFunc ;==>_Test Func CaptureAreaColorMap($aArea) ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the screen area as a bitmap Local $hBitmap = _ScreenCapture_Capture("", $aArea[0], $aArea[1], $aArea[2], $aArea[3]) ; Convert the captured bitmap to a GDI+ bitmap Local $hGDIPlusBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) ; Get the width and height of the captured area Local $width = $aArea[2] - $aArea[0] Local $height = $aArea[3] - $aArea[1] ; Create an array to store color values Local $colorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hGDIPlusBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $colorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hGDIPlusBitmap) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() Return $colorMap EndFunc ;==>CaptureAreaColorMap Func FindGreenBoundariesUsingColorMap($colorMap, $aArea, $hColor = 0x00FF00) Local $width = UBound($colorMap, 1) Local $height = UBound($colorMap, 2) ConsoleWrite("$width=" & $width & ", $height=" & $height & @CRLF) Local $firstRow = -1, $lastRow = -1, $firstCol = -1, $lastCol = -1, $blockWidth = 0 ; Scan for the first row with green color For $y = 0 To $height - 1 For $x = 0 To $width - 1 If $colorMap[$x][$y] = $hColor Then $firstRow = $y ExitLoop 2 EndIf Next Next ; Scan for the last row with green color For $y = $height - 1 To 0 Step -1 For $x = 0 To $width - 1 If $colorMap[$x][$y] = $hColor Then $lastRow = $y ExitLoop 2 EndIf Next Next ; Scan for the first column with green color For $x = 0 To $width - 1 For $y = 0 To $height - 1 If $colorMap[$x][$y] = $hColor Then $firstCol = $x ExitLoop 2 EndIf Next Next ; Scan for the last column with green color For $x = $width - 1 To 0 Step -1 For $y = 0 To $height - 1 If $colorMap[$x][$y] = $hColor Then $lastCol = $x ExitLoop 2 EndIf Next Next ; find the width of block pixel For $x = $firstCol To $width - 1 For $y = $firstRow To $height - 1 If $colorMap[$x][$y] = $hColor Then For $w = $x To $width - 1 If $colorMap[$w][$y] = $hColor Then $blockWidth += 1 Else ExitLoop 3 EndIf Next EndIf Next Next $blockSize = $blockWidth / 2 ConsoleWrite("$blockSize=" & $blockSize & @CRLF) ; each number Display is a matrix of 14x20 Vpoint ; each Vpoint is a 3x3 pixel ; each number Display is 42x60 pixel ConsoleWrite("X:" & $aArea[0] & " Y:" & $aArea[1] & @CRLF) ConsoleWrite("Area firstRow:" & $firstRow & " lastRow:" & $lastRow & " firstCol:" & $firstCol & " lastCol:" & $lastCol & @CRLF) Local $aNumArea = [$firstRow, $lastRow, $firstCol, $lastCol] Return $aNumArea EndFunc ;==>FindGreenBoundariesUsingColorMap ;Original code by Larry. ;Edited by BrettF Func _GetTotalScreenResolution() Local $aRet[2] Local Const $SM_CXVIRTUALSCREEN = 78 Local Const $SM_VIRTUALHEIGHT = 79 $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_CXVIRTUALSCREEN) $aRet[0] = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $aRet[1] = $VirtualDesktopHeight[0] Return $aRet EndFunc ;==>_GetTotalScreenResolution ;-------------------------------------------------------------------------------------------------------------------------------- Func SelectArea() ; SelectArea Local $aRecPos[4], $aMPos[2], $tPos ;, $aTipPos[4], $iX, $iY Local $iDeskWidth, $iDeskHeight, $iDeskLeft, $iDeskTop Local $sDevice, $hMonitor, $sCurDevice, $aData, $Status = 0 ; make Capture gui $hGUICapture = GUICreate("Capture_gui", 1, 1, 1, 1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetBkColor("0xFFFF00", $hGUICapture) ; $COLOR_YELLOW WinSetTrans($hGUICapture, "", 50) ; make mouse block gui $block_gui = GUICreate("block_gui", 1, 1, 1, 1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) WinSetTrans($block_gui, "", 1) GUISetState(@SW_SHOW, $block_gui) GUISetCursor($MCID_CROSS, 1, $block_gui) Sleep(200) Local $iMaxLoop = 1200, $iCntLoop = 0 While Sleep(10) $iCntLoop += 1 If $iCntLoop = $iMaxLoop Then ExitLoop ; get mouse coordinates $tPos = _WinAPI_GetMousePos() $aMPos[0] = DllStructGetData($tPos, 1) $aMPos[1] = DllStructGetData($tPos, 2) ; get $hMonitor from previously defined Mouse coordinates $hMonitor = _WinAPI_MonitorFromPoint($tPos) ; get monitor $aData appropriate for previously defined coordinates $aData = _WinAPI_GetMonitorInfo($hMonitor) If Not @error Then $sDevice = $aData[3] $iDeskLeft = DllStructGetData($aData[0], 1) $iDeskTop = DllStructGetData($aData[0], 2) $iDeskWidth = DllStructGetData($aData[0], 3) $iDeskHeight = DllStructGetData($aData[0], 4) EndIf ;move the $block_gui to active monitor If $sCurDevice <> $sDevice Then $sCurDevice = $sDevice ;ConsoleWrite("- $sCurDevice=" & $sCurDevice & @CRLF) WinMove($block_gui, "", $iDeskLeft, $iDeskTop, $iDeskWidth, $iDeskHeight) EndIf ; whait Left_mouse_button _IsPressed If _IsPressed("01", $hDLL) Then $Status = 1 $aMPos = MouseGetPos() $aRecPos[0] = $aMPos[0] $aRecPos[1] = $aMPos[1] ; Wait until key is released. While _IsPressed("01", $hDLL) Sleep(50) $aMPos = MouseGetPos() $aRecPos[2] = $aMPos[0] $aRecPos[3] = $aMPos[1] ; show Capture gui GUISetState(@SW_SHOW, $hGUICapture) WinMove($hGUICapture, "", $aRecPos[0], $aRecPos[1], $aRecPos[2] - $aRecPos[0], $aRecPos[3] - $aRecPos[1]) WEnd ElseIf _IsPressed("1B", $hDLL) Then ;1B=ESC key - emergency exit GUIDelete($hGUICapture) GUIDelete($block_gui) Return SetError(1, 1, 0) EndIf If $Status = 1 Then ExitLoop WEnd GUIDelete($hGUICapture) GUIDelete($block_gui) ConsoleWrite("outer area: " & $aRecPos[0] & ";" & $aRecPos[1] & ";" & $aRecPos[2] + $aRecPos[0] & ";" & $aRecPos[3] + $aRecPos[1] & @CRLF) Return $aRecPos EndFunc ;==>SelectArea Func DRC($aArray, $color = 0xFFFF00, $sTitle = "Gui") Local $gGUI = GUICreate($sTitle, $aArray[2], $aArray[3], $aArray[0], $aArray[1], $WS_POPUP, $WS_EX_TRANSPARENT) GUISetBkColor($color) WinSetTrans($gGUI, '', 150) GUISetState(@SW_SHOW, $gGUI) Return $gGUI EndFunc ;==>DRC My console output before -> Total Screen Resolution: 3840 x 1341 after -> Total Screen Resolution: 5760 x 2160 Desktop: 1920x1080 outer area: 124;273;426;670 $width=178, $height=124 $blockSize=3 X:124 Y:273 Area firstRow:29 lastRow:88 firstCol:43 lastCol:123 $MarkArea: x=167, y=302, w=81, h=60 P.S.: upload some numbers to 100% like this to make the rest num patterns and some test2 points
-
Good day, In the following script: ; ----------------------------------------------- #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Global $g_T2SetName = "C" Global $g_T2SourceFolder = "F:\Audio\Type_2\wav" ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _CreateT2Data() ; ----------------------------------------------- Func _CreateT2Data() ; Ask the user if they want to create T2 data from .wav data Local $confirmCreate = MsgBox(4, "NOTICE!", "Create T2 Data from .wav data?") ; ------------------------------------------------------ If $confirmCreate = 6 Then ; If "Yes" is selected ; Prompt the user to select the source folder containing the .wav file data Local $sMessage = "Select .wav data..." ; ----------------------------------------------- ;Local $WorkingDir = "F:\Audio\Type_2\" & $g_T2SetName Local $sFileOpenDialog = FileOpenDialog($sMessage, "F:\Audio\Type_2\" & $g_T2SetName & "\", "Wave Data (*.wav;)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) ConsoleWrite("$sFileOpenDialog = " & $sFileOpenDialog & @CRLF) ; ----------------------------------------------- If @error Then MsgBox($MB_SYSTEMMODAL, "", "No .wav file(s) were selected.") ; ----------------------------------------------- FileChangeDir(@ScriptDir) Else FileChangeDir(@ScriptDir) ; ----------------------------------------------- $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) EndIf ; ------------------------------------------------------ ; Prompt the user to select the destination folder for the .edl file data Local $destMessage = "Select the Destination folder for the .edl file(s)..." Local $destFolder = FileSelectFolder($destMessage, "F:\Audio\Type_2") ; ----------------- If @error Then MsgBox($MB_ICONERROR, "Error", "No destination folder selected. Exiting.") Return EndIf ; ------------------------------------------------------ ; Store the list of .wav file data from the selected source folder Local $wavFiles = _FileListToArray($sFileOpenDialog, "*.wav", $FLTA_FILES) ConsoleWrite("The selected source folder = " & $g_T2SourceFolder & @CRLF) ConsoleWrite("The selected source data = " & $wavFiles) ; ----------------- If @error Then MsgBox($MB_ICONERROR, "Error", "No .wav file(s) were selected.") Return EndIf ; ------------------------------------------------------ ; Specify the path to the master .edl file Local $masterEdlFile = "G:\Session_Master\Show\Session_Data\Type2.edl" ;"G:\Session_Master\Show\Session_Data\Type2.edl" ; ----------------- If Not FileExists($masterEdlFile) Then MsgBox($MB_ICONERROR, "Error", "The Type2.edl file was not found.") Return EndIf ; ------------------------------------------------------ ; Process each of the .wav file data and create corresponding .edl data file For $i = 1 To $wavFiles[0] Local $wavFileName = $wavFiles[$i] Local $wavBaseName = StringTrimRight($wavFileName, 4) ; Remove the ".wav" extension ; ----------------- ; Destination .edl file path for each .wav file Local $newEdlFile = $destFolder & "\" & $wavBaseName & ".edl" ; ----------------- ; Copy the master .edl file and rename it for each .wav file FileCopy($masterEdlFile, $newEdlFile, $FC_OVERWRITE) Next ; ----------------- ;FileDelete($destFolder & "\Type2.edl) ; ----------------- MsgBox($MB_ICONINFORMATION, "Success", "The .edl file(s) have been created successfully.") ; ----------------- ElseIf $confirmCreate = 7 Then MsgBox($MB_ICONINFORMATION, "Cancelled", "Operation cancelled by the user.") EndIf EndFunc ;==>_CreateT2Data ; ----------------------------------------------- ...the variable "$wavFiles" does not appear to be storing any data?!? Why? ; Store the list of .wav file data from the selected source folder Local $wavFiles = _FileListToArray($sFileOpenDialog, "*.wav", $FLTA_FILES) ConsoleWrite("The selected source folder = " & $g_T2SourceFolder & @CRLF) ConsoleWrite("The selected source data = " & $wavFiles) PS: I am completely stumped here!! Any assistance in this matter would be greatly appreciated!1 point
-
make a test #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GDIPlus.au3> #include <Array.au3> CaptureAreaColorMap(@ScriptDir & "\100num\152.png") Func CaptureAreaColorMap($sFileName) ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Display a message of whether the file exists or not. Local $iFileExists = FileExists($sFileName) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists." & @CRLF & "FileExist returned: " & $iFileExists) Else MsgBox($MB_SYSTEMMODAL, "", "The file doesn't exist." & @CRLF & "FileExist returned: " & $iFileExists) EndIf ; Capture the screen area as a bitmap Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFileName) ; Get the width and height of the captured area Local $width = _GDIPlus_ImageGetWidth($hBitmap) Local $height = _GDIPlus_ImageGetHeight($hBitmap) ConsoleWrite("Image: $width=" & $width & ", $height=" & $height & @CRLF) MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Image: $width=" & $width & ", $height=" & $height) ; Create an array to store color values Local $aColorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $aColorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() _ArrayDisplay( $aColorMap) EndFunc ;==>CaptureAreaColorMap1 point
-
this is for small numbers like I simplified the process as much as possible by removing the unnecessary stuff like the area selector. ; https://www.autoitscript.com/forum/topic/211521-ocr-from-a-small-area/?do=findComment&comment=1538057 ; Version: 4.0 #include <GDIPlus.au3> #include <Array.au3> #include <File.au3> Local $Result = _GetNumber(@ScriptDir & "\100num\152.png") MsgBox($MB_SYSTEMMODAL, "_GetNumber", $Result) ;~ Test(@ScriptDir & "\100num") ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetNumber($sFileName, $hColor = 0x00FF00) ; Main Program ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($sFileName) ;~ _ArrayDisplay($aColorMap) Local $Result = FindNumberUsingColorMap($aColorMap, $hColor) ;~ MsgBox($MB_SYSTEMMODAL, "$Result", $Result) Return $Result EndFunc ;==>_GetNumber ;-------------------------------------------------------------------------------------------------------------------------------- Func CaptureAreaColorMap($sFileName) ; create color map array ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the screen area as a bitmap Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFileName) ; Get the width and height of the captured area Local $width = _GDIPlus_ImageGetWidth($hBitmap) Local $height = _GDIPlus_ImageGetHeight($hBitmap) ;~ ConsoleWrite("Image: $width=" & $width & ", $height=" & $height & @CRLF) ; Create an array to store color values Local $aColorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $aColorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Return $aColorMap EndFunc ;==>CaptureAreaColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func FindNumberUsingColorMap($aColorMap, $hColor = 0x00FF00) ; find number in color map array Local $width = UBound($aColorMap, 1) Local $height = UBound($aColorMap, 2) Local $firstRow = -1, $lastRow = -1, $firstCol = -1, $lastCol = -1 ; Scan for the first and last rows and columns with $hColor pixels For $y = 0 To $height - 1 For $x = 0 To $width - 1 If $aColorMap[$x][$y] = $hColor Then If $firstRow = -1 Then $firstRow = $y $lastRow = $y If $firstCol = -1 Or $x < $firstCol Then $firstCol = $x If $lastCol = -1 Or $x > $lastCol Then $lastCol = $x EndIf Next Next If $firstRow = -1 Or $lastRow = -1 Or $firstCol = -1 Or $lastCol = -1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No color found" & @TAB & @TAB) Exit EndIf ; each number Display is a matrix of 14x20 pixels Local $numberWidth = 14 ; set number width per digit Local $numberSpace = 2 ; set Space between digits Local $Empty = 0, $Corection = 0 ; Corection for boundaries if 1st digit = 1 For $x = $firstCol To $lastCol - 1 If $aColorMap[$x][$firstRow] = 0x000000 Then $Empty += 1 If $Empty = 3 Then ;found 1st Space between digits $Corection = $firstCol - 1 - Abs($x - $numberWidth - $numberSpace) ExitLoop EndIf Else $Empty = 0 EndIf Next If $Corection > 0 Then $firstCol = $firstCol - $Corection Local $numberStart = $firstCol ;~ ConsoleWrite("$Corection=" & $Corection & @CRLF) ;~ ConsoleWrite("Display_boundaries firstRow:" & $firstRow & " lastRow:" & $lastRow & " firstCol:" & $firstCol & " lastCol:" & $lastCol & @CRLF) ;~ ConsoleWrite("" & @CRLF) Local $aNum[11][3] ; Define boundaries for each number position For $i = 1 To 10 $aNum[$i][0] = $numberStart $aNum[$i][1] = $numberStart + $numberWidth If $numberStart + $numberWidth + $numberSpace > $lastCol Then ExitLoop $numberStart += $numberWidth + $numberSpace $aNum[0][0] = $i + 1 Next Local $sNumber ; Generate patterns for each found number For $i = 1 To $aNum[0][0] Local $sPattern = "" For $y = $firstRow To $lastRow For $x = $aNum[$i][0] To $aNum[$i][1] - 1 If $aColorMap[$x][$y] = $hColor Then $sPattern &= "1" Else $sPattern &= "." EndIf Next $sPattern &= @CRLF Next $sNumber &= _GetPattern($sPattern) Next Return $sNumber EndFunc ;==>FindNumberUsingColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetPattern($sPattern) ; patterns for each digit ;~ ConsoleWrite("**************" & @CRLF & $sPattern & @CRLF) Local $aNumber[10] ; Define simplified patterns for each digit $aNumber[0] = "" ; Pattern for '0' $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11.......11.11" & @CRLF $aNumber[0] &= "11.......11.11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11....11....11" & @CRLF $aNumber[0] &= "11....11....11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11.11.......11" & @CRLF $aNumber[0] &= "11.11.......11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[1] = "" ; Pattern for '1' $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "...11.11......" & @CRLF $aNumber[1] &= "...11.11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "...11.11.11..." & @CRLF $aNumber[1] &= "...11.11.11..." & @CRLF $aNumber[2] = "" ; Pattern for '2' $aNumber[2] &= "...11.11.11..." & @CRLF $aNumber[2] &= "...11.11.11..." & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "11..........11" & @CRLF $aNumber[2] &= "11..........11" & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "............11" & @CRLF $aNumber[2] &= "............11" & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "......11.11..." & @CRLF $aNumber[2] &= "......11.11..." & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "...11........." & @CRLF $aNumber[2] &= "...11........." & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "11............" & @CRLF $aNumber[2] &= "11............" & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "11.11.11.11.11" & @CRLF $aNumber[2] &= "11.11.11.11.11" & @CRLF $aNumber[3] = "" ; Pattern for '3' $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "......11.11..." & @CRLF $aNumber[3] &= "......11.11..." & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[4] = "" ; Pattern for '4' $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "......11.11..." & @CRLF $aNumber[4] &= "......11.11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "...11....11..." & @CRLF $aNumber[4] &= "...11....11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "11.......11..." & @CRLF $aNumber[4] &= "11.......11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "11.11.11.11.11" & @CRLF $aNumber[4] &= "11.11.11.11.11" & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[5] = "" ; Pattern for '5' $aNumber[5] &= "11.11.11.11.11" & @CRLF $aNumber[5] &= "11.11.11.11.11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "11............" & @CRLF $aNumber[5] &= "11............" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "11.11.11.11..." & @CRLF $aNumber[5] &= "11.11.11.11..." & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "11..........11" & @CRLF $aNumber[5] &= "11..........11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "...11.11.11..." & @CRLF $aNumber[5] &= "...11.11.11..." & @CRLF $aNumber[6] = "" ; Pattern for '6' $aNumber[6] &= "......11.11..." & @CRLF $aNumber[6] &= "......11.11..." & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "...11........." & @CRLF $aNumber[6] &= "...11........." & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11............" & @CRLF $aNumber[6] &= "11............" & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11.11.11.11..." & @CRLF $aNumber[6] &= "11.11.11.11..." & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "...11.11.11..." & @CRLF $aNumber[6] &= "...11.11.11..." & @CRLF $aNumber[7] = "" ; Pattern for '7' $aNumber[7] &= "11.11.11.11.11" & @CRLF $aNumber[7] &= "11.11.11.11.11" & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "............11" & @CRLF $aNumber[7] &= "............11" & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= ".........11..." & @CRLF $aNumber[7] &= ".........11..." & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "......11......" & @CRLF $aNumber[7] &= "......11......" & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[8] = "" ; Pattern for '8' $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[9] = "" ; Pattern for '9' $aNumber[9] &= "...11.11.11..." & @CRLF $aNumber[9] &= "...11.11.11..." & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "...11.11.11.11" & @CRLF $aNumber[9] &= "...11.11.11.11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "............11" & @CRLF $aNumber[9] &= "............11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= ".........11..." & @CRLF $aNumber[9] &= ".........11..." & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "...11.11......" & @CRLF $aNumber[9] &= "...11.11......" & @CRLF Switch $sPattern Case $aNumber[0] Return 0 Case $aNumber[1] Return 1 Case $aNumber[2] Return 2 Case $aNumber[3] Return 3 Case $aNumber[4] Return 4 Case $aNumber[5] Return 5 Case $aNumber[6] Return 6 Case $aNumber[7] Return 7 Case $aNumber[8] Return 8 Case $aNumber[9] Return 9 Case Else Return SetError(1, 0, "") EndSwitch EndFunc ;==>_GetPattern ;-------------------------------------------------------------------------------------------------------------------------------- Func Test($sFilePath) ; _GetNumber for all the *.png files in $sFilePath directory ; List all the *.png files in $sFilePath directory Local $aFileList = _FileListToArray($sFilePath, "*.png", $FLTA_FILES) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No file(s) were found.") Exit EndIf _ArrayColInsert($aFileList, 1) ; add 1 column to hold the numbers For $i = 1 To $aFileList[0][0] $aFileList[$i][1] = _GetNumber($sFilePath & "\" & $aFileList[$i][0]) ; Rename a file using FileMove and overwrite the new file if it exists. ;~ FileMove($sFilePath & "\" & $aFileList[$i][0], $sFilePath & "\" & $aFileList[$i][1] & ".png", $FC_OVERWRITE) Next _ArrayDisplay($aFileList, "$aFileList") EndFunc ;==>Test ;--------------------------------------------------------------------------------------------------------------------------------1 point
-
OCR from a small area
ioa747 reacted to argumentum for a topic
...on the other page ! 😅 I didn't see it.1 point -
OCR from a small area
argumentum reacted to ioa747 for a topic
dezavu @argumentum take a look at the script above which was done for the big numbers1 point -
You would need to build some unique pattern. I've done things similar for for number before and worked perfectly. It is just a sample to handle it. but for sure it will work if you add a correct pattern for each number. Saludos1 point
-
the selected ones the pixel selection for 3 also grabs 0 and 8 the pixel selection for 7 also grabs 5 the pixel selection for 4 also grabs 0 and 6 and 8 (I think) what will happen when the first number is 1, which does not start from the beginning of the screen? I know this is a simple example I'm just adding difficulty parameters for consideration. (food for thought)1 point
-
AndrewG, WOW! Andrew...completely missed that one!! Thank you so very much! PS: I would still prefer the ability to manually select files however.1 point
-
Sorry, what help do you need ? (p.s. the code posted is not runable, it is missing an #include <GuiEdit.au3> ) if you need a predefined text in the input box, which disappears when you want to type something then it is the _GUICtrlEdit_SetCueBanner($inputBox,"Predefined text") #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GuiEdit.au3> ; Kh?i t?o GUI GUICreate("Demo Input", 300, 100) Global $inputBox = GUICtrlCreateInput("", 50, 30, 200, 20) Local $resetButton = GUICtrlCreateButton("Reset", 110, 60, 80, 25) ; Ðang ký s? ki?n cho ô nh?p li?u GUIRegisterMsg($WM_LBUTTONDOWN, "OnLButtonDown") ; Hi?n th? GUI GUISetState(@SW_SHOW) _GUICtrlEdit_SetCueBanner($inputBox,"Predefined text") GUICtrlSetState($resetButton, $GUI_FOCUS) ; Vòng l?p chính While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $resetButton ; When the Reset button is pressed, reset the content in the input box GUICtrlSetData ( $inputBox , "" ) EndSwitch WEnd GUIDelete() ; Hàm x? lý s? ki?n nh?p chu?t trái Func OnLButtonDown($hWnd, $Msg, $wParam, $lParam) ; Ki?m tra n?u ô nh?p li?u du?c nh?p vào If GUIGetCursorInfo($inputBox) = 1 Then GUICtrlSetState($inputBox, $GUI_FOCUS) GUICtrlSendMsg($inputBox, $EM_SETSEL, 0, -1) EndIf EndFunc1 point
-
mr-es335, Change the line; FileCopy($masterEdlFile, $newEdlFile, $FC_OVERWRITE) To FileCopy($masterEdlFile, $newEdlFile, $FC_NOOVERWRITE) Existing files will not be overwritten.1 point
-
OCR from a small area
Hashim reacted to argumentum for a topic
Thought that you needed to read the number without fail. That pixlesearch() can do that, 100% correct, every time, all the time. Or just plain fail. No wrong number, ever.1 point -
_FileListToArray ( $sFilePath [, $sFilter = "*" [, $iFlag = $FLTA_FILESFOLDERS [, $bReturnPath = False]]] ) or Local $wavFileName = $destFolder & "\" & $wavFiles[$i]1 point
-
Here my attempt on it (finally saw what you are seeing although it is quite lite on me) : #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> Opt("MustDeclareVars", True) HotKeySet("{ESC}", Terminate) Local $hMainGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) WinSetTrans($hMainGUI, "", 60) GUISetState() Local $hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) Local $nLeft = @DesktopWidth / 2 - 200, $nTop = @DesktopHeight / 2 - 200, $nWidth = 400, $nHeight = 400 Rect($hGUI, $nLeft, $nTop, $nWidth, $nHeight) GUISetBkColor(0x000000) GUISetState() Local $iMouseX, $iMouseY, $iMouseNewX, $iMouseNewY While True Switch GUIGetMsg() Case $GUI_EVENT_PRIMARYDOWN $iMouseX = MouseGetPos(0) $iMouseY = MouseGetPos(1) ; based on mouse pos you should decide what will be the drag type ; only done bottom - right (everywhere) GUISetCursor($MCID_SIZENWSE , $GUI_CURSOR_OVERRIDE, $hMainGUI) While _IsPressed('01') $iMouseNewX = MouseGetPos(0) $iMouseNewY = MouseGetPos(1) ;$nLeft = $iMouseNewX - $iMouseX + $nLeft ;$nTop = $iMouseNewY - $iMouseY + $nTop $nWidth = $iMouseNewX - $iMouseX + $nWidth $nHeight = $iMouseNewY - $iMouseY + $nHeight Rect($hGUI, $nLeft, $nTop, $nWidth, $nHeight) $iMouseX = $iMouseNewX $iMouseY = $iMouseNewY WEnd GUISetCursor() EndSwitch WEnd Func Rect($hWnd, $iX, $iY, $iWidth, $iHeight) Local $hMain = _WinAPI_CreateRectRgn(0, 0, 0, 0) Local $hMask = _WinAPI_CreateRectRgn($iX, $iY, $iX + $iWidth, $iY + $iHeight) _WinAPI_CombineRgn($hMain, $hMask, $hMain, $RGN_OR) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX + 5, $iY + 5, $iX + $iWidth - 5, $iY + $iHeight - 5) _WinAPI_CombineRgn($hMain, $hMain, $hMask, $RGN_DIFF) _WinAPI_DeleteObject($hMask) _WinAPI_SetWindowRgn($hWnd, $hMain) EndFunc ;==>Rect Func Terminate() Exit EndFunc ;==>Terminate As mentioned in the script I only done bottom right drag...1 point
-
OCR from a small area
Hashim reacted to argumentum for a topic
.. about PixelSearch() ? If the images are as crisp looking as the ones posted here, it should work 100%. Idea:1 point -
OCR from a small area
argumentum reacted to ioa747 for a topic
difficult pattern for OCR program but it has an easy pattern i played with it a bit here are the results #AutoIt3Wrapper_UseX64=N ;Update to Version: 2.0 #include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <Array.au3> #include <File.au3> #include <Misc.au3> Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info ; Initialization DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 Global $hDLL = DllOpen("user32.dll") HotKeySet("{END}", "_Main") ; * <- selection of outer area with margin HotKeySet("{ESC}", "_Exit") ;************************************************ While 1 Sleep(100) WEnd ;************************************************ ;-------------------------------------------------------------------------------------------------------------------------------- Func _Exit() DllClose($hDLL) Exit EndFunc ;==>_Exit ;-------------------------------------------------------------------------------------------------------------------------------- Func _Main() ; Main Program ; $aArea = [18, 181, 182, 434] Local $aArea = SelectArea() ; Define the area to scan Local $hColor = 0x00FF00 ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($aArea) ;_ArrayDisplay($aColorMap) Local $Result = FindNumberUsingColorMap($aColorMap, $hColor) MsgBox($MB_SYSTEMMODAL, "$Result", $Result) EndFunc ;==>_Main ;-------------------------------------------------------------------------------------------------------------------------------- Func CaptureAreaColorMap($aArea) ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the screen area as a bitmap Local $hBitmap = _ScreenCapture_Capture("", $aArea[0], $aArea[1], $aArea[2], $aArea[3]) ; Convert the captured bitmap to a GDI+ bitmap Local $hGDIPlusBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) ; Get the width and height of the captured area Local $width = $aArea[2] - $aArea[0] Local $height = $aArea[3] - $aArea[1] ; Create an array to store color values Local $aColorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hGDIPlusBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $aColorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hGDIPlusBitmap) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() Return $aColorMap EndFunc ;==>CaptureAreaColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func FindNumberUsingColorMap($aColorMap, $hColor = 0x00FF00) Local $width = UBound($aColorMap, 1) Local $height = UBound($aColorMap, 2) Local $firstRow = -1, $lastRow = -1, $firstCol = -1, $lastCol = -1, $blockWidth = 0 ; Scan for the first and last rows and columns with green pixels For $y = 0 To $height - 1 For $x = 0 To $width - 1 If $aColorMap[$x][$y] = $hColor Then If $firstRow = -1 Then $firstRow = $y $lastRow = $y If $firstCol = -1 Or $x < $firstCol Then $firstCol = $x If $lastCol = -1 Or $x > $lastCol Then $lastCol = $x EndIf Next Next If $firstRow = -1 Or $lastRow = -1 Or $firstCol = -1 Or $lastCol = -1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No color found" & @TAB & @TAB) Exit EndIf ; Calculate block size for one digit For $x = $firstCol To $width - 1 For $y = $firstRow To $height - 1 If $aColorMap[$x][$y] = $hColor Then For $w = $x To $width - 1 If $aColorMap[$w][$y] = $hColor Then $blockWidth += 1 Else ExitLoop 3 EndIf Next EndIf Next Next $blockSize = $blockWidth / 2 ; Adjust based on actual digit width Local $numberWidth = 14 * $blockSize ; Adjust based on number of columns per digit Local $numberSpace = 2 * $blockSize ; Space between digits Local $numberStart = $firstCol Local $aNum[11][3] ; Define boundaries for each number position For $i = 1 To 10 $aNum[$i][0] = $numberStart $aNum[$i][1] = $numberStart + $numberWidth If $numberStart + $numberWidth + $numberSpace > $lastCol Then ExitLoop $numberStart += $numberWidth + $numberSpace $aNum[0][0] = $i + 1 Next Local $sNumber ; Generate patterns for each found number For $i = 1 To $aNum[0][0] Local $sPattern = "" For $y = $firstRow To $lastRow For $x = $aNum[$i][0] To $aNum[$i][1] - 1 If $aColorMap[$x][$y] = $hColor Then $sPattern &= "1" Else $sPattern &= "." EndIf Next $sPattern &= @CRLF Next $sNumber &= _GetNumber($sPattern) Next ; each number Display is a matrix of 14x20 Vpoint ; each Vpoint is a 3x3 pixel ; each number Display is 42x60 pixel ConsoleWrite("Display_boundaries firstRow:" & $firstRow & " lastRow:" & $lastRow & " firstCol:" & $firstCol & " lastCol:" & $lastCol & @CRLF) Return $sNumber EndFunc ;==>FindNumberUsingColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetNumber($sPattern) ConsoleWrite("############### $sPattern ################" & @CRLF & $sPattern & @CRLF) Local $aNumber[10] ; Define simplified patterns for each digit $aNumber[0] = "" ; Pattern for '0' $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= "111111.....................111111...111111" & @CRLF $aNumber[0] &= "111111.....................111111...111111" & @CRLF $aNumber[0] &= "111111.....................111111...111111" & @CRLF $aNumber[0] &= "111111.....................111111...111111" & @CRLF $aNumber[0] &= "111111.....................111111...111111" & @CRLF $aNumber[0] &= "111111.....................111111...111111" & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= "111111............111111............111111" & @CRLF $aNumber[0] &= "111111............111111............111111" & @CRLF $aNumber[0] &= "111111............111111............111111" & @CRLF $aNumber[0] &= "111111............111111............111111" & @CRLF $aNumber[0] &= "111111............111111............111111" & @CRLF $aNumber[0] &= "111111............111111............111111" & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= "111111...111111.....................111111" & @CRLF $aNumber[0] &= "111111...111111.....................111111" & @CRLF $aNumber[0] &= "111111...111111.....................111111" & @CRLF $aNumber[0] &= "111111...111111.....................111111" & @CRLF $aNumber[0] &= "111111...111111.....................111111" & @CRLF $aNumber[0] &= "111111...111111.....................111111" & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= "111111..............................111111" & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........................................." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[0] &= ".........111111...111111...111111........." & @CRLF $aNumber[1] = "" ; Pattern for '1' $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........111111...111111.................." & @CRLF $aNumber[1] &= ".........111111...111111.................." & @CRLF $aNumber[1] &= ".........111111...111111.................." & @CRLF $aNumber[1] &= ".........111111...111111.................." & @CRLF $aNumber[1] &= ".........111111...111111.................." & @CRLF $aNumber[1] &= ".........111111...111111.................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= "..................111111.................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........................................." & @CRLF $aNumber[1] &= ".........111111...111111...111111........." & @CRLF $aNumber[1] &= ".........111111...111111...111111........." & @CRLF $aNumber[1] &= ".........111111...111111...111111........." & @CRLF $aNumber[1] &= ".........111111...111111...111111........." & @CRLF $aNumber[1] &= ".........111111...111111...111111........." & @CRLF $aNumber[1] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] = "" ; Pattern for '2' $aNumber[2] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] &= ".........111111...111111...111111........." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= "111111..............................111111" & @CRLF $aNumber[2] &= "111111..............................111111" & @CRLF $aNumber[2] &= "111111..............................111111" & @CRLF $aNumber[2] &= "111111..............................111111" & @CRLF $aNumber[2] &= "111111..............................111111" & @CRLF $aNumber[2] &= "111111..............................111111" & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= "....................................111111" & @CRLF $aNumber[2] &= "....................................111111" & @CRLF $aNumber[2] &= "....................................111111" & @CRLF $aNumber[2] &= "....................................111111" & @CRLF $aNumber[2] &= "....................................111111" & @CRLF $aNumber[2] &= "....................................111111" & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= "..................111111...111111........." & @CRLF $aNumber[2] &= "..................111111...111111........." & @CRLF $aNumber[2] &= "..................111111...111111........." & @CRLF $aNumber[2] &= "..................111111...111111........." & @CRLF $aNumber[2] &= "..................111111...111111........." & @CRLF $aNumber[2] &= "..................111111...111111........." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........111111..........................." & @CRLF $aNumber[2] &= ".........111111..........................." & @CRLF $aNumber[2] &= ".........111111..........................." & @CRLF $aNumber[2] &= ".........111111..........................." & @CRLF $aNumber[2] &= ".........111111..........................." & @CRLF $aNumber[2] &= ".........111111..........................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= "111111...................................." & @CRLF $aNumber[2] &= "111111...................................." & @CRLF $aNumber[2] &= "111111...................................." & @CRLF $aNumber[2] &= "111111...................................." & @CRLF $aNumber[2] &= "111111...................................." & @CRLF $aNumber[2] &= "111111...................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= ".........................................." & @CRLF $aNumber[2] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[2] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[2] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[2] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[2] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[2] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[3] = "" ; Pattern for '3' $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= "..................111111...111111........." & @CRLF $aNumber[3] &= "..................111111...111111........." & @CRLF $aNumber[3] &= "..................111111...111111........." & @CRLF $aNumber[3] &= "..................111111...111111........." & @CRLF $aNumber[3] &= "..................111111...111111........." & @CRLF $aNumber[3] &= "..................111111...111111........." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= "....................................111111" & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= "111111..............................111111" & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........................................." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[3] &= ".........111111...111111...111111........." & @CRLF $aNumber[4] = "" ; Pattern for '4' $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= "..................111111...111111........." & @CRLF $aNumber[4] &= "..................111111...111111........." & @CRLF $aNumber[4] &= "..................111111...111111........." & @CRLF $aNumber[4] &= "..................111111...111111........." & @CRLF $aNumber[4] &= "..................111111...111111........." & @CRLF $aNumber[4] &= "..................111111...111111........." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........111111............111111........." & @CRLF $aNumber[4] &= ".........111111............111111........." & @CRLF $aNumber[4] &= ".........111111............111111........." & @CRLF $aNumber[4] &= ".........111111............111111........." & @CRLF $aNumber[4] &= ".........111111............111111........." & @CRLF $aNumber[4] &= ".........111111............111111........." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= "111111.....................111111........." & @CRLF $aNumber[4] &= "111111.....................111111........." & @CRLF $aNumber[4] &= "111111.....................111111........." & @CRLF $aNumber[4] &= "111111.....................111111........." & @CRLF $aNumber[4] &= "111111.....................111111........." & @CRLF $aNumber[4] &= "111111.....................111111........." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[4] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[4] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[4] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[4] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[4] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= ".........................................." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[4] &= "...........................111111........." & @CRLF $aNumber[5] = "" ; Pattern for '5' $aNumber[5] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[5] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[5] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[5] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[5] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[5] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= "111111...................................." & @CRLF $aNumber[5] &= "111111...................................." & @CRLF $aNumber[5] &= "111111...................................." & @CRLF $aNumber[5] &= "111111...................................." & @CRLF $aNumber[5] &= "111111...................................." & @CRLF $aNumber[5] &= "111111...................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= "111111...111111...111111...111111........." & @CRLF $aNumber[5] &= "111111...111111...111111...111111........." & @CRLF $aNumber[5] &= "111111...111111...111111...111111........." & @CRLF $aNumber[5] &= "111111...111111...111111...111111........." & @CRLF $aNumber[5] &= "111111...111111...111111...111111........." & @CRLF $aNumber[5] &= "111111...111111...111111...111111........." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= "....................................111111" & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= "111111..............................111111" & @CRLF $aNumber[5] &= "111111..............................111111" & @CRLF $aNumber[5] &= "111111..............................111111" & @CRLF $aNumber[5] &= "111111..............................111111" & @CRLF $aNumber[5] &= "111111..............................111111" & @CRLF $aNumber[5] &= "111111..............................111111" & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........................................." & @CRLF $aNumber[5] &= ".........111111...111111...111111........." & @CRLF $aNumber[5] &= ".........111111...111111...111111........." & @CRLF $aNumber[5] &= ".........111111...111111...111111........." & @CRLF $aNumber[5] &= ".........111111...111111...111111........." & @CRLF $aNumber[5] &= ".........111111...111111...111111........." & @CRLF $aNumber[5] &= ".........111111...111111...111111........." & @CRLF $aNumber[6] = "" ; Pattern for '6' $aNumber[6] &= "..................111111...111111........." & @CRLF $aNumber[6] &= "..................111111...111111........." & @CRLF $aNumber[6] &= "..................111111...111111........." & @CRLF $aNumber[6] &= "..................111111...111111........." & @CRLF $aNumber[6] &= "..................111111...111111........." & @CRLF $aNumber[6] &= "..................111111...111111........." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........111111..........................." & @CRLF $aNumber[6] &= ".........111111..........................." & @CRLF $aNumber[6] &= ".........111111..........................." & @CRLF $aNumber[6] &= ".........111111..........................." & @CRLF $aNumber[6] &= ".........111111..........................." & @CRLF $aNumber[6] &= ".........111111..........................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= "111111...................................." & @CRLF $aNumber[6] &= "111111...................................." & @CRLF $aNumber[6] &= "111111...................................." & @CRLF $aNumber[6] &= "111111...................................." & @CRLF $aNumber[6] &= "111111...................................." & @CRLF $aNumber[6] &= "111111...................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= "111111...111111...111111...111111........." & @CRLF $aNumber[6] &= "111111...111111...111111...111111........." & @CRLF $aNumber[6] &= "111111...111111...111111...111111........." & @CRLF $aNumber[6] &= "111111...111111...111111...111111........." & @CRLF $aNumber[6] &= "111111...111111...111111...111111........." & @CRLF $aNumber[6] &= "111111...111111...111111...111111........." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= "111111..............................111111" & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........................................." & @CRLF $aNumber[6] &= ".........111111...111111...111111........." & @CRLF $aNumber[6] &= ".........111111...111111...111111........." & @CRLF $aNumber[6] &= ".........111111...111111...111111........." & @CRLF $aNumber[6] &= ".........111111...111111...111111........." & @CRLF $aNumber[6] &= ".........111111...111111...111111........." & @CRLF $aNumber[6] &= ".........111111...111111...111111........." & @CRLF $aNumber[7] = "" ; Pattern for '7' $aNumber[7] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[7] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[7] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[7] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[7] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[7] &= "111111...111111...111111...111111...111111" & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= "....................................111111" & @CRLF $aNumber[7] &= "....................................111111" & @CRLF $aNumber[7] &= "....................................111111" & @CRLF $aNumber[7] &= "....................................111111" & @CRLF $aNumber[7] &= "....................................111111" & @CRLF $aNumber[7] &= "....................................111111" & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= "...........................111111........." & @CRLF $aNumber[7] &= "...........................111111........." & @CRLF $aNumber[7] &= "...........................111111........." & @CRLF $aNumber[7] &= "...........................111111........." & @CRLF $aNumber[7] &= "...........................111111........." & @CRLF $aNumber[7] &= "...........................111111........." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= "..................111111.................." & @CRLF $aNumber[7] &= "..................111111.................." & @CRLF $aNumber[7] &= "..................111111.................." & @CRLF $aNumber[7] &= "..................111111.................." & @CRLF $aNumber[7] &= "..................111111.................." & @CRLF $aNumber[7] &= "..................111111.................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........................................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[7] &= ".........111111..........................." & @CRLF $aNumber[8] = "" ; Pattern for '8' $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= "111111..............................111111" & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........................................." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[8] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] = "" ; Pattern for '9' $aNumber[9] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] &= ".........111111...111111...111111........." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= "111111..............................111111" & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........111111...111111...111111...111111" & @CRLF $aNumber[9] &= ".........111111...111111...111111...111111" & @CRLF $aNumber[9] &= ".........111111...111111...111111...111111" & @CRLF $aNumber[9] &= ".........111111...111111...111111...111111" & @CRLF $aNumber[9] &= ".........111111...111111...111111...111111" & @CRLF $aNumber[9] &= ".........111111...111111...111111...111111" & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= "....................................111111" & @CRLF $aNumber[9] &= "....................................111111" & @CRLF $aNumber[9] &= "....................................111111" & @CRLF $aNumber[9] &= "....................................111111" & @CRLF $aNumber[9] &= "....................................111111" & @CRLF $aNumber[9] &= "....................................111111" & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= "...........................111111........." & @CRLF $aNumber[9] &= "...........................111111........." & @CRLF $aNumber[9] &= "...........................111111........." & @CRLF $aNumber[9] &= "...........................111111........." & @CRLF $aNumber[9] &= "...........................111111........." & @CRLF $aNumber[9] &= "...........................111111........." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........................................." & @CRLF $aNumber[9] &= ".........111111...111111.................." & @CRLF $aNumber[9] &= ".........111111...111111.................." & @CRLF $aNumber[9] &= ".........111111...111111.................." & @CRLF $aNumber[9] &= ".........111111...111111.................." & @CRLF $aNumber[9] &= ".........111111...111111.................." & @CRLF $aNumber[9] &= ".........111111...111111.................." & @CRLF Switch $sPattern Case $aNumber[0] Return 0 Case $aNumber[1] Return 1 Case $aNumber[2] Return 2 Case $aNumber[3] Return 3 Case $aNumber[4] Return 4 Case $aNumber[5] Return 5 Case $aNumber[6] Return 6 Case $aNumber[7] Return 7 Case $aNumber[8] Return 8 Case $aNumber[9] Return 9 Case Else Return SetError(1, 0, "") EndSwitch EndFunc ;==>_GetNumber ;-------------------------------------------------------------------------------------------------------------------------------- Func SelectArea() ; SelectArea Local $aRecPos[4], $aMPos[2], $tPos ;, $aTipPos[4], $iX, $iY Local $iDeskWidth, $iDeskHeight, $iDeskLeft, $iDeskTop Local $sDevice, $hMonitor, $sCurDevice, $aData, $Status = 0 ; make Capture gui $hGUICapture = GUICreate("Capture_gui", 1, 1, 1, 1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetBkColor("0xFFFF00", $hGUICapture) ; $COLOR_YELLOW WinSetTrans($hGUICapture, "", 50) ; make mouse block gui $block_gui = GUICreate("block_gui", 1, 1, 1, 1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) WinSetTrans($block_gui, "", 1) GUISetState(@SW_SHOW, $block_gui) GUISetCursor($MCID_CROSS, 1, $block_gui) Sleep(200) Local $iMaxLoop = 1200, $iCntLoop = 0 While Sleep(10) $iCntLoop += 1 If $iCntLoop = $iMaxLoop Then ExitLoop ; get mouse coordinates $tPos = _WinAPI_GetMousePos() $aMPos[0] = DllStructGetData($tPos, 1) $aMPos[1] = DllStructGetData($tPos, 2) ; get $hMonitor from previously defined Mouse coordinates $hMonitor = _WinAPI_MonitorFromPoint($tPos) ; get monitor $aData appropriate for previously defined coordinates $aData = _WinAPI_GetMonitorInfo($hMonitor) If Not @error Then $sDevice = $aData[3] $iDeskLeft = DllStructGetData($aData[0], 1) $iDeskTop = DllStructGetData($aData[0], 2) $iDeskWidth = DllStructGetData($aData[0], 3) $iDeskHeight = DllStructGetData($aData[0], 4) EndIf ;move the $block_gui to active monitor If $sCurDevice <> $sDevice Then $sCurDevice = $sDevice ;ConsoleWrite("- $sCurDevice=" & $sCurDevice & @CRLF) WinMove($block_gui, "", $iDeskLeft, $iDeskTop, $iDeskWidth, $iDeskHeight) EndIf ; whait Left_mouse_button _IsPressed If _IsPressed("01", $hDLL) Then $Status = 1 $aMPos = MouseGetPos() $aRecPos[0] = $aMPos[0] $aRecPos[1] = $aMPos[1] ; Wait until key is released. While _IsPressed("01", $hDLL) Sleep(50) $aMPos = MouseGetPos() $aRecPos[2] = $aMPos[0] $aRecPos[3] = $aMPos[1] ; show Capture gui GUISetState(@SW_SHOW, $hGUICapture) WinMove($hGUICapture, "", $aRecPos[0], $aRecPos[1], $aRecPos[2] - $aRecPos[0], $aRecPos[3] - $aRecPos[1]) WEnd ElseIf _IsPressed("1B", $hDLL) Then ;1B=ESC key - emergency exit GUIDelete($hGUICapture) GUIDelete($block_gui) Return SetError(1, 1, 0) EndIf If $Status = 1 Then ExitLoop WEnd GUIDelete($hGUICapture) GUIDelete($block_gui) ConsoleWrite("outer area: " &$aRecPos[0] & ";" & $aRecPos[1] & ";" & $aRecPos[2] + $aRecPos[0] & ";" & $aRecPos[3] + $aRecPos[1] & @CRLF) Return $aRecPos EndFunc ;==>SelectArea ;--------------------------------------------------------------------------------------------------------------------------------1 point