Leaderboard
Popular Content
Showing content with the highest reputation on 10/31/2024 in all areas
-
How to read or get list of array from sequence of hex?
pixelsearch and one other reacted to Nine for a topic
Ok. This is the unmodified version I have (it starts at first byte). Try it and if it works correctly, then you can adapt it to your needs (I'll help if needed). ; Assembly - Assembler - Comparaison #include <WinAPIDiag.au3> Opt("MustDeclareVars", True) Local $tFile1 = ReadBinaryFile('c:\apps\temp\example1.so') Local $tFile2 = ReadBinaryFile('c:\apps\temp\example2.so') Local $hInit = TimerInit() Local $tResult = CompareData($tFile1, $tFile2, 10000) ; make it large enough to receive results If @error Then Exit MsgBox($MB_OK, "Error", @error = 1 ? "Size not equal" : "Increase buffer size") Local $nResult = @extended, $pResult = DllStructGetPtr($tResult) ConsoleWrite("Time: " & TimerDiff($hInit) & " ms" & @CRLF) Local $tDiff For $i = 1 To $nResult $tDiff = DllStructCreate("align 1;byte b1;byte b2;dword idx;", $pResult) ConsoleWrite(Hex($tDiff.b1, 2) & @TAB & Hex($tDiff.b2, 2) & @TAB & Hex($tDiff.idx, 8) & @CRLF) $pResult += 6 Next Func CompareData(Const ByRef $tFile1, Const ByRef $tFile2, $iSize) If DllStructGetSize($tFile1) <> DllStructGetSize($tFile2) Then Return SetError(1) Local $tResult = DllStructCreate("byte data[" & $iSize & "]") Local $sCode = '0x8B7424048B7C24088B4C240C8B54241031DB8A068A2738E07412836C24140678158802886201895A0283C206434647E2E189D0C2140031C083E801C21400' Local $dCode = Binary($sCode) Local $iCodeSize = BinaryLen($dCode) Local $tBuffer = DllStructCreate('byte Code[' & $iCodeSize & ']') DllStructSetData($tBuffer, 'Code', $dCode) Local $aCall = DllCallAddress('int', DllStructGetPtr($tBuffer), 'ptr', DllStructGetPtr($tFile1), 'ptr', DllStructGetPtr($tFile2), _ 'int', DllStructGetSize($tFile1), 'ptr', DllStructGetPtr($tResult), 'int', $iSize) If $aCall[0] = -1 Then Return SetError(2) Local $iResult = ($aCall[0] - DllStructGetPtr($tResult)) / 6 Return SetExtended($iResult, $tResult) EndFunc ;==>CompareData Func ReadBinaryFile($sPath) Local $iSize = FileGetSize($sPath) Local $tFile = DllStructCreate("byte Data[" & $iSize & "]") Local $hFile = FileOpen($sPath, $FO_BINARY) $tFile.Data = FileRead($hFile) FileClose($hFile) Return $tFile EndFunc ;==>ReadBinaryFile #cs mov esi,DWORD PTR [esp+0x04] mov edi,DWORD PTR [esp+0x08] mov ecx,DWORD PTR [esp+0x0c] mov edx,DWORD PTR [esp+0x10] xor ebx,ebx l1: mov al,BYTE PTR [esi] mov ah,BYTE PTR [edi] cmp al,ah je l2 sub DWORD PTR [esp+0x14],6 js l3 mov BYTE PTR [edx],al mov BYTE PTR [edx+1],ah mov DWORD PTR [edx+2],ebx add edx,6 l2: inc ebx inc esi inc edi loop l1 mov eax,edx ret 20 l3: xor eax,eax sub eax,1 ret 20 #ce ps. it runs only x862 points -
according to Best_coding_practices Global $g_hGUI = GUICreate("ShowDevMainMenu", 220, 135) GUISetFont(13, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 1 BUTTONS Global $g_idSrcPath1a = GUICtrlCreateButton("Launch Audio Folder", 10, 10, 200, 25) Global $g_idSrcPath1b = GUICtrlCreateButton("Obtain Set Name", 10, 40, 200, 25) Global $g_idSrcPath1c = GUICtrlCreateButton("Obtain Audio Data Listing", 10, 70, 200, 25) Global $g_idSrcPath1d = GUICtrlCreateButton("Exit", 10, 100, 200, 25) maybe even a description made it easier to read Global $g_hGUI = GUICreate("ShowDevMainMenu", 220, 135) GUISetFont(13, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 1 BUTTONS Global $g_idBtn_LaunchAudioFolder = GUICtrlCreateButton("Launch Audio Folder", 10, 10, 200, 25) Global $g_idBtn_obtainSetName = GUICtrlCreateButton("Obtain Set Name", 10, 40, 200, 25) Global $g_idBtn_ObtainAudioData = GUICtrlCreateButton("Obtain Audio Data Listing", 10, 70, 200, 25) Global $g_idBtn_Exit = GUICtrlCreateButton("Exit", 10, 100, 200, 25)1 point
-
ioa747, You sated, "...normally all 👉 these are global, no matter what you call them local" ...and...any variable is in the main body outside the functions" Great points which I knew...but sadly, never considered! So, ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- hGUI = GUICreate("ShowDevMainMenu", 220, 135) GUISetFont(13, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 1 BUTTONS Global $_sSrcPath1a = GUICtrlCreateButton("Launch Audio Folder", 10, 10, 200, 25) Global $_sSrcPath1b = GUICtrlCreateButton("Obtain Set Name", 10, 40, 200, 25) Global $_sSrcPath1c = GUICtrlCreateButton("Obtain Audio Data Listing", 10, 70, 200, 25) Global $_sSrcPath1d = GUICtrlCreateButton("Exit", 10, 100, 200, 25)1 point
-
normally all 👉 these are global, no matter what you call them local any variable is in the main body outside the functions ; ----------------------------------------------- #include <File.au3> #include <FileConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- 👉 Local $hGUI = GUICreate("ShowDevMainMenu", 220, 135) GUISetFont(13, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 1 BUTTONS 👉 Local $_sSrcPath1a = GUICtrlCreateButton("Launch Audio Folder", 10, 10, 200, 25) 👉 Local $_sSrcPath1b = GUICtrlCreateButton("Obtain Set Name", 10, 40, 200, 25) 👉 Local $_sSrcPath1c = GUICtrlCreateButton("Obtain Audio Data Listing", 10, 70, 200, 25) 👉 Local $_sSrcPath1d = GUICtrlCreateButton("Exit", 10, 100, 200, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; ----------------------------------------------- Global $g_sSrcPath2 ; * <---- you can use a global variable While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $_sSrcPath1a _LaunchAudioFolder() Case $_sSrcPath1b _ObtainSetName() Case $_sSrcPath1c _ObtainAudioDataListing() Case $_sSrcPath1d _ExitMe() EndSwitch WEnd1 point
-
you can use a global variable somehow like that ; ----------------------------------------------- #include <File.au3> #include <FileConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Local $hGUI = GUICreate("ShowDevMainMenu", 220, 135) GUISetFont(13, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 1 BUTTONS Local $_sSrcPath1a = GUICtrlCreateButton("Launch Audio Folder", 10, 10, 200, 25) Local $_sSrcPath1b = GUICtrlCreateButton("Obtain Set Name", 10, 40, 200, 25) Local $_sSrcPath1c = GUICtrlCreateButton("Obtain Audio Data Listing", 10, 70, 200, 25) Local $_sSrcPath1d = GUICtrlCreateButton("Exit", 10, 100, 200, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; ----------------------------------------------- Global $g_sSrcPath2 ; * <---- you can use a global variable While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $_sSrcPath1a _LaunchAudioFolder() Case $_sSrcPath1b _ObtainSetName() Case $_sSrcPath1c _ObtainAudioDataListing() Case $_sSrcPath1d _ExitMe() EndSwitch WEnd ; ----------------------------------------------- Func _LaunchAudioFolder() ; Source Data Local $_sSrcPath = "F:\Audio" ; ----------------------------------------------- ShellExecute($_sSrcPath) ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($_sSrcPath, "", 195, 100, 550, 650) EndFunc ;==>_LaunchAudioFolder ; ----------------------------------------------- Func _ObtainSetName() ; Source data Local $_sSrcPath = InputBox("NOTICE!", "Enter Set Name...", "", "", 200, 130) ; ----------------- ; Destination data Local $_sDstPath1b = $_sSrcPath ; ----------------------------------------------- _RenameT1Folder($_sDstPath1b) EndFunc ;==>_ObtainSetName ;----------------------------------------------- Func _RenameT1Folder($_sDstPath1b) ; Source data Local $_sSrcPath = "F:\Audio\Masters\Type_1" ;---------------- ; Destination data Local $_sDstPath1a = "F:\Audio\Type_1" ;----------------------------------------------- DirCopy($_sSrcPath, $_sDstPath1a & "\" & $_sDstPath1b, $FC_OVERWRITE + $FC_CREATEPATH) ;----------------------------------------------- _LaunchFolder($_sDstPath1b) EndFunc ;==>_RenameT1Folder ;----------------------------------------------- Func _LaunchFolder($_sDstPath1b) ; Source Data Local $_sSrcPath = "F:\Audio\Type_1\" & $_sDstPath1b & "\wav" ; ----------------------------------------------- ShellExecute($_sSrcPath) ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($_sSrcPath, "", 1180, 100, 550, 650) ; ----------------------------------------------- #cs Instead of employing ClipPut($_sSrcPath), I want to pass $_sSrcPath2 to _ObtainAudioDataListing(). This would negate the need for [;Obtain path from user input] and the subsequent [$MyPath = InputBox] statement in that following script. How would this be accomplished? #ce ;~ ClipPut($_sSrcPath) $g_sSrcPath2 = $_sSrcPath EndFunc ;==>_LaunchFolder ; ----------------------------------------------- Func _ObtainAudioDataListing() ;~ Local $MyPath = "" Local $MyList = "" ;---------------- ; Obtain path from user input ;~ $MyPath = InputBox("NOTICE!", "Enter the complete .wav file path...", "", "", 200, 130) ; ----------------------------------------------- ; Assign $MyPath to $MyList and create the array $MyList = _FileListToArray($g_sSrcPath2) ; Create the data file _FileCreate($g_sSrcPath2 & "\FileListing.txt") ; Write the array to the data file _FileWriteFromArray($g_sSrcPath2 & "\FileListing.txt", $MyList) ; ----------------------------------------------- Local $_sSrcPath = $g_sSrcPath2 & "\FileListing.txt" _LaunchText($_sSrcPath) EndFunc ;==>_ObtainAudioDataListing ; ----------------------------------------------- Func _LaunchText($_sSrcPath) ; ----------------------------------------------- ShellExecute($_sSrcPath) ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($_sSrcPath, "", 1180, 100, 550, 650) EndFunc ;==>_LaunchText ; ----------------------------------------------- Func _ExitMe() Exit EndFunc ;==>_ExitMe ; -----------------------------------------------1 point
-
Hey mate, MediaPlayer is a winRT object (very early WinRT libraries here) , but it seems to work with a control used for UWP apps. So I'd say its unlikely this will work but I'll have a crack. We can certainly generate the MediaPlayer object, and the activation factory for the control: #include "..\Include\WinRT.au3" #include "..\Include\NameSpaces\Windows.Media.Playback.au3" #include "..\Include\NameSpaces\Windows.UI.Xaml.Controls.au3" _WinRT_Startup() Local $pCtrlFactory = _WinRT_GetActivationFactory("Windows.UI.Xaml.Controls.MediaPlayerElement", "{77E525C3-EB17-4B8D-889D-1EA8ABDBD4EF}") ConsoleWrite("Ctrl Factory: " & $pCtrlFactory & @CRLF & @CRLF) Local $pPlayer = _WinRT_ActivateInstance("Windows.Media.Playback.MediaPlayer") _WinRT_DisplayInterfaces($pPlayer) _WinRT_Shutdown() The console output: Ctrl Factory: 0x000002B7F0205958 (13,0) Supported Interfaces: Class: Windows.Media.Playback.MediaPlayer {381A83CB-6FFF-499B-8D64-2885DFC1249E} - IMediaPlayer {3C841218-2123-4FC5-9082-2F883F77BDF5} - IMediaPlayer2 {EE0660DA-031B-4FEB-BD9B-92E0A0A8D299} - IMediaPlayer3 {BD4F8897-1423-4C3E-82C5-0FB1AF94F715} - IMediaPlayerSource {82449B9F-7322-4C0B-B03B-3E69A48260C5} - IMediaPlayerSource2 {85A1DEDA-CAB6-4CC0-8BE3-6035F4DE2591} - IMediaPlayerEffects {FA419A79-1BBE-46C5-AE1F-8EE69FB3C2C7} - IMediaPlayerEffects2 {30D5A829-7FA4-4026-83BB-D75BAE4EA99E} - IClosable {00000038-0000-0000-C000-000000000046} {80035DB0-7448-4770-AFCF-2A57450914C5} - IMediaPlayer4 {CFE537FD-F86A-4446-BF4D-C8E792B7B4B3} - IMediaPlayer5 {E0CAA086-AE65-414C-B010-8BC55F00E692} - IMediaPlayer6 {5D1DC478-4500-4531-B3F4-777A71491F7F} - IMediaPlayer7 {FA993888-4383-415A-A930-DD472A8CF6F7} I haven't created libraries for Windows.UI.Xaml.Controls.X objects as of yet - (the generator skips over anything that doesn't directly extend "system.object"). I'll have a play over the weekend and report back if it yields anything.1 point
-
How to read or get list of array from sequence of hex?
HezzelQuartz reacted to Nine for a topic
Should, what about you try it. MAX_BINARYSIZE = 2,147,483,647 : Maximum bytes of binary data.1 point -
How to read or get list of array from sequence of hex?
HezzelQuartz reacted to pixelsearch for a topic
T This is because the binary string returned by FileRead starts with "0x" so f you want to start from 43, then you should indicate 5 as offset (last parameter in StringRegExp) to bypass "0xFF"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 -
AutoIt Snippets
robertocm reacted to argumentum for a topic
ConsoleWrite('--- ProcessStartDate: ' & ProcessStartDate('SciTE.exe') & @CRLF) ; --- ProcessStartDate: 2024/10/28 09:45:50 Func ProcessStartDate($sProcessOrPID, $iRet_tSYSTEMTIME = 0, $iLocalTime = 0) Local $aFT, $tFT, $tST, $iID = ProcessExists($sProcessOrPID) If $iID Then ; https://www.autoitscript.com/forum/index.php?showtopic=139260&view=findpost&p=1538034 $aFT = _WinAPI_GetProcessTimes($iID) If @error Or UBound($aFT) <> 3 Then Return SetError(@error, _WinAPI_GetLastError(), "GetProcessTimes FAILED") $tST = _Date_Time_FileTimeToSystemTime($iLocalTime ? _Date_Time_FileTimeToLocalFileTime($aFT[0]) : $aFT[0]) If $iRet_tSYSTEMTIME Then Return $tST Return _Date_Time_SystemTimeToDateTimeStr($tST, 1) EndIf Return SetError(11, 0, "Process does not exist") EndFunc ;==>ProcessStartDate I have a bunch of RDP running and wanted to identify which is which and thought of the Process date and PID, to know that the given process was from X connection because when it disconnects the popup window does not have any info. in regards to what disconnected ... , am working on it. And thought that the function was a good snippet to share.1 point -
Hi folks, Attached below is one way of attacking WinRT Objects. These are essentially COM objects, however they don't have an IDispatch interface so ObjCreate() cannot be used. It is possible to expose them using ObjCreateInterface though. Alternately, DllCallAddress() may be used to access an object's functions directly from memory. I'm using the latter mainly because that's the path I started down first! To make sense of whats in the attachment... WinRT.au3 - Core high level functions that sit on top of interface libraries Includes Async and Collection implementations etc. So basic high level functionality. WinRTCore.au3 - Internal helper functions for interface libraries Interface Folder - Interface libraries (there are over 850 of these!). Essentially these wrap the functions in an interface's vtable Includes tags which may be used with ObjCreateInterface Enums Folder - Contains map datatypes that can be used to convert enumeration strings to their numeric type, or vice versa Classes Folder - doesn't actually contain code - A class file includes interface and enum files that belong to a class. Namespaces Folder - doesn't actually contain code - A namespace file includes classes that are related. Bonus: I've also uploaded a rudimentary WinRT Class Explorer if it happens to be useful to anyone. Bonus2: I've added a tool that installs/removes calltips for interface libraries. Original post: WinRT Libraries - Latest ClassExplorer.zip1 point
-
Solution without accessing drive (except of running tesseract.exe). Whole operation is processed in memory. OCRScreenCaptureToText.au3 ;#Include <WinAPI.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> ;#include <WinAPIvkeysConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Memory.au3> #Region --- Deklarácie --- Global $sHotKeyEscFunction = "Terminate" Global Const $iMinInt32 = -2147483648 Local $hWndTaskManager = 0 #EndRegion --- Declarations --- #Region --- Program --- Opt('WinWaitDelay', 100) Opt('WinDetectHiddenText', 1) Opt('MouseCoordMode', 2) Opt("PixelCoordMode", 2) HotKeySet("{ESC}", $sHotKeyEscFunction) ;Press Esc to terminate script Send("^+{ESC}") ;ShellExecute("Taskmgr.exe") $hWndTaskManager = WinWait("[CLASS:#32770]") WinActivate("[CLASS:#32770]") Local $sOutput = OCRScreenCaptureToText($hWndTaskManager, $iMinInt32, $iMinInt32, $iMinInt32, $iMinInt32, "eng", True, @ScriptDir & "\image.PNG") If @error Then ErrorMsgBox(((@error = 3 And @extended = 1) ? "Stderr Read: " : "") & $sOutput & ' ' & @error & ' ' & @extended) Exit 3 EndIf MsgBox($MB_SYSTEMMODAL, "OCRScreenCaptureToText", $sOutput) #EndRegion --- Program --- #Region --- Functions --- Func Terminate() Exit 2 EndFunc Func ErrorMsgBox($text, $title = "Chyba") Return MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), $title, $text) EndFunc ;======================================================================================================================================================================================= ; Description: ; Function OCRScreenCaptureToText provide OCR converting part of the screen or specified window to text ; ; Parameters: ; $hWnd - If not zero then corresponding window relative coordinates are used instead of absolute screen coordinates ; $iLeft, $iTop, $iRight, $iBottom - Coordinates of region to capture (if $iMinInt32 is specified then limit value will be used) ; $lang - Languages used in texts; You can combinate it as you need (E.g. "eng+deu+fra+ita+spa+por"); List of LangCode is available here: https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html ; $bShowPreview - If True then preview window of the captured region is shown ; $sFileName - If not empty string then captured region is saved into the file; File extension must be the same as $sFormat constant ; ; Please note: ; First you have to install tesseract (https://github.com/UB-Mannheim/tesseract/wiki) ; You can find proper installer here: https://digi.bib.uni-mannheim.de/tesseract/ ; I used this one: tesseract-ocr-w64-setup-5.4.0.20240606.exe (64-bit) ; Complete documentation is here: https://tesseract-ocr.github.io/tessdoc/ ; To increase the OCR precision try to enlarge the captured image to at least 300 DPI and check another options here: https://tesseract-ocr.github.io/tessdoc/ImproveQuality.html ;======================================================================================================================================================================================= Func OCRScreenCaptureToText($hWnd = 0, $iLeft = $iMinInt32, $iTop = $iMinInt32, $iRight = $iMinInt32, $iBottom = $iMinInt32, $lang = "eng", $bShowPreview = False, $sFileName = "") ; Corrections of the coordinates If $hWnd = 0 Then If $iLeft = $iMinInt32 Or $iRight = $iMinInt32 Then Local $XVirtualScreen = _WinAPI_GetSystemMetrics($SM_XVIRTUALSCREEN) If $iLeft = $iMinInt32 Then $iLeft = $XVirtualScreen If $iRight = $iMinInt32 Then $iRight = $XVirtualScreen + _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN) EndIf If $iTop = $iMinInt32 Or $iBottom = $iMinInt32 Then Local $YVirtualScreen = _WinAPI_GetSystemMetrics($SM_YVIRTUALSCREEN) If $iTop = $iMinInt32 Then $iTop = $YVirtualScreen If $iBottom = $iMinInt32 Then $iBottom = $YVirtualScreen + _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN) EndIf $hWnd = _WinAPI_GetDesktopWindow() Else If $iLeft = $iMinInt32 Then $iLeft = 0 If $iTop = $iMinInt32 Then $iTop = 0 If $iRight = $iMinInt32 Or $iBottom = $iMinInt32 Then Local $aClientSize = WinGetClientSize($hWnd) If $iRight = $iMinInt32 Then $iRight = $aClientSize[0] If $iBottom = $iMinInt32 Then $iBottom = $aClientSize[1] EndIf EndIf If $iRight < $iLeft Then Return SetError(1, 0, "Right cannot be less than Left") If $iBottom < $iTop Then Return SetError(1, 1, "Bottom cannot be less than Top") ; Capture the screen Local $iWidth = $iRight - $iLeft Local $iHeight = $iBottom - $iTop Local $hDDC = _WinAPI_GetDC($hWnd) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDDC, $iWidth, $iHeight) Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) _WinAPI_SelectObject($hCDC, $hBitmap) _WinAPI_BitBlt($hCDC, 0, 0, $iWidth, $iHeight, $hDDC, $iLeft, $iTop, $SRCCOPY) ;normal colors ; _WinAPI_BitBlt($hCDC, 0, 0, $iWidth, $iHeight, $hDDC, $iLeft, $iTop, $NOTSRCCOPY) ;invert colors _WinAPI_DeleteDC($hCDC) _WinAPI_ReleaseDC($hWnd, $hDDC) ; Save the capture in memory as an image of specific format Local Const $sFormat = "PNG" _GDIPlus_Startup() ; Initialize GDI+ library If @error Then Return SetError(2, 0, "_GDIPlus_Startup() - failed") Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) ;convert GDI bitmap to GDI+ bitmap _WinAPI_DeleteObject($hBitmap) ;release GDI bitmap resource because not needed anymore ;convert to 4 BPP (it has good OCR results) Local $hImageClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, _GDIPlus_ImageGetWidth($hImage), _GDIPlus_ImageGetHeight($hImage), $GDIP_PXF04INDEXED) _GDIPlus_ImageDispose($hImage) $hImage = $hImageClone Switch $sFormat Case "BMP", "GIF", "JPG", "JPEG", "PNG", "TIF", "TIFF" Case Else Return SetError(2, 2, "Unsupported image format") EndSwitch Local $sCLSID = _GDIPlus_EncodersGetCLSID($sFormat) ;create CLSID for a JPG image file type If @error Then Return SetError(2, 3, "_GDIPlus_EncodersGetCLSID() - failed") Local $tGUID = _WinAPI_GUIDFromString($sCLSID) ;convert CLSID GUID to binary form and returns $tagGUID structure If @error Then Return SetError(2, 4, "_WinAPI_GUIDFromString() - failed") Local $tParams Switch $sFormat #comments-start Case "BMP" $tParams = 0 ; BMP format options: ; $GDIP_PXF01INDEXED = 0x00030101: 1 bpp, indexed ; $GDIP_PXF04INDEXED = 0x00030402: 4 bpp, indexed ; $GDIP_PXF08INDEXED = 0x00030803: 8 bpp, indexed ; $GDIP_PXF16GRAYSCALE = 0x00101004: 16 bpp, grayscale ; $GDIP_PXF16RGB555 = 0x00021005: 16 bpp; 5 bits for each RGB ; $GDIP_PXF16RGB565 = 0x00021006: 16 bpp; 5 bits red, 6 bits green, and 5 bits blue ; $GDIP_PXF16ARGB1555 = 0x00061007: 16 bpp; 1 bit for alpha and 5 bits for each RGB component ; $GDIP_PXF24RGB = 0x00021808: 24 bpp; 8 bits for each RGB ; $GDIP_PXF32RGB = 0x00022009: 32 bpp; 8 bits for each RGB. No alpha. ; $GDIP_PXF32ARGB = 0x0026200A: 32 bpp; 8 bits for each RGB and alpha ; $GDIP_PXF32PARGB = 0x000E200B: 32 bpp; 8 bits for each RGB and alpha, pre-mulitiplied ; $GDIP_PXF48RGB = 0x0010300C: 48 bpp; 16 bits for each RGB ; $GDIP_PXF64ARGB = 0x0034400D: 64 bpp; 16 bits for each RGB and alpha ; $GDIP_PXF64PARGB = 0x001A400E: 64 bpp; 16 bits for each RGB and alpha, pre-multiplied Local $hImageClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, _GDIPlus_ImageGetWidth($hImage), _GDIPlus_ImageGetHeight($hImage), $GDIP_PXF24RGB) _GDIPlus_ImageDispose($hImage) $hImage = $hImageClone #comments-end Case "JPG", "JPEG" $tParams = _GDIPlus_ParamInit(1) ;initialize an encoder parameter list and return $tagGDIPENCODERPARAMS structure Local $tData = DllStructCreate("int Quality") ;create struct to set JPG quality setting DllStructSetData($tData, "Quality", 100) ; Quality option 0-100 (0: lowest, 100: highest) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, DllStructGetPtr($tData)) ;add a value to an encoder parameter list Case "TIF", "TIFF" $tParams = _GDIPlus_ParamInit(2) ;initialize an encoder parameter list and return $tagGDIPENCODERPARAMS structure Local $tData = DllStructCreate("int ColorDepth;int Compression") ;create struct to set TIF quality setting ; TIFF color depth options: ; 24 ; 32 DllStructSetData($tData, "ColorDepth", 32) ; TIFF compression options: ; $GDIP_EVTCOMPRESSIONLZW = 2: LZW compression ; $GDIP_EVTCOMPRESSIONCCITT3 = 3: CCITT3 compression ; $GDIP_EVTCOMPRESSIONCCITT4 = 4: CCITT4 compression ; $GDIP_EVTCOMPRESSIONRLE = 5: RLE compression ; $GDIP_EVTCOMPRESSIONNONE = 6: No compression DllStructSetData($tData, "Compression", $GDIP_EVTCOMPRESSIONLZW) _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth")) ;add a value to an encoder parameter list _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression")) ;add a value to an encoder parameter list Case Else $tParams = 0 EndSwitch If $sFileName <> "" Then If StringUpper(__GDIPlus_ExtractFileExt($sFileName)) <> $sFormat Then Return SetError(1, 2, "File extension differ from image format") _GDIPlus_ImageSaveToFileEx($hImage, $sFileName, $sCLSID, IsDllStruct($tParams) ? $tParams : 0) ;save image as a file If @error Then Return SetError(1, 3, "_GDIPlus_ImageSaveToFileEx() - failed") EndIf Local $pStream = _WinAPI_CreateStreamOnHGlobal() ;create stream (http://msdn.microsoft.com/en-us/library/ms864401.aspx) If @error Then Return SetError(2, 5, "_WinAPI_CreateStreamOnHGlobal() - failed") _GDIPlus_ImageSaveToStream($hImage, $pStream, $tGUID, $tParams) ;save the formatted bitmap in memory If @error Then Return SetError(2, 6, "_GDIPlus_ImageSaveToStream() - failed") _GDIPlus_ImageDispose($hImage) If $bShowPreview Then Local $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X", $iLeft) DllStructSetData($tPoint, "Y", $iTop) _WinAPI_ClientToScreen($hWnd, $tPoint) Local $hWndPreview = GUICreate("Preview...", $iWidth, $iHeight, DllStructGetData($tPoint, "X") - _WinAPI_GetSystemMetrics($SM_CXFIXEDFRAME), DllStructGetData($tPoint, "Y") - _WinAPI_GetSystemMetrics($SM_CYFIXEDFRAME) - _WinAPI_GetSystemMetrics($SM_CYCAPTION)) If @error Then Return SetError(1, 4, "GUICreate() - failed") Local $hBitmapFromStream = _GDIPlus_BitmapCreateFromStream($pStream) ;create bitmap from a stream (here from the $sFormat in memory) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWndPreview) ;create a graphics object from a window handle HotKeySet("{ESC}") ;Press Esc to close the preview window GUISetState(@SW_SHOW) Do _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmapFromStream, 0, 0) ;display streamed image Until GUIGetMsg() = $GUI_EVENT_CLOSE HotKeySet("{ESC}", $sHotKeyEscFunction) ;Restore previous Esc functionality _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmapFromStream) GUIDelete($hWndPreview) EndIf Local $hMemory = _WinAPI_GetHGlobalFromStream($pStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(2, 7, "_WinAPI_GetHGlobalFromStream() - failed") Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(2, 8, "_MemGlobalSize() - failed") Local $tMemory = DllStructCreate("byte[" & $iMemSize & "]", _MemGlobalLock($hMemory)) Local $bData = DllStructGetData($tMemory, 1) _WinAPI_ReleaseStream($pStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) _GDIPlus_Shutdown() ; Shut down GDI+ library ; OCR converting of the image to text Local $TesseractExePath = @ProgramFilesDir & "\Tesseract-OCR\tesseract.exe" ;C:\Program Files (x86)\Tesseract-OCR\tesseract.exe If Not FileExists($TesseractExePath) Then $TesseractExePath = StringReplace($TesseractExePath, " (x86)", "") ;C:\Program Files\Tesseract-OCR\tesseract.exe If Not FileExists($TesseractExePath) Then Return SetError(3, 0, "The file 'tesseract.exe' not found") EndIf Local $iPID = Run('"' & $TesseractExePath & '" stdin stdout -l ' & $lang & ' --psm 6"', @ScriptDir, @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_CHILD, $STDOUT_CHILD)) StdinWrite($iPID, $bData) StdinWrite($iPID) ; Calling StdinWrite without a second parameter closes the stream. ProcessWaitClose($iPID) ; Wait until the process has closed using the PID returned by Run. Local $sOutput = '' If @error Then Do $sOutput &= StderrRead($iPID) ; Read the Stderr stream of the PID returned by Run Until @error StdioClose($iPID) Return SetError(3, 1, $sOutput) EndIf Do $sOutput &= StdoutRead($iPID) ; Read the Stdout stream of the PID returned by Run Until @error StdioClose($iPID) Return $sOutput EndFunc #EndRegion --- Functions ---1 point
-
GDI+ text stroke effects
argumentum reacted to UEZ for a topic
Try something like this here: ;coded by UEZ build 2016-12-31 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> _GDIPlus_Startup() Global $hBitmap_StrokeText = _GDIPlus_BitmapeCreateStrokeText("AutoIt", "Arial Black", 300, 0xF0035D8B, 0xFF41ABE1, 0xFFFFFFFF) Global $aDim = _GDIPlus_ImageGetDimension($hBitmap_StrokeText) Global $hGUI = GUICreate("GDI+ Stroke Text Example", $aDim[0], $aDim[1]) GUISetBkColor(0xFAFAFA) GUISetState() Global $hGfx = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_StrokeText, 0, 0, $aDim[0], $aDim[1]) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap_StrokeText) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch Until False Func _GDIPlus_BitmapeCreateStrokeText($sText, $sFont = "Arial Black", $fSize = 300.0, $iC1 = 0xFFFF0000, $iC2 = 0xFF00FF00, $iC3 = 0xFF0000FF, $fBlur = 20.0) Local Const $hPath = _GDIPlus_PathCreate() Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local Const $hFormat = _GDIPlus_StringFormatCreate() Local $tLayout = _GDIPlus_RectFCreate() _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $fSize, $hFormat) Local Const $aBounds = _GDIPlus_PathGetWorldBounds($hPath) Local $iW = $aBounds[2] * 3, $iH = $aBounds[3] * 3 Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsSetTextRenderingHint($hCanvas, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, 2) ;~ Local Const $hBrush = _GDIPlus_BrushCreateSolid($iC3) Local Const $hBrush = _GDIPlus_LineBrushCreate(0, 0, $aBounds[2] / 9, $aBounds[3] / 2, $iC3, 0xC8D8D8FF, 0) _GDIPlus_LineBrushSetSigmaBlend($hBrush, 0.1, 0.5) _GDIPlus_LineBrushSetGammaCorrection($hBrush, 1) Local Const $hPen = _GDIPlus_PenCreate() _GDIPlus_PenSetLineJoin($hPen, 2) _GDIPlus_PenSetColor($hPen, $iC1) Local Const $fBorder = $fSize / 5.5 _GDIPlus_PenSetWidth($hPen, $fBorder) _GDIPlus_PenSetAlignment($hPen, 0) _GDIPlus_GraphicsDrawPath($hCanvas, $hPath, $hPen) Local Const $hEffect = _GDIPlus_EffectCreateBlur($fBlur) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_PenSetColor($hPen, $iC2) _GDIPlus_PenSetWidth($hPen, $fSize / 10) _GDIPlus_PenSetAlignment($hPen, 0) _GDIPlus_GraphicsDrawPath($hCanvas, $hPath, $hPen) _GDIPlus_GraphicsFillPath($hCanvas, $hPath, $hBrush) Local Const $aPoints = _GDIPlus_PathGetLastPoint($hPath) Local Const $aBitmap_Cropped = _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, $aPoints[0] + 2 * $aBounds[0] + $fBorder, $aPoints[1] + 2 * $aBounds[1] + $fBorder, $GDIP_PXF32ARGB) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_EffectDispose($hEffect) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_PathDispose($hPath) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) Return $aBitmap_Cropped EndFunc ;==>_GDIPlus_BitmapeCreateStrokeText If you change the font then _GDIPlus_BitmapCloneArea (line 57) needs to be adjusted appropriately.1 point