Leaderboard
Popular Content
Showing content with the highest reputation since 10/21/2024 in all areas
-
Just uploaded SciTEx86.zip & SciTEx64.zip which contain the Latest SciTE 5.5.3 versions released 9 October 2024.4 points
-
Font Viewer
SecretAgent and 3 others reacted to KaFu for a topic
Found a copy of 1.4 thanks to SMF 😋 in my archive drive at the location "E:\__code\TB_TurboBooster\Workbench\_testcode\FontViewer_source.zip" 🙄. Updated that too to 3.3.16.1, here's a copy of that plus the original code FontViewer_1.4.zip Additionally fixed a bug in the enumeration of the system fonts. ; $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, StringTrimLeft($REG_KEY_TRUETYPE, 5)) ; needs to be $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, StringTrimLeft($REG_KEY_TRUETYPE, 5),BitOR($KEY_QUERY_VALUE , $KEY_WOW64_32KEY))4 points -
Version 1.6.1 has just been released! The function snippet, now uses "func" instead of "fun" for the string prefix. Variables declared via for loops are now recognized by the extension. include statements that fail to resolve, should no longer have links added to them. Sorry for the slow release. Personal things, combined with my vscode and docker that keeps crashing due to running out of memory, have delayed this release by at least a month. 😕 Anyway, i am currently looking into: adding errors for things like include statements that fail to resolve. improving the function signature helper (currently it disappears if the parser fails on that line, like when adding a comma within the parentheses, but there is nothing between the comma and the closing parenthesis) adding setting for omitting included functions and variables with the "__" prefix from the completion suggestions.4 points
-
Another approach : #include <GUIConstants.au3> #include <GuiMenu.au3> HotKeySet("{F3}", ShowMenu) HotKeySet("^{F3}", Terminate) While Sleep(100) WEnd Func ShowMenu() Local Static $bCreated = False Local Static $hGUI = GUICreate("", 50, 50, -100, -100, $WS_POPUP, $WS_EX_TOOLWINDOW) Local Static $idContextmenu = GUICtrlCreateContextMenu() Local Static $idNew = GUICtrlCreateMenuItem("New", $idContextmenu) Local Static $idOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local Static $idSave = GUICtrlCreateMenuItem("Save", $idContextmenu) If Not $bCreated Then GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local Static $idInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) Local Static $hMenu = GUICtrlGetHandle($idContextmenu) $bCreated = True GUISetState() Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, -1, -1, 1, 1, 2) Case $idNew ConsoleWrite("New" & @CRLF) Case $idOpen ConsoleWrite("Open" & @CRLF) Case $idSave ConsoleWrite("Save" & @CRLF) Case $idInfo ConsoleWrite("Info" & @CRLF) EndSwitch GUISetState(@SW_HIDE) EndFunc ;==>ShowMenu Func Terminate() Exit EndFunc ;==>Terminate3 points
-
@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.3 points
-
this is for small numbers like I simplified the process as much as possible by removing the unnecessary stuff like the area selector. ; https://www.autoitscript.com/forum/topic/211521-ocr-from-a-small-area/?do=findComment&comment=1538057 ; Version: 4.0 #include <GDIPlus.au3> #include <Array.au3> #include <File.au3> Local $Result = _GetNumber(@ScriptDir & "\100num\152.png") MsgBox($MB_SYSTEMMODAL, "_GetNumber", $Result) ;~ Test(@ScriptDir & "\100num") ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetNumber($sFileName, $hColor = 0x00FF00) ; Main Program ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($sFileName) ;~ _ArrayDisplay($aColorMap) Local $Result = FindNumberUsingColorMap($aColorMap, $hColor) ;~ MsgBox($MB_SYSTEMMODAL, "$Result", $Result) Return $Result EndFunc ;==>_GetNumber ;-------------------------------------------------------------------------------------------------------------------------------- Func CaptureAreaColorMap($sFileName) ; create color map array ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the screen area as a bitmap Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFileName) ; Get the width and height of the captured area Local $width = _GDIPlus_ImageGetWidth($hBitmap) Local $height = _GDIPlus_ImageGetHeight($hBitmap) ;~ ConsoleWrite("Image: $width=" & $width & ", $height=" & $height & @CRLF) ; Create an array to store color values Local $aColorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $aColorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Return $aColorMap EndFunc ;==>CaptureAreaColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func FindNumberUsingColorMap($aColorMap, $hColor = 0x00FF00) ; find number in color map array Local $width = UBound($aColorMap, 1) Local $height = UBound($aColorMap, 2) Local $firstRow = -1, $lastRow = -1, $firstCol = -1, $lastCol = -1 ; Scan for the first and last rows and columns with $hColor pixels For $y = 0 To $height - 1 For $x = 0 To $width - 1 If $aColorMap[$x][$y] = $hColor Then If $firstRow = -1 Then $firstRow = $y $lastRow = $y If $firstCol = -1 Or $x < $firstCol Then $firstCol = $x If $lastCol = -1 Or $x > $lastCol Then $lastCol = $x EndIf Next Next If $firstRow = -1 Or $lastRow = -1 Or $firstCol = -1 Or $lastCol = -1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No color found" & @TAB & @TAB) Exit EndIf ; each number Display is a matrix of 14x20 pixels Local $numberWidth = 14 ; set number width per digit Local $numberSpace = 2 ; set Space between digits Local $Empty = 0, $Corection = 0 ; Corection for boundaries if 1st digit = 1 For $x = $firstCol To $lastCol - 1 If $aColorMap[$x][$firstRow] = 0x000000 Then $Empty += 1 If $Empty = 3 Then ;found 1st Space between digits $Corection = $firstCol - 1 - Abs($x - $numberWidth - $numberSpace) ExitLoop EndIf Else $Empty = 0 EndIf Next If $Corection > 0 Then $firstCol = $firstCol - $Corection Local $numberStart = $firstCol ;~ ConsoleWrite("$Corection=" & $Corection & @CRLF) ;~ ConsoleWrite("Display_boundaries firstRow:" & $firstRow & " lastRow:" & $lastRow & " firstCol:" & $firstCol & " lastCol:" & $lastCol & @CRLF) ;~ ConsoleWrite("" & @CRLF) Local $aNum[11][3] ; Define boundaries for each number position For $i = 1 To 10 $aNum[$i][0] = $numberStart $aNum[$i][1] = $numberStart + $numberWidth If $numberStart + $numberWidth + $numberSpace > $lastCol Then ExitLoop $numberStart += $numberWidth + $numberSpace $aNum[0][0] = $i + 1 Next Local $sNumber ; Generate patterns for each found number For $i = 1 To $aNum[0][0] Local $sPattern = "" For $y = $firstRow To $lastRow For $x = $aNum[$i][0] To $aNum[$i][1] - 1 If $aColorMap[$x][$y] = $hColor Then $sPattern &= "1" Else $sPattern &= "." EndIf Next $sPattern &= @CRLF Next $sNumber &= _GetPattern($sPattern) Next Return $sNumber EndFunc ;==>FindNumberUsingColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetPattern($sPattern) ; patterns for each digit ;~ ConsoleWrite("**************" & @CRLF & $sPattern & @CRLF) Local $aNumber[10] ; Define simplified patterns for each digit $aNumber[0] = "" ; Pattern for '0' $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11.......11.11" & @CRLF $aNumber[0] &= "11.......11.11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11....11....11" & @CRLF $aNumber[0] &= "11....11....11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11.11.......11" & @CRLF $aNumber[0] &= "11.11.......11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= "11..........11" & @CRLF $aNumber[0] &= ".............." & @CRLF $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[0] &= "...11.11.11..." & @CRLF $aNumber[1] = "" ; Pattern for '1' $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "...11.11......" & @CRLF $aNumber[1] &= "...11.11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= "......11......" & @CRLF $aNumber[1] &= ".............." & @CRLF $aNumber[1] &= "...11.11.11..." & @CRLF $aNumber[1] &= "...11.11.11..." & @CRLF $aNumber[2] = "" ; Pattern for '2' $aNumber[2] &= "...11.11.11..." & @CRLF $aNumber[2] &= "...11.11.11..." & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "11..........11" & @CRLF $aNumber[2] &= "11..........11" & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "............11" & @CRLF $aNumber[2] &= "............11" & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "......11.11..." & @CRLF $aNumber[2] &= "......11.11..." & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "...11........." & @CRLF $aNumber[2] &= "...11........." & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "11............" & @CRLF $aNumber[2] &= "11............" & @CRLF $aNumber[2] &= ".............." & @CRLF $aNumber[2] &= "11.11.11.11.11" & @CRLF $aNumber[2] &= "11.11.11.11.11" & @CRLF $aNumber[3] = "" ; Pattern for '3' $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "......11.11..." & @CRLF $aNumber[3] &= "......11.11..." & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= "............11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= "11..........11" & @CRLF $aNumber[3] &= ".............." & @CRLF $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[3] &= "...11.11.11..." & @CRLF $aNumber[4] = "" ; Pattern for '4' $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "......11.11..." & @CRLF $aNumber[4] &= "......11.11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "...11....11..." & @CRLF $aNumber[4] &= "...11....11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "11.......11..." & @CRLF $aNumber[4] &= "11.......11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= "11.11.11.11.11" & @CRLF $aNumber[4] &= "11.11.11.11.11" & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".............." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[4] &= ".........11..." & @CRLF $aNumber[5] = "" ; Pattern for '5' $aNumber[5] &= "11.11.11.11.11" & @CRLF $aNumber[5] &= "11.11.11.11.11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "11............" & @CRLF $aNumber[5] &= "11............" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "11.11.11.11..." & @CRLF $aNumber[5] &= "11.11.11.11..." & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= "............11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "11..........11" & @CRLF $aNumber[5] &= "11..........11" & @CRLF $aNumber[5] &= ".............." & @CRLF $aNumber[5] &= "...11.11.11..." & @CRLF $aNumber[5] &= "...11.11.11..." & @CRLF $aNumber[6] = "" ; Pattern for '6' $aNumber[6] &= "......11.11..." & @CRLF $aNumber[6] &= "......11.11..." & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "...11........." & @CRLF $aNumber[6] &= "...11........." & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11............" & @CRLF $aNumber[6] &= "11............" & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11.11.11.11..." & @CRLF $aNumber[6] &= "11.11.11.11..." & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= "11..........11" & @CRLF $aNumber[6] &= ".............." & @CRLF $aNumber[6] &= "...11.11.11..." & @CRLF $aNumber[6] &= "...11.11.11..." & @CRLF $aNumber[7] = "" ; Pattern for '7' $aNumber[7] &= "11.11.11.11.11" & @CRLF $aNumber[7] &= "11.11.11.11.11" & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "............11" & @CRLF $aNumber[7] &= "............11" & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= ".........11..." & @CRLF $aNumber[7] &= ".........11..." & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "......11......" & @CRLF $aNumber[7] &= "......11......" & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= ".............." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[7] &= "...11........." & @CRLF $aNumber[8] = "" ; Pattern for '8' $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= "11..........11" & @CRLF $aNumber[8] &= ".............." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[8] &= "...11.11.11..." & @CRLF $aNumber[9] = "" ; Pattern for '9' $aNumber[9] &= "...11.11.11..." & @CRLF $aNumber[9] &= "...11.11.11..." & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= "11..........11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "...11.11.11.11" & @CRLF $aNumber[9] &= "...11.11.11.11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "............11" & @CRLF $aNumber[9] &= "............11" & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= ".........11..." & @CRLF $aNumber[9] &= ".........11..." & @CRLF $aNumber[9] &= ".............." & @CRLF $aNumber[9] &= "...11.11......" & @CRLF $aNumber[9] &= "...11.11......" & @CRLF Switch $sPattern Case $aNumber[0] Return 0 Case $aNumber[1] Return 1 Case $aNumber[2] Return 2 Case $aNumber[3] Return 3 Case $aNumber[4] Return 4 Case $aNumber[5] Return 5 Case $aNumber[6] Return 6 Case $aNumber[7] Return 7 Case $aNumber[8] Return 8 Case $aNumber[9] Return 9 Case Else Return SetError(1, 0, "") EndSwitch EndFunc ;==>_GetPattern ;-------------------------------------------------------------------------------------------------------------------------------- Func Test($sFilePath) ; _GetNumber for all the *.png files in $sFilePath directory ; List all the *.png files in $sFilePath directory Local $aFileList = _FileListToArray($sFilePath, "*.png", $FLTA_FILES) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No file(s) were found.") Exit EndIf _ArrayColInsert($aFileList, 1) ; add 1 column to hold the numbers For $i = 1 To $aFileList[0][0] $aFileList[$i][1] = _GetNumber($sFilePath & "\" & $aFileList[$i][0]) ; Rename a file using FileMove and overwrite the new file if it exists. ;~ FileMove($sFilePath & "\" & $aFileList[$i][0], $sFilePath & "\" & $aFileList[$i][1] & ".png", $FC_OVERWRITE) Next _ArrayDisplay($aFileList, "$aFileList") EndFunc ;==>Test ;--------------------------------------------------------------------------------------------------------------------------------3 points
-
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.3 points
-
OCR from a small area
argumentum and 2 others 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 ;--------------------------------------------------------------------------------------------------------------------------------3 points -
AutoIt Snippets
robertocm and 2 others 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.3 points -
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.zip3 points
-
Thanks for the original code 👍, here's an update to 3.3.16.1 FontViewer_source.zip3 points
-
These are the hotkeys that control this no-UI music player: Ctrl+Alt+c Change folder Ctrl+Alt+f Open/Close file properties window Ctrl+Alt+h Open/Close help message window Ctrl+Alt+l Open/Close playlist Ctrl+Alt+m Mute/Unmute audio volume Ctrl+Alt+p Pause/Resume playback Ctrl+Alt+r Repeat mode On/Off Ctrl+Alt+s Shuffle/Sort playlist Ctrl+Alt+Left Play previous file Ctrl+Alt+Right Play next file Ctrl+Alt+Up Increase volume Ctrl+Alt+Down Decrease volume Ctrl+Alt+End Exit program Come to think of it, I spend many hours in front of a computer doing something. It has been my habit to play music in the background. As I'm not an audiophile with discerning ears, my zPlayer has been enough for my listening needs. Even though zPlayer has substantial UIs, I rarely use them once I load a folder of my liking except when changing the folder. So I came up with this No UI Music Player. It basically runs with no UI. However, the user can bring up a playlist window or a file properties window once in while if they are urged to see something on the screen, If these windows are kept open, their contents are updated as necessary. In the playlist window, the user can search the playlist for strings like "beeth 9" to go to Beethoven's Symphony 9, for example, and double-click it to play it. In the file properties window, the user can see the essential file information such as file type, bitrate and total length. The current playback position is updated in 0:00:00 format every second. The properties window also shows whether repeat mode is on or off. I hope this can be of use to someone. zPlayer-NoUI.zip2 points
-
Taskbar problems
Danyfirex and one other reacted to argumentum for a topic
..never mind. had to be DllStructCreate("dword;hwnd;dword;dword;int[4];dword")2 points -
Yes, and much more advantage if one knows the "bitmap" FILE ( ! ) format? Skip the first 54 bytes (file header) and you will find....the "pixels" aka image data pixelarray (depending on the 1/2/4/8/16/24/32 Bit per Pixel mode (see header...)). So no need to CreateBitmapFromFile() because a simple "open" file gives access to the pixel data array.... Go and get the first "line" of the bitmap (as a char-string) and search in the screenshot (transfer the screenshot-bytes into a char-array...others say "string") with StringInstr(). If the first line of the bitmap is found in the screenshot, the comparison of the next "line" in the bitmap with the next "line" in the screenshot is easy. Because the position of the text ( a char-array ist the same as a byte array) is known in the screenshot-"text", the comparison with the next "lines" is only a comparison of "text" (StringMid() is our friend) . I have written a few example scripts with this method to find a "bitmap in a bitmap". I have to look for them at the weekend Speed-challenge opened!2 points
-
Win 11 - My own border color
Danyfirex and one other reacted to argumentum for a file
Version 0.2411.14.2
43 downloads
I use dark mode and would love to have the border with colors of my choosing. While I wait for Windows to implement a user selectable option in their settings, I cooked my own "border color setter". Since am at it, chose to have a color for elevated/admin windows and another for user level GUIs. Or not, is user selectable. Win11myOwnBorderColor.exe (v0.2411.14.2) SHA-1: 8EC62A330C489016E0F142A49E757FB696B3F4E1 SHA-256: D8CF3A723281A5EBAD8FED60898CE7F2410DC1E8EA9B88935D6D39257D0676D9 I wrote a FAQ / Help to give an idea of how to use it. That is very intuitive once you use it. But is there to read if you have questions. If the answers don't cover your question, join the forum and make a post for your question on the thread.2 points -
Win 11 - My own border color ( Help area )
Danyfirex and one other reacted to argumentum for a topic
These border colors are set by the app every time the window is created. The example for this is already posted. Since this is more of an app than an example, I opened a thread here for support. The script and compilation to .exe is the files area for download. According to Microsoft, the possibility to set the border color is available from Windows 11 Build 22000 onwards.2 points -
pixelsearch, ioa747 thank you for trying to help!!! It seems to me that it is impossible to remove the rest of the header. That would be great though. (painting in one color is not suitable) For now, the solution is to create a separate shadow (maybe someone find it useful): #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GDIPlus.au3> #include <WinAPISysWin.au3> ;exit func HotKeySet('{ESC}', 'Terminate') Func Terminate() Exit EndFunc ;==>Terminate $hGUI_Shadow = GUICreate('', 0, 0, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) $hGUI = GUICreate('', 400, 400, 300, 300, $WS_POPUP, Default, $hGUI_Shadow) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Shadow) ;create shadow :) _GDIPlus_Startup() _WinAPI_UpdateLayeredWindowEx($hGUI_Shadow, 300-20, 300-20, _CreateDropShadow(400, 400, 20, 0xFF000000), 60, 1) _GDIPlus_Shutdown() While Sleep(1000) WEnd ;============== code by Yashied (author) ==================== Func _CreateDropShadow($iWidth, $iHeight, $iRadius, $iARGB = 0) Local $hGraphic, $hBrush, $hImage, $hBitmap Local $aPart[4][5] = _ [[$iRadius, 0, $iWidth, $iRadius, -90], _ [$iWidth + $iRadius, $iRadius, $iRadius, $iHeight, 0], _ [$iRadius, $iHeight + $iRadius, $iWidth, $iRadius, 90], _ [0, $iRadius, $iRadius, $iHeight, 180]] $hImage = _GDIPlus_BitmapCreateFromScan0($iWidth + 2 * $iRadius, $iHeight + 2 * $iRadius) If Not $hImage Then Return 0 EndIf $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsClear($hGraphic, 0) $hBrush = _GDIPlus_BrushCreateSolid($iARGB) _GDIPlus_GraphicsFillRect($hGraphic, $iRadius, $iRadius, $iWidth, $iHeight, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iRadius, $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), -180, -90) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iWidth + $iRadius, $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), -90, 0) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iWidth + $iRadius, $iHeight + $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), 0, 90) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iRadius, $iHeight + $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), 90, 180) For $i = 0 To 3 $tRect = DllStructCreate($tagGDIPRECTF) For $j = 0 To 4 DllStructSetData($tRect, $j + 1, $aPart[$i][$j]) Next $hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRect, $iARGB, BitAND($iARGB, 0x00FFFFFF), $aPart[$i][4], 0, 3) _GDIPlus_GraphicsFillRect($hGraphic, $aPart[$i][0], $aPart[$i][1], $aPart[$i][2], $aPart[$i][3], $hBrush) _GDIPlus_BrushDispose($hBrush) Next $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) Return $hBitmap EndFunc ;==>_CreateDropShadow Func _GDIPlus_GraphicsDrawRadialGradient($hGraphics, $iX, $iY, $iRadius, $iARGB1, $iARGB2, $iStartAngle = 0, $iEndAngle = 360, $iStep = 5) If $iStep < 1 Then $iStep = 1 EndIf Local $Xi = $iX - $iRadius, $Yi = $iY - $iRadius, $Di = 2 * $iRadius Local $hBrush, $hMatrix, $Smooth = _GDIPlus_GraphicsGetSmoothingMode($hGraphics) Local $Start = True _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 0) $hBrush = _GDIPlus_LineBrushCreate(0, 0, $iRadius, 0, $iARGB1, $iARGB2, 3) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iX, $iY) While $iStartAngle < $iEndAngle If $iStartAngle + $iStep > $iEndAngle Then $iStep = $iEndAngle - $iStartAngle EndIf If $Start Then _GDIPlus_MatrixRotate($hMatrix, $iStartAngle + $iStep / 2) $Start = False Else _GDIPlus_MatrixRotate($hMatrix, $iStep) EndIf _GDIPlus_LineBrushSetTransform($hBrush, $hMatrix) _GDIPlus_GraphicsFillPie($hGraphics, $Xi, $Yi, $Di, $Di, $iStartAngle, $iStep, $hBrush) $iStartAngle += $iStep WEnd _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $Smooth) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hBrush) Return 1 EndFunc ;==>_GDIPlus_GraphicsDrawRadialGradient sorry for my english...2 points
-
for the example I took a piece from https://www.autoitscript.com/forum/topic/208404-scite-plusbar/?do=findComment&comment=1513490 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $MyIni = StringTrimRight(@ScriptFullPath, 4) & ".ini" Global $MyName = StringTrimRight(@ScriptName, 4) ConsoleWrite("$MyName=" & $MyName & @CRLF) HotKeySet("{F3}", "_MyConex") ;********************************** While 1 Sleep(50) WEnd ;********************************** Func _MyConex() Global $mPos = MouseGetPos() Global $hGui = GUICreate("Fav_gui", 32, 32, $mPos[0], $mPos[1], $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUISetBkColor("0x000000") WinSetTrans($hGui, "", 2) ;Add FileChangeDir to set the workdir to the scriptdir FileChangeDir(@ScriptDir) ;~ Global $aBox = BoxLoad() #Region === ContextMenu === Global $hMenu = GUICtrlCreateContextMenu() Global $Menu_Add = GUICtrlCreateMenuItem("➕ Add To " & $MyName, $hMenu) Global $Menu_Remove = GUICtrlCreateMenuItem("➖ Remove From " & $MyName, $hMenu) GUICtrlCreateMenuItem("", $hMenu) ; separator ------------------------------------- Global $Menu_Edit = GUICtrlCreateMenuItem("⚙ Edit " & $MyName, $hMenu) GUICtrlCreateMenuItem("", $hMenu) ; separator ------------------------------------- ;~ For $i = 1 To $aBox[0][0] ;~ GUICtrlCreateMenuItem($aBox[$i][0], $hMenu) ;~ Next GUICtrlCreateMenuItem("", $hMenu) ; separator ------------------------------------- Global $Menu_Cancel = GUICtrlCreateMenuItem("Cancel", $hMenu) #EndRegion === ContextMenu === GUISetState(@SW_SHOW) ; Perform a mouse right click MouseClick("right") Global $ID, $TmpSciteFile, $NeedSave = False ; Loop until the user exits. ;******************************************************************** While 1 $ID = GUIGetMsg() Switch $ID Case $GUI_EVENT_CLOSE ExitLoop Case $Menu_Add ;... ExitLoop Case $Menu_Remove ;... ExitLoop Case $Menu_Edit ;... ExitLoop Case $Menu_Cancel ExitLoop ;~ Case 8 To $aBox[0][0] + 9 ;~ ExitLoop EndSwitch If Not WinActive($hGui) Then ExitLoop EndIf WEnd ;******************************************************************** EndFunc ;==>_MyConex2 points
-
RegExpQuickTester 2.5r
ioa747 and one other reacted to pixelsearch for a topic
Hi everybody I just uploaded the new version 2.5r (11 nov 2024) of the script, download from 1st post. Changes of 2 last versions are : 11 nov 2024 : added a function _ViewSubArrays() in the generated code: this is useful if the user checked Mode 4 which "returns an array of arrays containing global matches including the full match." In this case the function _ViewSubArrays() will display the content of all internal sub-arrays, each internal 1D sub-array becoming 1 row in a 2D array. Thanks to taurus905 for the suggestion, not forgetting jchd who indicated that the internal sub-arrays could have have a different number of rows, depending on the pattern. Changed version from "2.5q" to "2.5r" 10 feb 2024 : check length of 'Personal' Tab before exiting the script : refuse to leave if > 64KB (see notes in script, part Case $GUI_EVENT_CLOSE, $btnClose) Related : Edit Control $ebPersonal got an 'unlimited' text size to bypass the 30.000 characters by default. Changed version from "2.5p" to "2.5q" (version 2.5q wasn't uploaded on the Forum) Thanks @taurus905 for suggesting to display the internal arrays in Mode 4 A thought to @mikell (who sadly is not with us anymore) he insisted that I change this explanative line from the context menu... "\G beginning of string, then where previous match ended" To... "\G beginning of string, or end of the previous match" It's done buddy, I didn't forget2 points -
#include <GUIConstants.au3> #include <GuiEdit.au3> Example() Func Example() GUICreate("Test Suggestion", 300, 100) Local $idButton = GUICtrlCreateButton("OK", 10, 70, 100, 20) Local $input = GUICtrlCreateInput("", 10, 10, 280, 30) _GUICtrlEdit_SetCueBanner($input, "suggested content...") GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example2 points
-
1st try (58) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded. do i have to do something? Edit: ok now it works. Now I have to understand how it works? @DesktopWidth x @DesktopHeight = 1920x1080 Global $posx = 958, $posy = 499, $result = ""2 points
-
Yup, ~2 milliseconds on my pc, and that's without the fancy rotating stuff. The basics #include <GDIPlus.au3> #include <ScreenCapture.au3> ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "" ;Lookup table to avoid searching Global $digit[115] = [1,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,6,0,0,0,3,2,0,0,0,0, _ 0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,0,0,0,0,0, _ 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] $capture = _ScreenCapture_Capture("", $posx, $posy, $posx+34, $posy+20) $bitmap = _GDIPlus_BitmapCreateFromHBITMAP($capture); for some reason createfromhbitmap is not a fully compatible gdiplus bitmap $clone = _GDIPlus_BitmapCloneArea($bitmap, 0, 0, 34, 20, $GDIP_PXF32ARGB); so we have to do this before it works correctly _GDIPlus_BitmapDispose($bitmap) Func Getnumber($result) Local $code[3] = [0,0,0], $value = 64 $bitmap1 = _GDIPlus_BitmapLockBits($clone, 0, 0, 34, 20, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) $pixels = DllStructCreate("dword[" & 680 & "];", DllStructGetData($bitmap1, "Scan0")) For $loop = 1 To 680 Step 102 $code[0] += DllStructGetData($pixels, 1, $loop ) = 4278255360 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+16) = 4278255360 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+32) = 4278255360 ? $value:0 $value /= 2 Next _GDIPlus_BitmapUnlockBits($clone, $bitmap1) Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) EndFunc And a runable script (zipped folder with script and test images attached) #include <GDIPlus.au3> #include <ScreenCapture.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "" ;Lookup table to avoid searching Global $digit[115] = [1,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,6,0,0,0,3,2,0,0,0,0, _ 0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,0,0,0,0,0, _ 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] ;Test section ;-------------------------------------------------------------- $gui = GUICreate("Getnumber", 640, 480, -1, -1) GUISetState() WinWaitActive($gui); <--- necessary or screencapture fails _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($gui) $image = _GDIPlus_BitmapCreateFromFile("518.png") _GDIPlus_GraphicsDrawImageRect($graphics, $image, 280, 200, 136, 31) Sleep(10); <------- necessary because drawimagerect() is too slow, script occasionally fails without ;-------------------------------------------------------------- ;/Test section $time = TimerInit() $capture = _ScreenCapture_Capture("", $posx, $posy, $posx+34, $posy+20) $bitmap = _GDIPlus_BitmapCreateFromHBITMAP($capture); for some reason createfromhbitmap is not a fully compatible gdiplus bitmap $clone = _GDIPlus_BitmapCloneArea($bitmap, 0, 0, 34, 20, $GDIP_PXF32ARGB); so we have to do this before it works correctly _GDIPlus_BitmapDispose($bitmap) $result = Getnumber() Consolewrite("Result: " & $result & " Time: " & TimerDiff($time)/1000 & @crlf) While 1 Sleep(10) WEnd Func Getnumber() Local $code[3] = [0,0,0] $bitmap1 = _GDIPlus_BitmapLockBits($clone, 0, 0, 34, 20, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) $pixels = DllStructCreate("dword[" & 680 & "];", DllStructGetData($bitmap1, "Scan0")) $value = 64 For $loop = 1 To 680 Step 102 $code[0] += BitAnd(BitShift(DllStructGetData($pixels, 1, $loop ), 8), 1) = 1 ? $value:0 $code[1] += BitAnd(BitShift(DllStructGetData($pixels, 1, $loop+16), 8), 1) = 1 ? $value:0 $code[2] += BitAnd(BitShift(DllStructGetData($pixels, 1, $loop+32), 8), 1) = 1 ? $value:0 $value /= 2 Next $result = String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) $code = 0 _GDIPlus_BitmapUnlockBits($clone, $bitmap1) Return $result EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc Not much code it takes. I havent checked for memoryleaks and stuff, too tired now, if you spot anyting please tell. Be sure to change the $posx and $posy to point at the correct spot, as it is now it fits a 3440x1440 monitor. (you can comment out line 56 that gives error so you can take a screenshot to find the correct spot) /edit Changed, zip not updated Changed again, $code[0] += DllStructGetData($pixels, 1, $loop ) = 4278255360 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+16) = 4278255360 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+32) = 4278255360 ? $value:0 getnumber.zip2 points
-
Haha...thx, i made this centuries ago...if I remember right, it was a contribution to some other "digital desktop clock" scripts which took some hundret lines of code...my intention was to write a script in less than 50 lines of code. The "bitbanging" aka producing a polygon, means the position and orientation of an "equal shape", I taught myself about 40 years ago when I programmed "graphical" games for a calculator (sharp PC1401) with a 7-segment LC display in machine code. yepp, rotation is the key...and it is not necessary to use "graphical stuff" like GDI(+) or something like that to read or write "pixels"! A bitmap is an array of bytes/words/dwords representing the "pixels". If you put an AutoIt dllstruct "over" a bitmap (at the bitmap's starting address in memory), you can read or write "pixels" with a simple DllStructGetData() / DllStructSetData(), or, much faster, define/read the dllstruct as a "string" (characters) and use the super-fast AutoIt string commands like StringInstr() to locate a specific sequence of "bytes" (characters). As Werty mentioned, the first column of the digit is unique. This requires seven "bit tests" due to the way the pixels are arranged in memory, as each "pixel" is in a different area of the bitmap. After rotating the image, only one test is required, as the "pixels" of the first column are now in a row, one after the other. So only one read from memory is required to get the "number". And since the position of the next "number" on the screen is known in the bitmap's memory, a search for a sequence of 4 consecutive "numbers" would only require 4 reads from memory. This means that the first step is to look for the first "digit", then look at the (known) next position in memory and check if the byte at that position is the second "digit", and so on... With this technique the search of a sequence of "numbers" on a screenshot is possible in a few (milli)-Seconds. In native AutoIt code....2 points
-
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;==>GetImage2 points
-
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) Exit2 points
-
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 ;--------------------------------------------------------------------------------------------------------------------------------2 points
-
WebP v0.3.1 build 2022-06-18 beta
argumentum and one other reacted to UEZ for a topic
Try this: Example1.au3 ;Coded by UEZ #AutoIt3Wrapper_UseX64=y #include <GUIConstantsEx.au3> #include "WebP.au3" ;~ Global $sFile Global $sFile = FileOpenDialog("Select an image", "", "Images (*.webp)") If @error Then Exit Global Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() Global Const $hImage = WebP_BitmapCreateGDIp($sFile) ;load webp image as gdiplus Global Const $hImage_Scaled = _GDIPlus_ImageScale($hImage, 0.5, 0.5) ;shrink image to 50% Global Const $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_Scaled) ;convert gdiplus image to gdi image _GDIPlus_ImageDispose($hImage_Scaled) ;dispose gdiplus image _GDIPlus_ImageDispose($hImage) ;dispose gdiplus image ;get image dimension from gdi image Global $tDim = DllStructCreate($tagBITMAP) DllCall("gdi32.dll", "int", "GetObject", "int", $hBitmap, "int", DllStructGetSize($tDim), "ptr", DllStructGetPtr($tDim)) Global Const $iW = DllStructGetData($tDim, "bmWidth"), $iH = DllStructGetData($tDim, "bmHeight") ;display shrinked image in GUI Global Const $hGUI = GUICreate("WebP Image Viewer", $iW, $iH) GUISetBkColor(0xFFFFFF) Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW - 1, $iH - 1) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) GUISetState() _WinAPI_DeleteObject($hBitmap) ;dispose gdi image _GDIPlus_Shutdown() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE2 points -
Loop over 1M numbers fails on 9964th iteration
Hashim and one other reacted to argumentum for a topic
I use ImDisk. Make the ramdisk any size.2 points -
Hey, apologies for the wait - I've skipped over the control part for now as it was giving me a headache! but here's a start with the player object. We've already exceeded the include limit of 995 files with this example, so that's obviously something I'll need to address going forward.. I'll keep chipping away at it, but FYI I'm fairly busy over next couple of weeks. So just expect things to be a bit slow going for a while! Anyway hope this helps... MediaPlayer.zip2 points
-
Something looks wrong in the _ScreenCapture. You are reusing the same variable for 2 different purposes (without cleaning up the memory) : Here : $hBitmap = _WinAPI_AdjustBitmap($hHBitmap, $iBmpW, $iBmpH, $HALFTONE, $tAdj) and there : $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) That must create major memory leak, IMO.2 points
-
StringSplit Example
mr-es335 and one other reacted to pixelsearch for a topic
@mr-es335 i don't know about other users but when I started to learn AutoIt and a new function (like StringSplit) was needed in a script I was writing, then I put the script "on hold" and do many "little tests" I could with this new function (StringSplit), trying to understand exactly how it works, even if it will take me hours ! Gladly the help file is a big help and after these tests were done, only then I went back to the script to continue it. Now you know that your issue concerns the array $_aGetType[] and this array was returned by... StringSplit, then you should take a little time to do some external little tests to understand SpringSplit a bit more, for example : #include <Array.au3> _Split("F:") _Split("F:\") _Split("F:\Audio") _Split("F:\Audio\Type_1") _Split("F:\Audio\Type_1\TestMe") _Split("F:\Audio\Type_1\TestMe\") Func _Split($sString) Local $aArray = StringSplit($sString, "\") If @error Then ConsoleWrite($sString & " error = " & @error & " (no delimiter found)" & @crlf) _ArrayDisplay($aArray, $sString) EndFunc Now you should focus on the value of the 1st element of the array, i.e. $aArray[0] which always exists in this example because we didn't use the flag $STR_NOCOUNT . As you can see, its value goes from 1 to 5 in this example, and the help file is clear about that : StringSplit returns an array, by default the first element ($aArray[0]) contains the number of strings returned, the remaining elements ($aArray[1], $aArray[2], etc.) contain the delimited strings. So by testing the value of $aArray[0] you should achieve your goal (i.e. if the value is < 3 then you can be sure that the user didn't select the 'Type_1' subfolder, because when 'Type_1' is found in the selected path, then $aArray[0] >= 3 3 if "F:\Audio\Type_1" 4 if "F:\Audio\Type_1\TestMe" 5 if "F:\Audio\Type_1\TestMe\" etc... Hope it helps2 points -
At first glance, you do not use _GDIPlus_GraphicsDispose2 points
-
Update the script above to Version: 4.0 I lightened it up a bit from the legacies it had from the previous script (with big numbers) which assumed that each Vpoint could be made up of more pixels so that it is more readable and lighter2 points
-
BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
donnyh13 and one other reacted to argumentum for a topic
Tested both x86 and x64. All good. (24H2 26100.1000)2 points -
_FileListToArray issue
mr-es335 and one other reacted to pixelsearch for a topic
@ioa747 i think there's a possible issue in your last script, if the user selects only 1 wav file, then : Local $sFileOpenDialog = FileOpenDialog(...) Local $aWavFiles = StringSplit($sFileOpenDialog, "|") Local $sWavFolder = $aWavFiles[1] $sWavFolder is not an "only path" in this case, but a path + filename This is because FileOpenDialog treats differently its return : when the user selects only one file, then StringSplit acts like the following (as no delimiter is found and StringSplit flag is not equal to $STR_NOCOUNT) : Row 0 : 1 Row 1 : Path & Filename ...compared to a user who selects at least 2 files, then a delimiter (|) is always found in the returned string and StringSplit will act like this when 2 files are selected : Row 0 : 3 Row 1 : Path Row 2 : Filename #1 Row 3 : Filename #2 A possible solution could be to treat both cases in the same way, i.e. always have the "path only" in row 1 : Local $sFileOpenDialog = FileOpenDialog(...) Local $aWavFiles = StringSplit($sFileOpenDialog, "|") If $aWavFiles[0] = 1 Then ; only 1 file was selected by user Local $iPos_LastBackslash = StringInStr($aWavFiles[1], "\", 0, -1) ; -1 starts from the right (+++) ReDim $aWavFiles[3] $aWavFiles[2] = StringMid($aWavFiles[1], $iPos_LastBackslash + 1) ; file name $aWavFiles[1] = StringLeft($aWavFiles[1], $iPos_LastBackslash - 1) ; path (without last backslash) $aWavFiles[0] = 2 EndIf Local $sWavFolder = $aWavFiles[1] ; now it always works, no matter the user selected 1 or several files For $i = 2 To $aWavFiles[0] ; as found in your script, no change needed. ...2 points -
from what I understand you want their names to make in the respective EdlFile ...but you know the final answer2 points
-
OCR from a small area
ioa747 and one other reacted to argumentum for a topic
Func _NumberFromPattern(ByRef $hBitmap, $X0, $Y0, $iAlphaColor = 4278255360) Local $a3[] = ["0,4", "6,9"] Local $a7[] = ["0,0", "13,0"] Local $a4[] = ["9,0", "0,9"] Local $aTemp, $aSplit, $iCount For $n = 0 To 9 $iCount = 0 $aTemp = Eval('a' & $n) If Not UBound($aTemp) Then ContinueLoop ; array for digit not declared For $i = 0 To UBound($aTemp) - 1 $aSplit = StringSplit($aTemp[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = $iAlphaColor Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return $n Next Return "" EndFunc ;==>_NumberFromPattern my contribution ?2 points -
Here my two cents. #include <GDIPlus.au3> Example() Func Example() _GDIPlus_Startup() ;initialize GDI+ Local Const $iWidth = 150, $iHeight = 150 Local $iColor = 0 Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\TestImage.png") Local $Y0 = 0 For $iY = 0 To $iHeight - 1 For $iX = 0 To $iWidth - 1 $iColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ;get current pixel color If $iColor = 4278255360 Then ;~ _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFFFF0000) ;~ ConsoleWrite($iX & "," & $iY & @CRLF) $Y0 = $iY ExitLoop 2 EndIf Next Next ;Find X Local $X0 = 0 For $iX = 0 To $iWidth - 1 For $iY = 0 To $iHeight - 1 $iColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ;get current pixel color If $iColor = 4278255360 Then ;~ _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFFFF0000) ;~ ConsoleWrite($iX & "," & $iY & @CRLF) $X0 = $iX ExitLoop 2 EndIf Next Next ;~ _GDIPlus_BitmapSetPixel($hBitmap, $X0, $Y0, 0xFFFF0000) ConsoleWrite("TOP CORNER TEXT: " & $X0 & "," & $Y0 & @CRLF) Local $iFieldSizePixel14 = 16 Local $sNumber = "" For $iX = $X0 To $iWidth - 1 Step $iFieldSizePixel14 $sNumber &= _NumberFromPattern($hBitmap, $iX, $Y0) Next ConsoleWrite("Number: " & $sNumber & @CRLF) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==>Example Func _NumberFromPattern(ByRef $hBitmap, $X0, $Y0) Local $a3[] = ["0,4", "6,9"] Local $a7[] = ["0,0", "13,0"] Local $a4[] = ["9,0", "0,9"] Local $aSplit = 0 Local $iCount = 0 For $i = 0 To UBound($a3) - 1 $aSplit = StringSplit($a3[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 3 $iCount = 0 For $i = 0 To UBound($a7) - 1 $aSplit = StringSplit($a7[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 7 $iCount = 0 For $i = 0 To UBound($a4) - 1 $aSplit = StringSplit($a4[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 4 Return "" EndFunc ;==>_NumberFromPattern Using the image from here. You just need to build the pattern for the other numbers and try to make them unique. Saludos2 points
-
Try this part (it's one of the first ones I did) which piece only does the delimitation of the number area (and not the recognition of the pattern) where the procedures are a bit more simplified and it goes step by step, so you can figure out what the procedures are doing. #AutoIt3Wrapper_UseX64=N #include <WinAPI.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <Array.au3> #include <File.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> $aTSR = _GetTotalScreenResolution() ConsoleWrite("before -> Total Screen Resolution: " & $aTSR[0] & " x " & $aTSR[1] & @CRLF) ; Initialization DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 $aTSR = _GetTotalScreenResolution() ConsoleWrite("after -> Total Screen Resolution: " & $aTSR[0] & " x " & $aTSR[1] & @CRLF) ConsoleWrite("Desktop: " & @DesktopWidth & "x" & @DesktopHeight & @CRLF) ConsoleWrite("" & @CRLF) Global $hDLL = DllOpen("user32.dll") HotKeySet("{END}", "_Main") ; * <- selection of outer area with margin HotKeySet("{ESC}", "_Exit") ;********************************** While 1 Switch GUIGetMsg() Case -3 ;$GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;********************************** _Exit() Func _Exit() DllClose($hDLL) Exit EndFunc ;==>_Exit Func _Main() ; Main Program Local $aArea = SelectArea() ; Define the area to scan Local $hColor = 0x00FF00 ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($aArea) ;_ArrayDisplay($aColorMap) ; set outer area manual ;_Test(61, 212, 287, 498) _Test($aArea[0], $aArea[1], $aArea[2], $aArea[3]) EndFunc ;==>_Main Func _Test($iLeft, $iTop, $iRight, $iBottom, $hColor = 0x00FF00) Local $aArea = [$iLeft, $iTop, $iRight, $iBottom] ; area to scan ; Capture the color map for the specified area Local $colorMap = CaptureAreaColorMap($aArea) ; _ArrayDisplay($colorMap) ; and then try to find digit positions Local $aNumArea = FindGreenBoundariesUsingColorMap($colorMap, $aArea, $hColor) ;Local $aNumArea = [$firstRow, $lastRow, $firstCol, $lastCol] Local $aMarkArea[4] = [$aArea[0] + $aNumArea[2], $aArea[1] + $aNumArea[0], _ $aNumArea[3] - $aNumArea[2] + 1, $aNumArea[1] - $aNumArea[0] + 1] DRC($aMarkArea, 0xFF0000, "Color_Gui") ConsoleWrite("$MarkArea: x=" & $aMarkArea[0] & ", y=" & $aMarkArea[1] & ", w=" & $aMarkArea[2] & ", h=" & $aMarkArea[3] & @CRLF) EndFunc ;==>_Test Func CaptureAreaColorMap($aArea) ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the screen area as a bitmap Local $hBitmap = _ScreenCapture_Capture("", $aArea[0], $aArea[1], $aArea[2], $aArea[3]) ; Convert the captured bitmap to a GDI+ bitmap Local $hGDIPlusBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) ; Get the width and height of the captured area Local $width = $aArea[2] - $aArea[0] Local $height = $aArea[3] - $aArea[1] ; Create an array to store color values Local $colorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hGDIPlusBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $colorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hGDIPlusBitmap) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() Return $colorMap EndFunc ;==>CaptureAreaColorMap Func FindGreenBoundariesUsingColorMap($colorMap, $aArea, $hColor = 0x00FF00) Local $width = UBound($colorMap, 1) Local $height = UBound($colorMap, 2) ConsoleWrite("$width=" & $width & ", $height=" & $height & @CRLF) Local $firstRow = -1, $lastRow = -1, $firstCol = -1, $lastCol = -1, $blockWidth = 0 ; Scan for the first row with green color For $y = 0 To $height - 1 For $x = 0 To $width - 1 If $colorMap[$x][$y] = $hColor Then $firstRow = $y ExitLoop 2 EndIf Next Next ; Scan for the last row with green color For $y = $height - 1 To 0 Step -1 For $x = 0 To $width - 1 If $colorMap[$x][$y] = $hColor Then $lastRow = $y ExitLoop 2 EndIf Next Next ; Scan for the first column with green color For $x = 0 To $width - 1 For $y = 0 To $height - 1 If $colorMap[$x][$y] = $hColor Then $firstCol = $x ExitLoop 2 EndIf Next Next ; Scan for the last column with green color For $x = $width - 1 To 0 Step -1 For $y = 0 To $height - 1 If $colorMap[$x][$y] = $hColor Then $lastCol = $x ExitLoop 2 EndIf Next Next ; find the width of block pixel For $x = $firstCol To $width - 1 For $y = $firstRow To $height - 1 If $colorMap[$x][$y] = $hColor Then For $w = $x To $width - 1 If $colorMap[$w][$y] = $hColor Then $blockWidth += 1 Else ExitLoop 3 EndIf Next EndIf Next Next $blockSize = $blockWidth / 2 ConsoleWrite("$blockSize=" & $blockSize & @CRLF) ; each number Display is a matrix of 14x20 Vpoint ; each Vpoint is a 3x3 pixel ; each number Display is 42x60 pixel ConsoleWrite("X:" & $aArea[0] & " Y:" & $aArea[1] & @CRLF) ConsoleWrite("Area firstRow:" & $firstRow & " lastRow:" & $lastRow & " firstCol:" & $firstCol & " lastCol:" & $lastCol & @CRLF) Local $aNumArea = [$firstRow, $lastRow, $firstCol, $lastCol] Return $aNumArea EndFunc ;==>FindGreenBoundariesUsingColorMap ;Original code by Larry. ;Edited by BrettF Func _GetTotalScreenResolution() Local $aRet[2] Local Const $SM_CXVIRTUALSCREEN = 78 Local Const $SM_VIRTUALHEIGHT = 79 $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_CXVIRTUALSCREEN) $aRet[0] = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $aRet[1] = $VirtualDesktopHeight[0] Return $aRet EndFunc ;==>_GetTotalScreenResolution ;-------------------------------------------------------------------------------------------------------------------------------- Func SelectArea() ; SelectArea Local $aRecPos[4], $aMPos[2], $tPos ;, $aTipPos[4], $iX, $iY Local $iDeskWidth, $iDeskHeight, $iDeskLeft, $iDeskTop Local $sDevice, $hMonitor, $sCurDevice, $aData, $Status = 0 ; make Capture gui $hGUICapture = GUICreate("Capture_gui", 1, 1, 1, 1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetBkColor("0xFFFF00", $hGUICapture) ; $COLOR_YELLOW WinSetTrans($hGUICapture, "", 50) ; make mouse block gui $block_gui = GUICreate("block_gui", 1, 1, 1, 1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) WinSetTrans($block_gui, "", 1) GUISetState(@SW_SHOW, $block_gui) GUISetCursor($MCID_CROSS, 1, $block_gui) Sleep(200) Local $iMaxLoop = 1200, $iCntLoop = 0 While Sleep(10) $iCntLoop += 1 If $iCntLoop = $iMaxLoop Then ExitLoop ; get mouse coordinates $tPos = _WinAPI_GetMousePos() $aMPos[0] = DllStructGetData($tPos, 1) $aMPos[1] = DllStructGetData($tPos, 2) ; get $hMonitor from previously defined Mouse coordinates $hMonitor = _WinAPI_MonitorFromPoint($tPos) ; get monitor $aData appropriate for previously defined coordinates $aData = _WinAPI_GetMonitorInfo($hMonitor) If Not @error Then $sDevice = $aData[3] $iDeskLeft = DllStructGetData($aData[0], 1) $iDeskTop = DllStructGetData($aData[0], 2) $iDeskWidth = DllStructGetData($aData[0], 3) $iDeskHeight = DllStructGetData($aData[0], 4) EndIf ;move the $block_gui to active monitor If $sCurDevice <> $sDevice Then $sCurDevice = $sDevice ;ConsoleWrite("- $sCurDevice=" & $sCurDevice & @CRLF) WinMove($block_gui, "", $iDeskLeft, $iDeskTop, $iDeskWidth, $iDeskHeight) EndIf ; whait Left_mouse_button _IsPressed If _IsPressed("01", $hDLL) Then $Status = 1 $aMPos = MouseGetPos() $aRecPos[0] = $aMPos[0] $aRecPos[1] = $aMPos[1] ; Wait until key is released. While _IsPressed("01", $hDLL) Sleep(50) $aMPos = MouseGetPos() $aRecPos[2] = $aMPos[0] $aRecPos[3] = $aMPos[1] ; show Capture gui GUISetState(@SW_SHOW, $hGUICapture) WinMove($hGUICapture, "", $aRecPos[0], $aRecPos[1], $aRecPos[2] - $aRecPos[0], $aRecPos[3] - $aRecPos[1]) WEnd ElseIf _IsPressed("1B", $hDLL) Then ;1B=ESC key - emergency exit GUIDelete($hGUICapture) GUIDelete($block_gui) Return SetError(1, 1, 0) EndIf If $Status = 1 Then ExitLoop WEnd GUIDelete($hGUICapture) GUIDelete($block_gui) ConsoleWrite("outer area: " & $aRecPos[0] & ";" & $aRecPos[1] & ";" & $aRecPos[2] + $aRecPos[0] & ";" & $aRecPos[3] + $aRecPos[1] & @CRLF) Return $aRecPos EndFunc ;==>SelectArea Func DRC($aArray, $color = 0xFFFF00, $sTitle = "Gui") Local $gGUI = GUICreate($sTitle, $aArray[2], $aArray[3], $aArray[0], $aArray[1], $WS_POPUP, $WS_EX_TRANSPARENT) GUISetBkColor($color) WinSetTrans($gGUI, '', 150) GUISetState(@SW_SHOW, $gGUI) Return $gGUI EndFunc ;==>DRC My console output before -> Total Screen Resolution: 3840 x 1341 after -> Total Screen Resolution: 5760 x 2160 Desktop: 1920x1080 outer area: 124;273;426;670 $width=178, $height=124 $blockSize=3 X:124 Y:273 Area firstRow:29 lastRow:88 firstCol:43 lastCol:123 $MarkArea: x=167, y=302, w=81, h=60 P.S.: upload some numbers to 100% like this to make the rest num patterns and some test2 points
-
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 -
Hi @1stPK I made it work with this: #include <GUIConstantsEx.au3> #include <InetConstants.au3> #include <StringConstants.au3> #include "./Include/HTMLParser.au3" Opt("GUIOnEventMode", 1) #cs # taken from https://techblog.willshouse.com/2012/01/03/most-common-user-agents/ # Helps to avoid bot detection #ce HttpSetUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36') $sDate = "27-10-2024" $sHTML = FetchData($sDate) If @error <> 0 Then ConsoleWriteError(StringFormat("Failed to fetch data for ""%s""\n", $sDate)) Exit 1 EndIf ; Fix issue with missing space between multiple html element attributes $sHTML = StringRegExpReplace($sHTML, '(="[^"]+")([^ \/>;,])', "$1 $2") ; Fix issue with multiple lt $sHTML = StringRegExpReplace($sHTML, '<{2,}', "<") $tHTML = ParseData($sHTML) If @error <> 0 Then ConsoleWriteError(StringFormat("Failed to parse data for ""%s""\n", $sDate)) Exit 1 EndIf $pNode = _HTMLParser_GetFirstStartTag($tHTML.head) If @error <> 0 Then ConsoleWriteError(StringFormat("Failed to find first tag in data for ""%s""\n", $sDate)) Exit 1 EndIf $hWnd = GUICreate("kết quả xổ số", 700, 320) GUISetOnEvent($GUI_EVENT_CLOSE, "GuiClose", $hWnd) $label1 = GUICtrlCreateLabel("Giải đặc biệt: đang tải...", 10, 10, 680, 20) $label2 = GUICtrlCreateLabel("Giải nhất: đang tải...", 10, 30, 680, 20) $label3 = GUICtrlCreateLabel("Giải nhì: đang tải...", 10, 50, 680, 20) $label4 = GUICtrlCreateLabel("Giải ba: đang tải...", 10, 70, 680, 20) $label5 = GUICtrlCreateLabel("Giải tư: đang tải...", 10, 90, 680, 20) $label6 = GUICtrlCreateLabel("Giải năm: đang tải...", 10, 110, 680, 20) $label7 = GUICtrlCreateLabel("Giải sáu: đang tải...", 10, 130, 680, 20) $label8 = GUICtrlCreateLabel("Giải bảy: đang tải...", 10, 150, 680, 20) GUISetState(@SW_SHOW, $hWnd) $sText = ExtractText($pNode, "giaidb") GUICtrlSetData($label1, "Giải đặc biệt: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai1") GUICtrlSetData($label2, "Giải nhất: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai2") GUICtrlSetData($label3, "Giải nhì: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai3") GUICtrlSetData($label4, "Giải ba: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai4") GUICtrlSetData($label5, "Giải tư: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai5") GUICtrlSetData($label6, "Giải năm: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai6") GUICtrlSetData($label7, "Giải sáu: " & (@error <> 0 ? "Lỗi" : $sText)) $sText = ExtractText($pNode, "giai7") GUICtrlSetData($label8, "Giải bảy: " & (@error <> 0 ? "Lỗi" : $sText)) While 1 Sleep(10) Wend Func FetchData($sDate) Local $sURL = StringFormat("https://www.minhngoc.net.vn/ket-qua-xo-so/mien-bac/%s.html", $sDate) Local $dData = InetRead($sURL, BitAND($INET_BINARYTRANSFER, $INET_FORCEBYPASS)) If @error <> 0 Then ConsoleWriteError(StringFormat("Failed to fetch data for ""%s""\n", $sURL)) Return SetError(1) EndIf Return BinaryToString($dData) EndFunc Func ParseData($sHTML) Local $tTokenList = _HTMLParser($sHTML) If @error <> 0 Then Return SetError(1) ; Check if all HTML was parsed If @extended < StringLen($sHTML) Then Return SetError(2) Return $tTokenList EndFunc Func ExtractText($pNode, $sClassName) Local $aNodes = _HTMLParser_GetElementsByClassName($sClassName, $pNode) If @error <> 0 Then Return SetError(1) $pNode = $aNodes[0] Local $aText = _HTMLParser_Element_GetText($pNode) Local $sText = "" For $pText In $aText $tNode = __doublyLinkedList_Node($pText) $sText &= " " & StringRegExpReplace(__HTMLParser_GetString($tNode.data), "^\s+|\s+$", "") Next Return $sText EndFunc Func GuiClose() Exit EndFunc I used my html parser for this, but a better parser solution could also work, or go back to regex I used google translate for the Vietnamese strings i added, so they might be wrong I'll also attach my solution with includes to this post. Hope it helps! 212413.zip2 points
-
Hi all, I haven't had a ton of time to throw at this of late, so just an incremental tonight (while I can still remember what's changed!). The generation script is largely the same as last go around. Fixed tags for some interfaces (functions with no params were incorrectly generated, invalidating the tag.) WaitForAsync now accepts AsyncAction objects (previously it'd only work with AsyncOperation objects) I'm trawling through all the inbuilt metadata files now, so there's literally thousands of libraries in this latest upload. I've hit the size limit for posting here, hence the sourceforge link up the top! Updated the "calltips installer" script - this is now included in the zip file. Updated the "class explorer" script to something that's hopefully a bit more presentable - this one is still a separate download.2 points
-
Set file properties
Champak and one other reacted to SOLVE-SMART for a topic
Could you give an example of how you used it to write? Hi @Champak 👋 , exiftool is a command-line application which can be call through console/terminal, via batch or AutoIt etc. Here is a simple example to change title and comment like you mentioned in your first post. // Set specific properties to a file (creates a new file). exiftool -title="This is my title" -comment="This is my comment" "C:\Store\my-file.mp4" // Set specific properties to a file (overwrite the original file). exiftool -overwrite_original -title="This is my title" -comment="This is my comment" "C:\Store\my-file.mp4" Adjust the placeholder texts and I hope this will help you 😀 . Best regards Sven2 points -
That works for me : #include <Constants.au3> #include <InetConstants.au3> Local $sSite = BinaryToString(InetRead("https://www.aida64.com/downloads/latesta64ee", $INET_FORCERELOAD)) ConsoleWrite(StringRegExp($sSite, "Request Trial Download AIDA64 Engineer ([^ ]+)", 1)[0] & @CRLF) 7.40.71002 points
-
I was aiming at the same solution as @ioa747. The problem you have is probably because you do not own the DejaVu Sans Mono font. Try with Courier or Terminal font. It should work.1 point
-
How to remove the white bar at the top of the window? (after removing window title)
SEKOMD reacted to pixelsearch for a topic
Results on my computer, in the pic above : * Left = OP's script (white border fully visible in this Popup GUI having a size border) * Mid = WM_NCPAINT with a Pen having a width of 1 unit (only a part of the border is red) * Right = WM_NCPAINT with a Pen having a width of 5 units (all the border is red) For what it's worth...1 point -
How to remove the white bar at the top of the window? (after removing window title)
ioa747 reacted to pixelsearch for a topic
Hi ioa747, maybe he can't do this, because the GUI should stay resizable ? Does the following script work for you, registering WM_NCPAINT to paint the GUI frame when needed : #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> Global $g_iGuiBkColor = $COLOR_RED $hGUI = GUICreate('', 400, 300, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME)) ; $WS_THICKFRAME same as $WS_SIZEBOX GUISetBkColor($g_iGuiBkColor, $hGUI) GUIRegisterMsg($WM_NCPAINT, "WM_NCPAINT") ; before GUISetState (+++) . Interesting to test it just after GUISetState ! GUISetState(@SW_SHOW, $hGUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Esc will terminate (as no close button in this GUI) ;============================================ Func WM_NCPAINT($hWnd, $iMsg, $wParam, $lParam) Local $hDC, $hPen, $OldPen, $hBrush, $OldBrush, $aHwndPos, $tRECT $hDC = _WinAPI_GetWindowDC($hWnd) $hPen = _WinAPI_CreatePen($PS_SOLID, 5, _RGB2BGR($g_iGuiBkColor)) ; 5 should be enough for a thick GUI border $OldPen = _WinAPI_SelectObject($hDC, $hPen) $hBrush = _WinAPI_GetStockObject($NULL_BRUSH) ; same as $HOLLOW_BRUSH $OldBrush = _WinAPI_SelectObject($hDC, $hBrush) $aHwndPos = WinGetPos($hWnd) $tRECT = _WinAPI_CreateRect(1, 1, $aHwndPos[2], $aHwndPos[3]) _WinAPI_Rectangle($hDC, $tRECT) ; draw the rectangle _WinAPI_SelectObject($hDC, $OldBrush) _WinAPI_SelectObject($hDC, $OldPen) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC($hWnd, $hDC) Return 0 ; works (GUI border got the same color as GUI background color) ; Return 1 ; works ; Return $GUI_RUNDEFMSG ; doesn't work (GUI border is visible in its native color) ; Return ; doesn't work (i think Return $GUI_RUNDEFMSG or Return always have the same effect) EndFunc ;==>WM_NCPAINT ;============================================ Func _RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc ;==>_RGB2BGR1 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
-
According to the docs, it returns it's result, it doesn't set @error. so: $error = DirCreate("C:\Folder1") MsgBox(0,'$error',$error)1 point