Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/08/2024 in all areas

  1. Check the findbmp code func GetImage on lockbits _GDIPlus_BitmapLockBits and search the forum on bitblt and lockbits. Probably (much) faster then getting the color per pixel with _GDIPlus_BitmapGetPixel($hBitmap, $x, $y) And rotating can help: Function _GDIPlus_ImageRotateFlip as you then have directly the pixels as sequence instead of calculating x,y and iterating x, y Func GetImage($BMPFile, byref $BMPDataStart, byref $Width, byRef $Height, byref $Stride, $imgBytes=3) local $Scan0, $pixelData, $hbScreen, $pBitmap, $pBitmapCap, $handle ; Load the bitmap to search in     If $BMPFile="SCREEN" Then         $hbScreen=_ScreenCapture_Capture("",0,0,-1,-1,False)         $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap     Else ;try to get a handle         $handle = WinGetHandle($BMPFile)         If @error Then ;Assume its an unknown handle so correct filename should be given             $pBitmap = _GDIPlus_BitmapCreateFromFile($BMPFile)         Else             $hbScreen=_ScreenCapture_CaptureWnd("",$handle,0,0,-1,-1,False)             $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap         EndIf     EndIf ;Get $tagGDIPBITMAPDATA structure ;~  ConsoleWrite("Bitmap Width:    " & _GDIPlus_ImageGetWidth($pBitmap) & @CRLF ) ;~  ConsoleWrite("Bitmap Height:      " & _GDIPlus_ImageGetHeight($pBitmap) & @CRLF) ;~  24 bits (3 bytes) or 16 bits (2 bytes) comparison     if ($imgBytes=2) then         $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF16RGB555) ;~      $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF32ARGB)     Else         $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB) ;~      $BitmapData= _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF32ARGB)     endIf     If @ERROR Then MsgBox(0,"","Error locking region " & @error)     $Stride = DllStructGetData($BitmapData, "Stride");Stride - Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.     $Width = DllStructGetData($BitmapData, "Width");Image width - Number of pixels in one scan line of the bitmap.     $Height = DllStructGetData($BitmapData, "Height");Image height - Number of scan lines in the bitmap.     $PixelFormat = DllStructGetData($BitmapData, "PixelFormat");Pixel format - Integer that specifies the pixel format of the bitmap     $Scan0 = DllStructGetData($BitmapData, "Scan0");Scan0 - Pointer to the first (index 0) scan line of the bitmap.     $pixelData = DllStructCreate("ubyte lData[" & (abs($Stride) * $Height-1) & "]", $Scan0)     $BMPDataStart = $BMPDataStart & DllStructGetData($pixeldata,"lData")     _GDIPlus_BitmapUnlockBits($pBitmap, $BitmapData)     _GDIPlus_ImageDispose ($pBitmap)     _WinAPI_DeleteObject ($pBitmap) EndFunc;==>GetImage
    2 points
  2. Great minds! I came up with the same ideas last night, I also modified your script to expect a bitmap so I can just pass the bitmap directly instead of capturing a bitmap then saving that to a file then converting that to a bitmap and then creating a bitmap from the file. That said it's actually not as fast an improvement as I thought it would be considering I'm not doing all that or saving a million files to the filesystem anymore. I see what you mean now by only capturing part of the pattern rather than all of it. It's a genius idea for anyone who needs it, but unless it saves a serious amount of time I probably won't implement it in my own script - I like the readability of the original bitmap ID script, it's much easier to understand what's going on with the digits and be able to modify it for another bitmap font if I ever need to do anything like this again 10 years from now when I have early onset dementia. Thanks for the laserlike focus, I appreciate it! It was a weird bug and definitely caused by something in the _GetCapture function, but probably just a system memory issue caused by the lack of disposal that Nines pointed out. Either way I've now managed to pass over 300,000 outputs in a single run (took about 12 hours) and I only interrupted it because I had to use my computer for something else, so I think it's safe to say the issue is solved. The only problem with it now is that my error handling doesn't appear to be working for the few hundred serial numbers where no output is recognised. I'm guessing these are because the script is now too fast for the application and needs a few sleep calls somewhere, and I'm fine with just adding those few hundred manually instead of slowing down the whole script - the problem is I have to use Bash/GNU tools to find them in the file instead of the images saving to Bitmap ID Failed like they should be. Error-handling is harder than it looks, I suppose. Here's the current script for anyone interested: #ce ---------------------------------------------------------------------------- #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPIFiles.au3> #include "Bitmap Digit Identifier.au3" ; https://www.autoitscript.com/forum/topic/211521-ocr-from-a-small-area/?do=findComment&comment=1538057 Run("Tool.exe"); Local $tool = WinWaitActive("Tool", "", 3) ControlClick($tool, "", "TTabSheet1", "primary", 1, 210, 50) ControlCommand($tool, "" , "TComboBox3" , "SelectString" , "Open") $db = FileOpen(@ScriptDir & "\tool-db.txt", 1) DirRemove ("Bitmap ID Failed", 1) DirCreate ("Bitmap ID Failed") _GDIPlus_Startup() For $loop = 0 To 999999 $serial = StringFormat('%06i', $loop) ControlSetText($tool, "", "TMaskEdit3", "S.N: 9" & $serial) ControlClick($tool, "", "TTabSheet3", "primary", 1, 69, 50) $hHBitmap = _ScreenCapture_Capture("", 792, 450, 927, 480) $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) Local $output = _GetNumber($hBitmap) If @error Then MsgBox(0, "Encountered fatal error", @error) ExitLoop EndIf If ((StringLen($output) <> 3) or not StringIsDigit($output)) Then _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Bitmap ID Failed\" & $serial & ".png") EndIf _WinAPI_DeleteObject($hHBitmap) _GDIPlus_BitmapDispose($hBitmap) FileWrite($db, $serial & "," & $output & @LF) Next _GDIPlus_Shutdown() FileClose($db) Exit
    2 points
  3. Good day, I would appreciate it someone who "glean" over this script to ensure that all looks "Okay!" [...indeed, if this be a reasonable request?" If not, I i will summarily remove the posting. The procedure: 1) Select one of four different types of Session "Sets". 2) Within these four different types Session "Sets" select the appropriate source wave file data. • This selected data is then "read" into memory • This read data will be employed to create "named copies" of one-of-four master data files 3) Select the destination folder for the named copies. 4) The memorized data is read and copies are made of one-of-the-four master data files Here is the script: ; ----------------------------------------------- ; With the assistance of...and the gratitude of...ioa747, AndrewG, and pixelsearch! ; Date: November 5th, 2024 ; ----------------------------------------------- #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $_MasterEdlFile = "" ; This global variable is always to be enabled!! Global $_sTypeSetName = "" ; Disable when any of the other variables are deployed ;Global $_sTypeSetName = "F:\Audio\Type_1" ;Global $_sTypeSetName = "F:\Audio\Type_2" ;Global $_sTypeSetName = "F:\Audio\Type_3" ;Global $_sTypeSetName = "F:\Audio\Type_4" ; ----------------------------------------------- _CreateTypeData($_sTypeSetName) ; ----------------------------------------------- Func _CreateTypeData($_sTypeSetName) ; Script concepts provided by ioa747... Local $_sMasterType1Edl = "Type1.edl" Local $_sMasterType2Edl = "Type2.edl" Local $_sMasterType3Edl = "Type3.edl" Local $_sMasterType4Edl = "Type4.edl" ; ----------------------------------------------- Local $_ConfirmCreate = MsgBox(4, "NOTICE!", "Create " & StringMid($_sTypeSetName, 10, 6) & " Session Data from .wav data?") ; ------------------------------------------------------ If $_ConfirmCreate = 6 Then Local $_sMessage = "Select the required .wav data..." ; ----------------------------------------------- Local $_sFileOpenDialog = FileOpenDialog($_sMessage, $_sTypeSetName & "\wav", "Wave Data (*.wav;)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) Local $_WavFiles = StringSplit($_sFileOpenDialog, "|") ; ------------------------------------------------------ Local $_DestMessage = "Select the Destination folder for the Session .edl file(s)..." Local $_DestFolder = FileSelectFolder($_DestMessage, $_sTypeSetName) ; ----------------------------------------------- If @error Then MsgBox($MB_ICONERROR, "Error", "No destination folder selected. Exiting.") Return ; ------------------------------------------------------ ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_1" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType1Edl ; ----------------- ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_2" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType2Edl ; ----------------- ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_3" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType3Edl ; ----------------- ElseIf StringMid($_sTypeSetName, 10, 6) = "Type_4" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType4Edl ; ----------------- Else MsgBox($MB_ICONERROR, "Error", "The " & $_MasterEdlFile & " file was not found.") Return EndIf ; ------------------------------------------------------ ; Script concepts provided by pixelsearch... If $_WavFiles[0] = 1 Then ; If only one file was selected by the user... Local $iPos_LastBackslash = StringInStr($_WavFiles[1], "\", 0, -1) ; -1 starts from the right (+++) ReDim $_WavFiles[3] $_WavFiles[2] = StringMid($_WavFiles[1], $iPos_LastBackslash + 1) ; The file name $_WavFiles[1] = StringLeft($_WavFiles[1], $iPos_LastBackslash - 1) ; The path (without last backslash) $_WavFiles[0] = 2 EndIf ; ------------------------------------------------------ Local $_sWavFolder = $_WavFiles[1] ; ------------------------------------------------------ For $i = 1 To $_WavFiles[0] ; If multiple files were selected by the user... Local $_WavFileName = $_sWavFolder & "\" & $_WavFiles[$i] Local $_WavBaseName = StringTrimRight($_WavFiles[$i], 4) ; ----------------- Local $_NewEdlFile = $_DestFolder & "\" & $_WavBaseName & ".edl" ; ----------------- FileCopy($_MasterEdlFile, $_NewEdlFile, $FC_NOOVERWRITE) ; Suggested by AndrewG Next ; ----------------- MsgBox($MB_ICONINFORMATION, "Success", "The " & StringMid($_sTypeSetName, 10, 6) & " file(s) have been created successfully.") ; ------------------------------------------------------ ElseIf $_ConfirmCreate = 7 Then MsgBox($MB_ICONINFORMATION, "Cancelled", "The operation was cancelled by the user.") EndIf EndFunc ;==>_CreateTypeData ; ----------------------------------------------- I wish to thank the following for their immeasurable assistance, ioa747, AndrewG, and pixelsearch! Thank you!
    1 point
  4. Aside from forum rules, that's hard to do and can get you banned from the game In case you don't read the rules, they say: no gaming stuff on this forum.
    1 point
  5. If the error is fatal, quit. If the error is circumstantial, retry. If the expected circumstances never come, ... then is a good idea to add a retry counter and a MsgBox() with "Retry, continue, cancel options", with a timeout of a certain default, to accommodate all foreseeable circumstances and desired default option, in case the operator/user is not at the keyboard. Look at it like a game of chess, where you are coding in advance, a reaction to any of the opponent's ( the darn PC ) possible moves. Once you become more familiar with this adventure of coding, forking opens a world of possibilities. But that is 3D chess.
    1 point
  6. Jos

    StringRegExpReplace result

    Something like this? StringRegExpReplace($Var007beta, '(?s).*?Wired\s+(.*)\s+released.*$', "$1")
    1 point
  7. well, you ControlClick() and immediately _ScreenCapture_Capture(). I would given that it seems to be that fast, and only so often slightly slower, move the ScreenCap() and _GetNumber() into a function that will retry. Something like this: Untested but that's the idea.
    1 point
  8. @mr-es335 I did a quick test with your script (after creating all the paths needed on my computer) 1) Major issue with the following line : For $i = 1 To $_WavFiles[0] ; If multiple files were selected by the user... 1 is the element in the array that contains the path (it is not a wav file name) so your loop should start from 2 : For $i = 2 To $_WavFiles[0] ; one or several wav files were selected by the user... 2) FileOpenDialog ; no error checking ? If we cancel the FileOpenDialog window (e.g. no wav file selected) then a file named ".edl" will be created somewhere (it happened to me) . As you did check @error correctly for FileSelectFolder, then you should also do the error checking for FileOpenDialog After having fixed this, then your script seems to work, though I tested it much too quickly.
    1 point
  9. in the line For $i = 1 To $_WavFiles[0] don't forget that the first line has only the folder Local $_sWavFolder = $_WavFiles[1] so you start from the second one For $i = 2 To $_WavFiles[0]
    1 point
  10. Wouldn't it be easier to see if it can be read by uiautomation or other accessibility tools. try inspect.exe or simplespy (see faq in signature) It seems to be a certain Delphi version that the tool.exe was build in (https://www.embarcadero.com/products/delphi/starter) This imagerecognition is probably much faster in Delphi or C# I remembered I build this 15 years ago 😉 for a similar purpose. And for fun some reference on analog digits on screen for having fun to recognize with pixel checking 😉 #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Dim $ws[12] = [0, 0, 10, -7, 50, -7, 60, 0, 50, 7, 10, 7] ;Koordinaten Polygonzug: von links nach rechts WAAGRECHTER Balken, von rechts nach links SENKRECHTER Balken Dim $ziffer[10] = [239, 10, 118, 94, 154, 220, 253, 14, 254, 222] ;alle gesetzten bits des Indexes in der 7-segmentanzeige ergeben die Ziffer Dim $balkenpos[8] = [0, "60.0", "0.0", "60.60", "0.60", "0.60", "0.120", "0.0"] ;position der Leuchtbalken der 7-Segmentanzeige innerhalb der Ziffer Dim $p[7][2] ;nimmt die polygonzug-koordinaten zum Zeichnen auf $p[0][0] = 6 ;6 Punkte im Polygonzug _GDIPlus_Startup() Global $hgui = GUICreate('Uhr', 620, 175, -1, -1, $WS_POPUP) ;GUI erstellen ohne Rahmen Global $hWnd = WinGetHandle($hgui) ;Handle holen Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;"Leinwand" erstellen, auf der gezeichnet werden kann GUICtrlCreateLabel("", 0, 0, 620, 175, Default, $GUI_WS_EX_PARENTDRAG) ;verschieben des Fensters möglich machen durch 2. Fenster GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;das 2. Fenster transparent machen GUISetBkColor(0x000000) ;Hintergrund der GUI schwarz GUISetState() ;GUI anzeigen AdlibRegister("_time", 1000) ;jede Zehntelsekunde ein Refresh der Zeitanzeige Do ;Endlosschleife, solange bis.. Until GUIGetMsg() = -3 ;..ESC gedrückt wird _GDIPlus_GraphicsDispose($hGraphic) ;freigeben _GDIPlus_Shutdown() Func _time() ;Uhrzeit anzeigen :o) For $k = 1 To 6 ;die 6 Ziffern der Uhrzeit $setbits = $ziffer[StringMid(String(@HOUR & @MIN & @SEC), $k, 1)] ;gesetzte Bits in der siebensegmentanzeige anhand der Ziffer in der Uhrzeit holen For $bitnr = 7 To 1 Step -1 ;alle Bits durchlaufen _drawpolygon(BitAND($setbits, 128), $k * 100 - 80 + ($k = 1 Or $k = 3 Or $k = 5) * 20, $bitnr) ;parameter: bit gesetzt ja/nein, position der gesamten ziffer,nummer des bits(gerade=waagrechter balken, ungerade=senkrechter balken) $setbits = BitShift($setbits, -1) ;nächstes Bit holen Next Next $brush = _GDIPlus_BrushCreateSolid(0xFF440000 + (@SEC / 2 = Int(@SEC / 2)) * 0xBB0000) ;Pinsel erstellen, wenn Ziffer gerade, dann farbig, ansonsten schwarz _GDIPlus_GraphicsFillEllipse($hGraphic, 202, 55, 15, 15, $brush) ;Punkte zeichnen _GDIPlus_GraphicsFillEllipse($hGraphic, 402, 55, 15, 15, $brush) _GDIPlus_GraphicsFillEllipse($hGraphic, 202, 105, 15, 15, $brush) _GDIPlus_GraphicsFillEllipse($hGraphic, 402, 105, 15, 15, $brush) _GDIPlus_BrushDispose($brush) ;Pinsel auflösen EndFunc ;==>_time Func _drawpolygon($bit, $xpos, $bitnr) ;zeichnet einen polygonzug ("Balken") an die entsprechende Position $split = StringSplit($balkenpos[$bitnr], ".", 3) ;x- und y-koordinaten des Balkens innerhalb der Ziffer holen $b = (($bitnr / 2) = Int($bitnr / 2)) ;$bit gerade => $b = true => Balken waagrecht, ansonsten Balken senkrecht $step = -1 + 2 * $b ;schrittweite durch das $WS-Array For $i = 11 - 11 * $b To 11 * $b Step 2 * $step ;array mit waagrechten (bit=gerade) oder (Bit=ungerade) senkrechten Balken füllen $r = Int(Abs((11 * (Not ($b))) - $i) / 2) + 1 ;abhängig von der Reihenfolge, egal ob $i von 0 bis 11 oder von 11 bis 0, $r muss immer 1,2,3,4,5,6 $p[$r][0] = $ws[$i] + $split[0] + $xpos ;x- und $p[$r][1] = $ws[$i + $step] + $split[1] + 30 ;y-position in das polygonarray schreiben Next $brush = _GDIPlus_BrushCreateSolid(0xFF440000 + ($bit <> 0) * 0xBB0000) ;wenn bit gesetzt, dann farbig, ansonsten schwarz _GDIPlus_GraphicsFillPolygon($hGraphic, $p, $brush) ;Balken zeichnen _GDIPlus_BrushDispose($brush) EndFunc ;==>_drawpolygon
    1 point
  11. @Nine fixed that earlier, now we are just playing around, OP has gotten above 15k, and is probably having his computer running for days now with no time to try out our new examples, we may probably come up with a solution that would finish faster than the script he has running now. Just like Voyager 1 will be surpassed by spaceships we build later.
    1 point
  12. lol. It is faster I feel that we all in this thread are getting off course. The next problem the OP presented, was not the speed, but the crash.
    1 point
  13. i make the aNumber array Local Static I did a test on a sample of 1700 images (1700 * 3 = 5100 numbers) from: 103.986 seconds to: 102.365 seconds update the script
    1 point
  14. Here it is the edition with a single column patern ; https://www.autoitscript.com/forum/topic/211521-ocr-from-a-small-area/?do=findComment&comment=1538057 ; Version: 5.0.2 #include <GDIPlus.au3> #include <Array.au3> #include <File.au3> #include <WinAPIProc.au3> ;~ Local $Result = _GetNumber(@ScriptDir & "\100num\040.png") ;~ MsgBox($MB_SYSTEMMODAL, "_GetNumber", $Result) Test("M:\TEMP\100num") ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetNumber($sFileName, $hColor = 0x00FF00) ; Main Program ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($sFileName) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf ;~ _ArrayDisplay($aColorMap) Local $Result = FindNumberUsingColorMap($aColorMap, $hColor) ;~ MsgBox($MB_SYSTEMMODAL, "$Result", $Result) ; Cleanup resources _GDIPlus_Shutdown() 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) If @error Then Return SetError(1, 0, "") ; because the user ( me ) might do the unexpected ;) ; 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 ;~ _ArrayDisplay($aNum) Local $sNumber ; Generate patterns for each found number For $i = 1 To $aNum[0][0] Local $sPattern = "" For $y = $firstRow To $lastRow $x = $aNum[$i][0] If $aColorMap[$x][$y] = $hColor Then $sPattern &= "1" Else $sPattern &= "." EndIf $sPattern &= @CRLF Next $sNumber &= _GetPattern($sPattern) Next Return $sNumber EndFunc ;==>FindNumberUsingColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetPattern($sPattern) ; patterns for each digit ;~ ConsoleWrite("**************" & @CRLF & $sPattern & @CRLF) Local Static $aPNum ; Define simplified patterns for each digit If Not IsArray($aPNum) Then Local $aNumber[10] $aNumber[0] = "" ; Pattern for '0' $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[1] = "" ; Pattern for '1' $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[2] = "" ; Pattern for '2' $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[3] = "" ; Pattern for '3' $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[4] = "" ; Pattern for '4' $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[5] = "" ; Pattern for '5' $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[6] = "" ; Pattern for '6' $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[7] = "" ; Pattern for '7' $aNumber[7] &= "1" & @CRLF $aNumber[7] &= "1" & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[8] = "" ; Pattern for '8' $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[9] = "" ; Pattern for '9' $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aPNum = $aNumber EndIf Switch $sPattern Case $aPNum[0] Return 0 Case $aPNum[1] Return 1 Case $aPNum[2] Return 2 Case $aPNum[3] Return 3 Case $aPNum[4] Return 4 Case $aPNum[5] Return 5 Case $aPNum[6] Return 6 Case $aPNum[7] Return 7 Case $aPNum[8] Return 8 Case $aPNum[9] Return 9 Case Else Return SetError(1, 0, "") EndSwitch EndFunc ;==>_GetPattern ;-------------------------------------------------------------------------------------------------------------------------------- Func Test($sFolderPath, $hColor = 0x00FF00) ; _GetNumber for all the *.png files in $sFolderPath directory ; List all the *.png files in $sFolderPath directory Local $aFileList = _FileListToArray($sFolderPath, "*.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 ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() Local $cnt = 0 Local $CleanTime = 0 Local $hTimer = TimerInit() For $j = 1 To 100 For $i = 1 To $aFileList[0][0] $cnt += 1 ConsoleWrite("$cnt: " & $cnt & @CRLF) ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($sFolderPath & "\" & $aFileList[$i][0]) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf $aFileList[$i][1] = FindNumberUsingColorMap($aColorMap, $hColor) ; Rename a file using FileMove and overwrite the new file if it exists. ;~ FileMove($sFolderPath & "\" & $aFileList[$i][0], $sFolderPath & "\" & $aFileList[$i][1] & ".png", $FC_OVERWRITE) ;~ $aProcessMemoryInfo = _WinAPI_GetProcessMemoryInfo() ;~ ConsoleWrite('The peak working set: ' & $aProcessMemoryInfo[1] / 1024 / 1014 & ' MB' & @CRLF) Next Next ConsoleWrite("processed in: " & Round(TimerDiff($hTimer) / 1000, 3) & " seconds " & @LF) _ArrayDisplay($aFileList, "$aFileList") ; Cleanup resources _GDIPlus_Shutdown() EndFunc ;==>Test ;--------------------------------------------------------------------------------------------------------------------------------
    1 point
  15. Don't know about that. The OP shares bits and pieces. The extra millisecond saved is not that important. Producing an unequivocal output is**. We should see if the OP fixed the high loop count crush. That merits attention. ** Not saying that your trend of thought is wrong
    1 point
  16. @Nine How so, they are unique so how can they give a false positive? You check both the lit and unlit pixels. We could store them in one byte each, they are 7 pixels tall (yes, i know they are actually taller but we only use those we need), and 7 bits fits a byte they would become (reading from top to bottom in little-endian)... 0 = 62 1 = 0 2 = 35 3 = 34 4 = 12 5 = 114 6 = 30 7 = 64 8 = 54 9 = 48
    1 point
  17. Doesnt matter, it'll work fine as the numbers are always 3 digits with a leading zero when the number is less than 100, like "......043......", as per his other thread where he posts examples of numbers.
    1 point
  18. I cannot fathom the magnitude of your headache to orchestrate the whole WinRT project. You have all the respect I can give to anyone. Your MediaPlayer.au3 is very good for a start. I will look for the possibility of bringing all the functions used in your script into the main au3 file so that I won't have to "include" so many files. At this time, I don't have any idea of how long that file will end up to be, but I have the feeling that it won't be too long. Keept up the good work! Thank you for your time and effort to develop the WinRT librararies.
    1 point
  19. You dont need to check the whole pattern, the first column in each digit is unique...
    1 point
  20. I use ImDisk. Make the ramdisk any size.
    1 point
  21. @taurus905 thanks for your idea, anything would be better than these bunches of {Array[3]} rows actually displayed when RegExp Mode is 4. I'll think about it, having in mind that Nine & Gianni already got ways to display an "Array of Arrays" using their own UDF's If I ever script it, I'm not sure ConsoleWrite should be the best way to do it (imagine the script is compiled...) . My 1st thought would be to display the RegExp Mode 4 in ArrayDisplay, maybe in the same way as Mode 2, but with all Global matches & Groups following each other on separate rows (1D), or why not, each Global match and its Groups on the same row (in different columns, i.e. 2D), we'll see in time...
    1 point
  22. This seems to be a little better - based on a script by UEZ #include <WindowsConstants.au3> #include <WinApi.au3> #include <GDIPlus.au3> _GDIPlus_Startup() ; Create GUI Local $hGUI = GUICreate('Test', 500, 300, -1,-1,$WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) Local $idPic = GUICtrlCreatePic('', 0, 0, 500, 300) Local $hPic = GUICtrlGetHandle($idPic) Local $hGDIBmp = _GDIPlus_CreateBitmapRoundCornerRect() _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, 0x0172, $IMAGE_BITMAP, $hGDIBmp)) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = -3 _WinAPI_DeleteObject($hGDIBmp) _GDIPlus_Shutdown() Func _GDIPlus_CreateBitmapRoundCornerRect($iW = 500, $iH = 300, $iColorBg = 0xFF505050, $iColorBorder = 0xFF505050, $iRadius = 15, $bGDIBmp = 1) Local Const $iX = 0, $iY = 0, $iPenSize = 1 Local Const $iWidth = $iW - $iPenSize, $iHeight = $iH - $iPenSize Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) Local Const $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY, $iRadius * 2, $iRadius * 2, 270, 90) _GDIPlus_PathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) _GDIPlus_PathAddArc($hPath, $iX, $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) _GDIPlus_PathAddArc($hPath, $iX, $iY, $iRadius * 2, $iRadius * 2, 180, 90) _GDIPlus_PathCloseFigure($hPath) Local Const $hBrush = _GDIPlus_BrushCreateSolid($iColorBg) _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush) Local Const $hPen = _GDIPlus_PenCreate($iColorBorder, $iPenSize) _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) _GDIPlus_PathDispose($hPath) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCtxt) If $bGDIBmp Then Local $hGDIBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hGDIBmp EndIf Return $hBitmap EndFunc
    1 point
  23. UEZ

    Adobe AIR like window

    Here something similar which I had created in the past without text and buttons: ;coded by UEZ 2013 #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Global Const $SC_DRAGMOVE = 0xF012 Global Const $iW = 300, $iH = 200 _GDIPlus_Startup() ;text x y text color font font size Global $aText[6][6] = [ [ "Windows Translucent GUI", 10, 12, 0xFFFFFFFF, "Arial", 18 ], _ [ "Connection port:", 10, 80, 0xFFFFFFFF, "Arial", 11 ], _ [ "80", 150, 80, 0xFFFFFFFF, "Arial", 11 ], _ [ "Connection status:", 10, 100, 0xFFFFFFFF, "Arial", 11 ], _ [ "offline", 150, 100, 0xFFFF8080, "Arial", 12 ], _ [ "Coded by UEZ 2015 ;-)", 10, 150, 0xFFFFFFFF, "Comic Sans MS", 15 ]] ; x y w h bmp handle Global $aButtons[2][5] = [ [ 230, 150, 24, 24, _GDIPlus_BitmapCreateFromMemory(_Nok2_24x24png()) ], _ [ 260, 150, 24, 24, _GDIPlus_BitmapCreateFromMemory(_Ok2_24x24png()) ]] Global Const $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED) ;must be set before _GDIPlus_CreateCurvedTranslucentPanel Global Const $aReturn = _GDIPlus_CreateCurvedTranslucentPanel($aText, $aButtons, 0xE04576B2, 0x509FBADC, $iW, $iH) GUISetState() _WinAPI_BitmapSetTransparent($hGUI, $aReturn[0]) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($aReturn[0]) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit Case $aReturn[1] ;cancel MsgBox(0, "Info", "Cancel was pressed") Case $aReturn[2] ;ok MsgBox(0, "Info", "Ok was pressed") EndSwitch Until False Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func _GDIPlus_CreateCurvedTranslucentPanel($aText, $aButtons, $iColorBG, $iColorFrame, $iW, $iH, $iRadiusCorner = 20, $bTextShadow = True) ;build 2015-11-03 by UEZ Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) _GDIPlus_GraphicsSetInterpolationMode($hCtxt, 7) _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, 2) _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, 5) Local Const $hPath = _GDIPlus_PathCreate() Local Const $hPath_Shape = _GDIPlus_PathCreate() Local $iPenSize = 2 _GDIPlus_PathAddArc($hPath, $iW - ($iRadiusCorner * 2), 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 270, 90) _GDIPlus_PathAddArc($hPath, $iW - ($iRadiusCorner * 2), $iH - ($iRadiusCorner * 2), $iRadiusCorner * 2, $iRadiusCorner * 2, 0, 90) _GDIPlus_PathAddArc($hPath, 0, $iH - ($iRadiusCorner * 2), $iRadiusCorner * 2, $iRadiusCorner * 2, 90, 90) _GDIPlus_PathAddArc($hPath, 0, 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 180, 90) _GDIPlus_PathCloseFigure($hPath) Local $iColorBG2 = BitAND(0xFF000000, $iColorBG) + BitAND(0x00FF0000, $iColorBG) - 0x200000 + BitAND(0x0000FF00, $iColorBG) - 0x2000 + BitAND(0x000000FF, $iColorBG) - 0x20 Local $hBrush_Bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH, $iColorBG2, $iColorBG) _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush_Bg) Local $hBrush_Shape = _GDIPlus_LineBrushCreate($iW / 2, $iH / 5 + 7, $iW / 2, 0, $iColorFrame, 0xA0FFFFFF) _GDIPlus_PathAddArc($hPath_Shape, 0, 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 180, 90) _GDIPlus_PathAddArc($hPath_Shape, $iW - ($iRadiusCorner * 2), 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 270, 90) _GDIPlus_PathAddLine($hPath_Shape, 0, $iRadiusCorner, 0, $iH / 5) _GDIPlus_PathAddLine($hPath_Shape, 0, $iH / 5, $iW / 2, $iH / 5 + 7) _GDIPlus_PathAddLine($hPath_Shape, $iW, $iH / 5, $iW, $iRadiusCorner) _GDIPlus_PathCloseFigure($hPath_Shape) _GDIPlus_GraphicsFillPath($hCtxt, $hPath_Shape, $hBrush_Shape) Local $hPen = _GDIPlus_PenCreate(0xF0000000 + $iColorFrame, $iPenSize) _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) _GDIPlus_PathReset($hPath) Local $i, $hBrush, $hFamily, $hFormat, $tLayout Local $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0xFF101010) For $i = 0 To UBound($aText) - 1 $hBrush = _GDIPlus_BrushCreateSolid($aText[$i][3]) ;color $hFamily = _GDIPlus_FontFamilyCreate($aText[$i][4]) ;font $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 0) ;alignment $tLayout = _GDIPlus_RectFCreate($aText[$i][1] + $aText[$i][5] / 8, $aText[$i][2] + $aText[$i][5] / 8) _GDIPlus_PathAddString($hPath, $aText[$i][0], $tLayout, $hFamily, 0, $aText[$i][5], $hFormat) _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush_Shadow) ;draw shadow _GDIPlus_PathReset($hPath) $tLayout = _GDIPlus_RectFCreate($aText[$i][1], $aText[$i][2]) _GDIPlus_PathAddString($hPath, $aText[$i][0], $tLayout, $hFamily, 0, $aText[$i][5], $hFormat) _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush) _GDIPlus_PathReset($hPath) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) Next Local $aReturn[UBound($aButtons) + 1] $aReturn[0] = $hBitmap For $i = 0 To UBound($aButtons) - 1 _GDIPlus_GraphicsDrawImageRect($hCtxt, $aButtons[$i][4], $aButtons[$i][0], $aButtons[$i][1], $aButtons[$i][2], $aButtons[$i][3]) _GDIPlus_ImageDispose($aButtons[$i][4]) $aReturn[$i + 1] = GUICtrlCreateLabel("", $aButtons[$i][0], $aButtons[$i][1], $aButtons[$i][2], $aButtons[$i][3]) Next _GDIPlus_PathDispose($hPath) _GDIPlus_PathDispose($hPath_Shape) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush_Bg) _GDIPlus_BrushDispose($hBrush_Shape) _GDIPlus_BrushDispose($hBrush_Shadow) _GDIPlus_GraphicsDispose($hCtxt) Return $aReturn EndFunc ;==>_GDIPlus_CreateCurvedTranslucentPanel Func _WinAPI_BitmapSetTransparent($hGUI, $hImage, $iOpacity = 0xFF) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_WinAPI_BitmapSetTransparent ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-09-19 Func _Nok2_24x24png($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Nok2_24x24png $Nok2_24x24png &= 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAABzpAAAc6QHh0LjlAAAFf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g0auxXXhFJp0VERLQ2KiKyuChy6pSJqcdu0RrITChUtQAz1+k03LgBoRDk843tIxg0rXhcajUoFIxdqTz5f11+OnYs5/T0iDz/vPuogkjEPM+eFcnnTcWuK4+kziKT2c66wcB1QH7q6clx9+LFSduA6m2Bb73VAK/VGm2pt6vuy2RMIVvXRiLaBrl78eKk5e/u/sYGaGoy214gYKgdOwatrdun5b33zIguLRmf1tDWBsePmzWBAALg94sN+Lu7v6GYycR/jsfX3YfUtrXoyy9NlbmcyBtvNFowMGDYiJiYrWt6elz3pZfk51hsvZjJxBERUiMjo7+BSCxWdesgdbqJhMjwcGNa6kBDQyKffrot1n31VZF33qn+BpK6dm304U4tbGSzh6aPHLE3QyGRUEg/8bJDoYZd/731pUYihuGHH+rN11+X6WjU3shmD4kIuFp7RISlqanBGRAdj1clFNKPmESj28Hq4HXf0aPivv++yPXrWr/7bnUGZGlqalBEcLX2ICKI63pEhIWJieEZECca1RKLVQXcR4ke12hU3KEhkU8+cWVsrOoMDekZkIVbt4a3Yv7nI/PcuZF9s7P+cCgkKhBwqVQUoPD7FQcOQEeHcPiwsGOHyPy8lRsfV5mVlVLk88//y5H5+KGfz+9PJxIfVK5eHdiZSvmCgO/oUTzRKOzejfZ6cRYWsCcmWM3nnaYrVxLtp0//n0O/LluvLUtLseVk8vT6nTvHa5OTh9UPP5hrSyxme/v65nb09t5u7e7+n9eWfwNJOhRLmn3GvAAAAABJRU5ErkJggg==' Local $bString = _WinAPI_Base64Decode($Nok2_24x24png) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Nok2_24x24.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Nok2_24x24png Func _Ok2_24x24png($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Ok2_24x24png $Ok2_24x24png &= 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgd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decode($Ok2_24x24png) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Ok2_24x24.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Ok2_24x24png Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode
    1 point
×
×
  • Create New...