Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/14/2021 in all areas

  1. You summon the cat with your bell, yet you should realize that this ‘meal’ will hardly satisfy him, and he will now prowl for larger game
    3 points
  2. https://developer.mozilla.org/en-US/docs/Web/API/Window/open#window_features Edit: It's often helpful to check out the internal code... in this case it's nice because it is passed to _WD_ExecuteScript using window.open in JavaScript
    2 points
  3. What's New in Version v1.9.3 - Added 2 new algorithm-specific functions. _CryptoNG_AES_ECB_EncryptData _CryptoNG_AES_ECB_DecryptData Added an AES ECB example to the example file. Added AES ECB functions to the Help File. Modified helper functions to accommodate AES ECB functions. Updated the supplied calltips and userudfs files. Misc aesthetic modifications to the code
    1 point
  4. smbape

    OpenCV v4 UDF

    Hi again @Lion66 The theory was correct. Using cv::convexHull, it is possible to determine if a polygone is concave. Local $hull = _VectorOfPointCreate() Local $o_arr_hull = _cveOutputArrayFromVectorOfPoint($hull) _cveConvexHull($i_arr_dst_int32, $o_arr_hull) For $i = 0 To _VectorOfPointGetSize($dst_int32) - 1 _VectorOfPointGetItemPtr($dst_int32, $i, $tPointFPtr) Local $dst_int32_i = DllStructCreate($tagCvPoint, $tPointFPtr.value) _VectorOfPointGetItemPtr($hull, $i, $tPointFPtr) Local $hull_i = DllStructCreate($tagCvPoint, $tPointFPtr.value) If $hull_i.x <> $dst_int32_i.x Or $hull_i.y <> $dst_int32_i.y Then ConsoleWrite("Concave contour" & @CRLF) ExitLoop EndIf Next _cveOutputArrayRelease($o_arr_hull) _VectorOfPointRelease($hull) See the attached code. 160732-opencv-udf.au3
    1 point
  5. Musashi

    need help with regex

    You are right . I just followed the questioner's specification, but StringRegExp is the more suitable function. The pattern given by @mikell is the simplest (and obvious) solution when using StringRegExp here. It also matches, if any preceding line of text contains the word CPU.
    1 point
  6. mikell

    need help with regex

    @Musashi My 2 cents $txt = "GPU 45°C" & @crlf & _ "CPU 51°C" & @crlf & _ "C0% 9.6" & @crlf & _ "MHz 2968" & @crlf & _ "FID 29.75" Msgbox(0,"", StringRegExp($txt, "(CPU.*C)", 1)[0] ) The "C" is probably useless ... but requirements are requirements
    1 point
  7. seadoggie01

    need help with regex

    I guess since y'all are using StringRegExpReplace, yes. However, if you use StringRegExp instead, then you don't have to worry about it. Local $aRet = StringRegExp($sText, "(CPU\s+.*)", 3) return $aRet[0] ; Or, if you're feeling daring, assume that you always want the first line... Local $aRet = StringRegExp($sText, "(.*)", 3) return $aRet[0] As an added bonus, I got it in 4 characters, @Musashi
    1 point
  8. Unfortunately no. But I can feel your love for your daddy and I will be happy to make a reduced and custom-designed player for your daddy along the following lines: 1. When the program is run for the first time, it will make an alphbetical list of video files and play them forever until you press Pause or Exit button. 2. When the program is run the next time, it will start playing the last file you were playing when you exited the last time. 3. The screen will always be a maximized window. You can change to fullscreen mode through context menu. 4. A small GUI at the right bottom of the screen will have 4 buttons(Play/Pause, Next, Previous and Exit) and a progress bar. I will post the code when I'm done. I hope I can do it in several days. In the mean time, please let me know if you want to have any other function included.
    1 point
  9. Thanks for the very useful feedback @seadoggie01 Yeah i agree feedback on the fields are missing About the versioning it's tricky. I plan to use semantic versioning instead of file versioning used by AutoIt3. This has more to do with standardizing when comparing usage with other package managers for other languages. That being said it should be explained to the user 😓 The logging in getting stuck I'm aware of, and have fixed on my codesandbox (dev env), just haven't pushed and build on GitHub. It occurs only when promted with granting access dialogue, so i missed it until lately, since i had not revoked access before then. But i will take your feedback to heart, and by next iteration, UX will be more in focus
    1 point
  10. The lock file is not implemented yet, but it is in planning but the concept of only committing the config file, and not the dependecies themselves is working, like on my DllStructEx repo. (the au3pm.json file)
    1 point
  11. Bit of feedback on the website: adding a package request isn't terribly understandable... some hints would be nice. I also had an issue logging in, it was stuck in a loop until I refreshed the page, but I'm not sure about that being your problem. And the plus button shows on all pages, which is a bit weird The commit was super unclear... I expected to need the short string that GitHub shows, like 'Latest commit 3d29209 on Mar 18'. A dropdown or hint is probably needed The package name was fine, but I wasn't sure if I should include ".au3" The version number didn't allow a 4 part version, as commonly (I think anyways) seen on UDFs. Saying why it failed would be nice I'm sure that it's also pretty beta though, so I like it!
    1 point
  12. No problem. Since my last post, I have tried out NPM once again and I see how it can be beneficial, one key component that I realized is that you can skip committing the "node modules" directory to the source control, many projects however do this and the result is huge repo sizes with just bloat. The approach of just committing the package-lock.json (or whatever it is called) and calling npm to download all the deps after a fresh clone is far better IMO Make sure you implement this in au3pm too
    1 point
  13. I understand how you feel, when looking at current practices of AutoIt file includes. But having them globally creates problems when many projects may need the same dependency, but at different versions, and those dependencies, and so on. A lot of problems with AutoIt includes became apparent for me, as I've been developing this project, and i do have some plans to address most, if not all of them. It does however drastically change how AutoIt includes will work in the future, and presents a lot of code needed, to get to an ideal solution. That is correct As i currently have no plans of throwing money at this, and still want it to be reliably accessible, it seemed like a good approach to me. Thanks . Sorry for the late reply, i did read your post less than 24 hours after you posted it, but didn't take the time to reply and it got away from me 😓
    1 point
  14. Small update: The default package manger lookup repo now has a website for viewing and creating packages https://au3pm.github.io/#/ It is important to note that everything is still pre-release, so this may not reflect the final product.
    1 point
  15. smbape

    OpenCV v4 UDF

    The distance between 2 points (x1, y1), (x2, y2) is given by sqrt((x1 - x2)² + (y1 - y2)²) Use it to compare the distance between the 4 corners. If two corners are too close, do what you want Local $mindist = 10 Local $points[4]= [$dst_0, $dst_1, $dst_2, $dst_3] For $i = 0 To 3 For $j = $i + 1 To 3 If Sqrt((($points[$i].x - $points[$j].x) ^ 2) + (($points[$i].y - $points[$j].y) ^ 2)) < $mindist Then ConsoleWrite("Points are too close" & @CRLF) ExitLoop 2 EndIf Next Next
    1 point
  16. smbape

    OpenCV v4 UDF

    There is a red frame. However, the points are so close that it displays a red line. Look at the window "found" to see it. Here are the coordinates of the points $dst_0 [ 144.033889770508, 192.807693481445 ] $dst_1 [ 147.521987915039, 180.503540039063 ] $dst_2 [ 142.773986816406, 197.195739746094 ] $dst_3 [ 155.550369262695, 152.486877441406 ]
    1 point
  17. The code you posted doesnt work as @Nine and I were discussing, because of how the BMP data are indexed. This one works, the GetRawBitmap is pretty slow (about 60 ms for my test case when the FetchColors takes about 20, basically it will depend on the height of your image) because we reindex the data (by moving each chunk one by one), if you want it to be fast it is possible to don't move them, and just access with the correct indexing regarding the stride. #include <GDIPlus.au3> #include <GDIPlusConstants.au3> #include <WinAPIMisc.au3> func println($smg = '') ConsoleWrite($smg & @CRLF) endfunc ; just for testing purpose, you shouldn't deploy with this kind of stuff ; when ragequiting the script, windows should release the process mem and allocated handles (thanks Microsoft) func assert($check, $line = @SCRIPTLINENUMBER) if not $check then MsgBox(0x10, 'ERROR', 'Assert failed at line ' & $line) Exit endif endfunc global $OX = [5, 10, 15, 20, 25] global $OY = [7, 11, 13, 17, 19] func FetchColors($aWinHandle) local $tmp = WinGetPos($aWinHandle) assert(@ERROR = 0) local $width = $tmp[2] local $height = $tmp[3] local $hDDC = _WinAPI_GetDC($aWinHandle) assert($hDDC <> 0) local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) assert($hCDC <> 0) local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $width, $height) assert($hBMP <> 0) $tmp = _WinAPI_SelectObject($hCDC, $hBMP) assert($tmp <> 0) $tmp = _WinAPI_PrintWindow($aWinHandle, $hCDC) assert($tmp = True) ; $tmp = _WinAPI_BitBlt($hCDC, 0, 0, $width, $height, $hDDC, 0, 0, 0x00CC0020) ; assert($tmp = True) local $BMP = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) assert(@ERROR = 0) local $ret = ObjCreate('scripting.dictionary') for $x in $OX for $y in $OY local $key = $x & ':' & $y local $val = _GDIPlus_BitmapGetPixel($BMP,$x,$y) assert(@ERROR = 0) ; println('[' & StringFormat('%02d:%02d',$x,$y) & '] 0x' & hex($val,6)) $ret.Add($key,$val) next next _GDIPlus_BitmapDispose($BMP) _WinAPI_DeleteObject($hBMP) _WinAPI_ReleaseDC($aWinHandle, $hDDC) _WinAPI_DeleteDC($hCDC) return $ret endfunc func GetBPP($type) local $ret = [0,''] switch $type ; $GDIP_PXF01INDEXED ; 1 bpp, indexed ; $GDIP_PXF04INDEXED ; 4 bpp, indexed case $GDIP_PXF08INDEXED $ret[0] = 1 $ret[1] = 'BYTE' case $GDIP_PXF16GRAYSCALE, $GDIP_PXF16RGB555, $GDIP_PXF16RGB565, $GDIP_PXF16ARGB1555 $ret[0] = 2 $ret[1] = 'WORD' ; $GDIP_PXF24RGB ; 24 bpp - 8 bits for each RGB case $GDIP_PXF32RGB, $GDIP_PXF32ARGB, $GDIP_PXF32PARGB $ret[0] = 4 $ret[1] = 'DWORD' case else MsgBox(0x10, 'ERROR', 'Unsupported bpp') Exit endswitch return $ret endfunc func GetRawBitmap($aWinHandle, $type = $GDIP_PXF32RGB) local $bpp = GetBPP($type) local $tmp = WinGetPos($aWinHandle) assert(@ERROR = 0) local $width = $tmp[2] local $height = $tmp[3] local $hDDC = _WinAPI_GetDC($aWinHandle) assert($hDDC <> 0) local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) assert($hCDC <> 0) local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $width, $height) assert($hBMP <> 0) $tmp = _WinAPI_SelectObject($hCDC, $hBMP) assert($tmp <> 0) $tmp = _WinAPI_PrintWindow($aWinHandle, $hCDC) assert($tmp = True) ; $tmp = _WinAPI_BitBlt($hCDC, 0, 0, $width, $height, $hDDC, 0, 0, 0x00CC0020) ; assert($tmp = True) local $BMP = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) assert(@ERROR = 0) local $data = _GDIPlus_BitmapLockBits($BMP, 0, 0, $width, $height, $GDIP_ILMREAD, $type) assert(@ERROR = 0) local $raw = DllStructCreate($bpp[1] & '[' & ($width * $height) & ']') local $row_size = $width * $bpp[0] if ($data.stride < 0 or $data.stride <> $row_size) then local $dst = DllStructGetPtr($raw) local $src = $data.Scan0 for $y = 1 to $height _WinAPI_MoveMemory($dst, $src, $row_size) assert(@ERROR = 0) $dst += $row_size $src += $data.stride next else _WinAPI_MoveMemory(DllStructGetPtr($raw), $data.Scan0, DllStructGetSize($raw)) assert(@ERROR = 0) endif $tmp = _GDIPlus_BitmapUnlockBits($BMP, $data) assert($tmp = True) ; a good practice: dispose/release/free objects in reverse order of instantiation/allocation, as it is common one may rely on a precedent ; no assert on release because w/e _GDIPlus_BitmapDispose($BMP) _WinAPI_DeleteObject($hBMP) _WinAPI_ReleaseDC($aWinHandle, $hDDC) _WinAPI_DeleteDC($hCDC) ; to keep ref and prevent deallocation of the raw buffer local $ret = [$width,$height,$raw] return $ret endfunc func GetPixel(byref $raw, $x, $y) ; , $line = @SCRIPTLINENUMBER) ; assert(0 <= $y and $y < $raw[1], $line) ; assert(0 <= $x and $x < $raw[0], $line) local $ind = $y * $raw[0] + $x ; this is a normalized/flattened array return DllStructGetData($raw[2], 1, 1 + $ind) endfunc ; if not _WinAPI_DwmIsCompositionEnabled() then ; MsgBox(0x10, 'ERROR', 'DWM not enabled') ; Exit ; endif _GDIPlus_Startup() $pid = Run('notepad.exe', '') $hwnd = WinWait('[CLASS:Notepad]', '', 10) $time = TimerInit() $raw = GetRawBitmap($hwnd) $time = Round(TimerDiff($time)) println('GetRawBitmap exec time: ' & $time & ' ms') $time = TimerInit() local $dic = FetchColors($hwnd) $time = Round(TimerDiff($time)) println('FetchColors exec time: ' & $time & ' ms') $test = True for $y in $OY for $x in $OX if not $dic.Item($x & ':' & $y) = GetPixel($raw,$x,$y) then $test = False ExitLoop 2 endif next next println('Check = ' & $test) ProcessClose($pid) _GDIPlus_Shutdown() EDIT1: ofc getting the raw bitmap will increase your memory complexity as it will allocate the whole bmp buffer, but you can access w/e coords you want after EDIT2: Same remark, fetch the array once and check after: each time you're calling _PixelColor you will fetch the whole bitmap, that's pointless, the idea behind getting the whole bitmap is exactly to avoid doing that: what's costy here is all the stuff you do to get the bitmap (create hbmp, dc, compatible dc, print, etc) so you want to do it once ! EDIT3: also GetPixel returns a RGB value, regardless of the actual bmp pixel format ...
    1 point
  18. @mLipokCould you accomplish this with your own HTML file?
    1 point
  19. Just use ternary. Also the function is still in v3.3.10.2. ($bCondition ? $vTrue : $vFalse) ; Or... Func _Iif($bCondition, $vTrue : $vFalse) Return ($bCondition ? $vTrue : $vFalse) EndFunc
    1 point
×
×
  • Create New...