Leaderboard
Popular Content
Showing content with the highest reputation on 11/07/2024 in all areas
-
@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.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 -
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
-
Loop over 1M numbers fails on 9964th iteration
ioa747 reacted to argumentum for a topic
..the memory use increase is slower in this 5.0.1 version.1 point -
Here it is the edition with a single column patern ; https://www.autoitscript.com/forum/topic/211521-ocr-from-a-small-area/?do=findComment&comment=1538057 ; Version: 5.0.2 #include <GDIPlus.au3> #include <Array.au3> #include <File.au3> #include <WinAPIProc.au3> ;~ Local $Result = _GetNumber(@ScriptDir & "\100num\040.png") ;~ MsgBox($MB_SYSTEMMODAL, "_GetNumber", $Result) Test("M:\TEMP\100num") ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetNumber($sFileName, $hColor = 0x00FF00) ; Main Program ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($sFileName) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf ;~ _ArrayDisplay($aColorMap) Local $Result = FindNumberUsingColorMap($aColorMap, $hColor) ;~ MsgBox($MB_SYSTEMMODAL, "$Result", $Result) ; Cleanup resources _GDIPlus_Shutdown() Return $Result EndFunc ;==>_GetNumber ;-------------------------------------------------------------------------------------------------------------------------------- Func CaptureAreaColorMap($sFileName) ; create color map array ; Initialize GDI+ to work with bitmaps ;_GDIPlus_Startup() ; Capture the screen area as a bitmap Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFileName) If @error Then Return SetError(1, 0, "") ; because the user ( me ) might do the unexpected ;) ; Get the width and height of the captured area Local $width = _GDIPlus_ImageGetWidth($hBitmap) Local $height = _GDIPlus_ImageGetHeight($hBitmap) ;~ ConsoleWrite("Image: $width=" & $width & ", $height=" & $height & @CRLF) ; Create an array to store color values Local $aColorMap[$width][$height] ; Loop through each pixel in the bitmap and retrieve its color For $y = 0 To $height - 1 For $x = 0 To $width - 1 ; Get the pixel color from the bitmap in ARGB format Local $argbColor = _GDIPlus_BitmapGetPixel($hBitmap, $x, $y) ; Convert ARGB to BGR for comparison (ignore the alpha channel) Local $bgrColor = BitAND($argbColor, 0x00FFFFFF) $aColorMap[$x][$y] = $bgrColor Next Next ; Cleanup resources _GDIPlus_BitmapDispose($hBitmap) ;_GDIPlus_Shutdown() Return $aColorMap EndFunc ;==>CaptureAreaColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func FindNumberUsingColorMap($aColorMap, $hColor = 0x00FF00) ; find number in color map array Local $width = UBound($aColorMap, 1) Local $height = UBound($aColorMap, 2) Local $firstRow = -1, $lastRow = -1, $firstCol = -1, $lastCol = -1 ; Scan for the first and last rows and columns with $hColor pixels For $y = 0 To $height - 1 For $x = 0 To $width - 1 If $aColorMap[$x][$y] = $hColor Then If $firstRow = -1 Then $firstRow = $y $lastRow = $y If $firstCol = -1 Or $x < $firstCol Then $firstCol = $x If $lastCol = -1 Or $x > $lastCol Then $lastCol = $x EndIf Next Next If $firstRow = -1 Or $lastRow = -1 Or $firstCol = -1 Or $lastCol = -1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No color found" & @TAB & @TAB) Exit EndIf ; each number Display is a matrix of 14x20 pixels Local $numberWidth = 14 ; set number width per digit Local $numberSpace = 2 ; set Space between digits Local $Empty = 0, $Corection = 0 ; Corection for boundaries if 1st digit = 1 For $x = $firstCol To $lastCol - 1 If $aColorMap[$x][$firstRow] = 0x000000 Then $Empty += 1 If $Empty = 3 Then ;found 1st Space between digits $Corection = $firstCol - 1 - Abs($x - $numberWidth - $numberSpace) ExitLoop EndIf Else $Empty = 0 EndIf Next If $Corection > 0 Then $firstCol = $firstCol - $Corection Local $numberStart = $firstCol ;~ ConsoleWrite("$Corection=" & $Corection & @CRLF) ;~ ConsoleWrite("Display_boundaries firstRow:" & $firstRow & " lastRow:" & $lastRow & " firstCol:" & $firstCol & " lastCol:" & $lastCol & @CRLF) ;~ ConsoleWrite("" & @CRLF) Local $aNum[11][3] ; Define boundaries for each number position For $i = 1 To 10 $aNum[$i][0] = $numberStart $aNum[$i][1] = $numberStart + $numberWidth If $numberStart + $numberWidth + $numberSpace > $lastCol Then ExitLoop $numberStart += $numberWidth + $numberSpace $aNum[0][0] = $i + 1 Next ;~ _ArrayDisplay($aNum) Local $sNumber ; Generate patterns for each found number For $i = 1 To $aNum[0][0] Local $sPattern = "" For $y = $firstRow To $lastRow $x = $aNum[$i][0] If $aColorMap[$x][$y] = $hColor Then $sPattern &= "1" Else $sPattern &= "." EndIf $sPattern &= @CRLF Next $sNumber &= _GetPattern($sPattern) Next Return $sNumber EndFunc ;==>FindNumberUsingColorMap ;-------------------------------------------------------------------------------------------------------------------------------- Func _GetPattern($sPattern) ; patterns for each digit ;~ ConsoleWrite("**************" & @CRLF & $sPattern & @CRLF) Local Static $aPNum ; Define simplified patterns for each digit If Not IsArray($aPNum) Then Local $aNumber[10] $aNumber[0] = "" ; Pattern for '0' $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "1" & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[0] &= "." & @CRLF $aNumber[1] = "" ; Pattern for '1' $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[1] &= "." & @CRLF $aNumber[2] = "" ; Pattern for '2' $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "." & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[2] &= "1" & @CRLF $aNumber[3] = "" ; Pattern for '3' $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "1" & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[3] &= "." & @CRLF $aNumber[4] = "" ; Pattern for '4' $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "1" & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[4] &= "." & @CRLF $aNumber[5] = "" ; Pattern for '5' $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "1" & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[5] &= "." & @CRLF $aNumber[6] = "" ; Pattern for '6' $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "1" & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[6] &= "." & @CRLF $aNumber[7] = "" ; Pattern for '7' $aNumber[7] &= "1" & @CRLF $aNumber[7] &= "1" & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[7] &= "." & @CRLF $aNumber[8] = "" ; Pattern for '8' $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "1" & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[8] &= "." & @CRLF $aNumber[9] = "" ; Pattern for '9' $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "1" & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aNumber[9] &= "." & @CRLF $aPNum = $aNumber EndIf Switch $sPattern Case $aPNum[0] Return 0 Case $aPNum[1] Return 1 Case $aPNum[2] Return 2 Case $aPNum[3] Return 3 Case $aPNum[4] Return 4 Case $aPNum[5] Return 5 Case $aPNum[6] Return 6 Case $aPNum[7] Return 7 Case $aPNum[8] Return 8 Case $aPNum[9] Return 9 Case Else Return SetError(1, 0, "") EndSwitch EndFunc ;==>_GetPattern ;-------------------------------------------------------------------------------------------------------------------------------- Func Test($sFolderPath, $hColor = 0x00FF00) ; _GetNumber for all the *.png files in $sFolderPath directory ; List all the *.png files in $sFolderPath directory Local $aFileList = _FileListToArray($sFolderPath, "*.png", $FLTA_FILES) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "No file(s) were found.") Exit EndIf _ArrayColInsert($aFileList, 1) ; add 1 column to hold the numbers ; Initialize GDI+ to work with bitmaps _GDIPlus_Startup() Local $cnt = 0 Local $CleanTime = 0 Local $hTimer = TimerInit() For $j = 1 To 100 For $i = 1 To $aFileList[0][0] $cnt += 1 ConsoleWrite("$cnt: " & $cnt & @CRLF) ; Capture the color map for the specified area Local $aColorMap = CaptureAreaColorMap($sFolderPath & "\" & $aFileList[$i][0]) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "LineNumber:" & @ScriptLineNumber, "Path was invalid.") Exit EndIf $aFileList[$i][1] = FindNumberUsingColorMap($aColorMap, $hColor) ; Rename a file using FileMove and overwrite the new file if it exists. ;~ FileMove($sFolderPath & "\" & $aFileList[$i][0], $sFolderPath & "\" & $aFileList[$i][1] & ".png", $FC_OVERWRITE) ;~ $aProcessMemoryInfo = _WinAPI_GetProcessMemoryInfo() ;~ ConsoleWrite('The peak working set: ' & $aProcessMemoryInfo[1] / 1024 / 1014 & ' MB' & @CRLF) Next Next ConsoleWrite("processed in: " & Round(TimerDiff($hTimer) / 1000, 3) & " seconds " & @LF) _ArrayDisplay($aFileList, "$aFileList") ; Cleanup resources _GDIPlus_Shutdown() EndFunc ;==>Test ;--------------------------------------------------------------------------------------------------------------------------------1 point
-
Ok, I understand what you mean now. Adding all the pixels from the first column will give a unique value.1 point
-
Yes, but you are supposed to skip those second ones, and only read the needed ones, i'll see if I can mock up an example later using pixelgetcolor, dinner time now. 😛1 point
-
_ArrayBinarySearch Not finding value?
pixelsearch reacted to Nine for a topic
Maybe because the value included in the array are strings not numbers ? ps. please provide a runable script as you should know by now. A picture doesn't help any bit. Try to make it easy for us to help you1 point -
WebP v0.3.1 build 2022-06-18 beta
PoneToungthar reacted to UEZ for a topic
You can use _GDIPlus_ImageResize() instead. You have to do some math if you want to keep aspect ratio.1 point -
Loop over 1M numbers fails on 9964th iteration
Hashim reacted to argumentum for a topic
I use ImDisk. Make the ramdisk any size.1 point -
StringSplit Example
mr-es335 reacted to pixelsearch for a topic
Not specific at all and I meant nothing Your revised script is ok for your own use because you got the "Type_1" and "Type_2" folders on your computer. But now anybody on the Forum launching your example will be stuck inside the loop without a way to end the script gracefully, no matter they choose a path containing numerous backslash. Maybe a warning before your script should indicate this, you'll decide.1 point -
StringSplit Example
pixelsearch reacted to mr-es335 for a topic
pixelsearch, Having what I would refer to as "a working knowledge" of the available syntax is indeed significant...as can be clearly demonstrated here with the deployment of "ContinueLoop"! You have resolved two my previous issues here: 1) Determining if there is a more preferable means of error checking than "If...ElseIf...Else...EndIf"? • It would appear, that Select|Case, is. if I may used the term "cleaner", than If...Then's... 2) That the employment of Select|Case appears to highlight, what I would refer to as, "the order of precedence" and the deployment of "exit codes". Lastly, that, for whatever reason, the employment of "FileSelectFolder", seemed to imply the employment of "StringSplit" [...at least from the many examples that I have come across...] ...where the employment of "StringExtraction" may have been more appropriate....especially here....my present situation? What do you think? As always, pixelsearch, I do so very, very, very much appreciate your efforts pm my behalf. I have learnt a great deal today! • Just curious, did you happen to appreciate my hopefully, "sense of humor" with regards to "MsgBox($MB_ICONNONE, "You have chosen an inappropriate Type_# folder!:", "Prepare to die!")?1 point -
Loop over 1M numbers fails on 9964th iteration
Hashim reacted to argumentum for a topic
For $n = 0 To 100 $aProcessMemoryInfo = _WinAPI_GetProcessMemoryInfo() ConsoleWrite( _GetNumber(@ScriptDir & "\code__51" & StringRight($n, 1) & "___.png") & @TAB & 'The peak working set: ' & $aProcessMemoryInfo[1] / 1024 / 1024 & ' MB'& @CRLF) Next 510 The peak working set: 29.23046875 MB 511 The peak working set: 30.31640625 MB 512 The peak working set: 30.4375 MB 513 The peak working set: 30.47265625 MB 514 The peak working set: 30.484375 MB 515 The peak working set: 30.5 MB 516 The peak working set: 30.50390625 MB 517 The peak working set: 30.5078125 MB 518 The peak working set: 30.515625 MB 519 The peak working set: 30.5234375 MB 510 The peak working set: 30.5234375 MB 511 The peak working set: 30.5234375 MB 512 The peak working set: 30.53125 MB 513 The peak working set: 30.53125 MB 514 The peak working set: 30.54296875 MB 515 The peak working set: 30.54296875 MB 516 The peak working set: 30.546875 MB 517 The peak working set: 30.5546875 MB 518 The peak working set: 30.5546875 MB 519 The peak working set: 30.5546875 MB 510 The peak working set: 30.5546875 MB 511 The peak working set: 30.5546875 MB 512 The peak working set: 30.5546875 MB 513 The peak working set: 30.5546875 MB 514 The peak working set: 30.5546875 MB 515 The peak working set: 30.5546875 MB 516 The peak working set: 30.5546875 MB 517 The peak working set: 30.5546875 MB 518 The peak working set: 30.5546875 MB 519 The peak working set: 30.5546875 MB 510 The peak working set: 30.5546875 MB 511 The peak working set: 30.5546875 MB 512 The peak working set: 30.5703125 MB 513 The peak working set: 30.57421875 MB 514 The peak working set: 30.57421875 MB 515 The peak working set: 30.578125 MB 516 The peak working set: 30.578125 MB 517 The peak working set: 30.59375 MB 518 The peak working set: 30.59375 MB 519 The peak working set: 30.59375 MB 510 The peak working set: 30.59375 MB 511 The peak working set: 30.59375 MB 512 The peak working set: 30.59375 MB 513 The peak working set: 30.59375 MB 514 The peak working set: 30.59375 MB 515 The peak working set: 30.59375 MB 516 The peak working set: 30.59375 MB 517 The peak working set: 30.59375 MB 518 The peak working set: 30.59375 MB 519 The peak working set: 30.59375 MB 510 The peak working set: 30.59765625 MB 511 The peak working set: 30.59765625 MB 512 The peak working set: 30.6015625 MB 513 The peak working set: 30.6015625 MB 514 The peak working set: 30.6015625 MB 515 The peak working set: 30.6015625 MB 516 The peak working set: 30.609375 MB 517 The peak working set: 30.61328125 MB 518 The peak working set: 30.62109375 MB 519 The peak working set: 30.62109375 MB 510 The peak working set: 30.625 MB 511 The peak working set: 30.62890625 MB 512 The peak working set: 30.62890625 MB 513 The peak working set: 30.63671875 MB 514 The peak working set: 30.640625 MB 515 The peak working set: 30.640625 MB 516 The peak working set: 30.64453125 MB 517 The peak working set: 30.65234375 MB 518 The peak working set: 30.65234375 MB 519 The peak working set: 30.65234375 MB 510 The peak working set: 30.671875 MB 511 The peak working set: 30.68359375 MB 512 The peak working set: 30.6875 MB 513 The peak working set: 30.6875 MB 514 The peak working set: 30.69140625 MB 515 The peak working set: 30.6953125 MB 516 The peak working set: 30.6953125 MB 517 The peak working set: 30.6953125 MB 518 The peak working set: 30.6953125 MB 519 The peak working set: 30.6953125 MB 510 The peak working set: 30.6953125 MB 511 The peak working set: 30.6953125 MB 512 The peak working set: 30.6953125 MB 513 The peak working set: 30.6953125 MB 514 The peak working set: 30.6953125 MB 515 The peak working set: 30.6953125 MB 516 The peak working set: 30.6953125 MB 517 The peak working set: 30.6953125 MB 518 The peak working set: 30.6953125 MB 519 The peak working set: 30.6953125 MB 510 The peak working set: 30.6953125 MB 511 The peak working set: 30.6953125 MB 512 The peak working set: 30.6953125 MB 513 The peak working set: 30.6953125 MB 514 The peak working set: 30.6953125 MB 515 The peak working set: 30.6953125 MB 516 The peak working set: 30.6953125 MB 517 The peak working set: 30.6953125 MB 518 The peak working set: 30.6953125 MB 519 The peak working set: 30.6953125 MB 510 The peak working set: 30.6953125 MB ..in just 100 _GetNumber() the memory increases 2 MB. It's got sporadic jumps in memory usage ?1 point -
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.1 point
-
StringSplit Example
mr-es335 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 helps1 point -
Loop over 1M numbers fails on 9964th iteration
ioa747 reacted to argumentum for a topic
... ; 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 $sPattern &= ($aColorMap[$x][$y] = $hColor ? "1" : ".") ; shave a nanosecond ? Next $sPattern &= @CRLF Next $sNumber &= _GetPattern($sPattern) Next ...0 points