Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/08/2022 in all areas

  1. Jon

    AutoIt v.3.3.16.0 Released

    AutoIt v3.3.16.0 has been released. Thanks to @jpm and the MVPs who were responsible for the majority of code in this version. Download it here. Complete list of changes: History
    3 points
  2. After many hours trying to setup a private proxy, i've found a decent workaround and implemented it in AutoIt, ideas based on Just make an unpacked extension folder contains manifest.json and background.js, file templates are provided in the answer of the above stackoverflow question. By doing this you will expose your private proxy to those who access to these files. Add an extra chrome switch --load-extension and its value will be the path to the unpacked extension folder (both using _WD_Option or set $sCapabilities will do) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log" --load-extension=path\\to\\unpacked\\folder') Or { "capabilities": { "alwaysMatch": { "goog:chromeOptions": { "args": [ "--load-extension=path\\to\\unpacked\\folder" ] } } } } Notice that the manifest.json is using some functions from v2 and will soon be deprecated in Jan 2023. I've attempted to migrate it to v3 but failed due to this known chromium bug.
    2 points
  3. I tested a script, that I found over here and the _ArrayDisplay at the end was not working. I tested with 3.14.5.0 and there everything is fine. #include <Array.au3> Dim $aTest_Null[1][2] = [[Null, Null]] _ArrayDisplay($aTest_Null) ; this is working ReDim $aTest_Null[2][2] _ArrayDisplay($aTest_Null) ; this is never show; seems to get stuck in "__ArrayDisplay_SortArrayStruct" The script above narrows the problem down. It seems if an array contains a Keyword the interall call of __ArrayDisplay_SortArrayStruct (@Line 772 of ArrayDisplayInternals.au3) never exits the Do...Until loop.
    1 point
  4. @sylremoSee my prior answer here for the correct way to utilize an alternate port.
    1 point
  5. Anyway, all Windows 10 users using a supported version (except the LTSC version) will be affected by the removal of Internet Explorer on June 15, 2022 https://docs.microsoft.com/en-us/lifecycle/announcements/internet-explorer-11-end-of-support
    1 point
  6. It seems that the Null keyword makes StrCmpLogicalW crash (the function is supposed to "compare two Unicode strings" says MSDN). For example, AutoIt (no matter the version) crashes with this script : Local $aArray[2] = [Null, 123] DllCall("shlwapi.dll", 'int', 'StrCmpLogicalW', 'wstr', $aArray[0], 'wstr', $aArray[1]) Exit code: 3221225477, which is "C0000005" (0xC0000005 STATUS_ACCESS_VIOLATION) In the new version of ArrayDisplay 3.3.16.0, data comes directly from the array, so Null is passed to the function & crash. $r = DllCall($hDllComp, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$i], 'wstr', $aArray[DllStructGetData($tIndex, 1, $mi + 1)])[0] In the precedent version of ArrayDisplay 3.3.14.5, Null wasn't passed to the function because of these lines : $sVal1 = __ArrayDisplay_GetItemText(...) $sVal2 = __ArrayDisplay_GetItemText(...) $nResult = DllCall('shlwapi.dll', 'int', 'StrCmpLogicalW', 'wstr', $sVal1, 'wstr', $sVal2)[0] I just tested the 3 other AutoIt keywords used as datatypes : True, False & Default, they don't make the function crash. Let's wait @jpm or anyone wishing to comment, who may have complementary informations. Edit 1: for what it's worth, the following code doesn't crash (when we click the column header to sort) : Local $aArray[2] = [Null, 123] _ArrayDisplay($aArray, "Title", Default, Default, Default, _ "Numerics*") ; * at end of any header means numeric sort for the concerned column. Edit 2: an idea to solve it. As only the Natural sort is concerned, instead of passing $aArray[$i] to the function, can't we pass String($aArray[$i]) or even "" & $aArray[$i] ? That would solve the NULL issue (tested right now) and it doesn't seem to delay a lot the sorting result, but the result itself should be checked carefully to make sure it brings back the same sorting order than the original code (in case $aArray[$i] contains digits or not etc...) Edit 3: I made tests like JP likes them : rebooting the computer between each test ! Tests on 100.000 rows, 6 cols, Srandom(6) to generate the same array, Natural sort on String column (column 0) 1) First test with original code version 3.3.16.0, i.e. params of the function are $aArray[$i][$iCol] and $aArray[DllStructGetData($tIndex, 1, $mi + 1)][$iCol] 2) Second test with String($aArray[$i][$iCol]) and String(...) 3) Third test with "" & $aArray[$i][$iCol] and "" & $aArray[DllStruct...] Fastest is of course 1) 2) and 3) run in nearly same speed time, but 5% slowest than 1) Comparing the results after each sort (with DebugArrayDisplay, button copy data, save in 3 different text files) => exactly the same result no matter the test (lucky us !) String elements where composed of letters, digits & some other characters (see below) : $aArray = FAS_Random2DArrayAu3($iRows, "sifdtr", "abcdefghijkl0123456789.-+*/_,;") When it was all finished, for fun, I added the following lines in the code, just to confirm the crash (test 1) or no crash (tests 2 & 3) ...but this time it was only with 1000 rows. $aArray[0][0] = Null $aArray[1][0] = Null $aArray[100][0] = Null $aArray[500][0] = Null $aArray[999][0] = Null Hope it helps JP to decide, because leaving "as-is" will crash as soon as a NULL element is found when a non-numeric sort is required, while changing the code won't crash but it should be 5% slower. Edit 4: the horrible slowest way to patch it ? If $aArray[$i][$iCol] = NULL Or $aArray[DllStructGetData($tIndex, 1, $mi + 1)][$iCol] = NULL Then $r = DllCall($hDllComp, 'int', 'StrCmpLogicalW', 'wstr', String($aArray[$i][$iCol]), 'wstr', String($aArray[DllStructGetData($tIndex, 1, $mi + 1)][$iCol]))[0] Else $r = DllCall($hDllComp, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$i][$iCol], 'wstr', $aArray[DllStructGetData($tIndex, 1, $mi + 1)][$iCol])[0] EndIf It's not because the number of rows = 100.000 that StrCmpLogicalW is called 100.000 times. Here are the number of times that StrCmpLogicalW is called : 528 comparaisons for 100 rows, 8571 for 1000 rows, 118.956 for 10.000 rows, 1.522.498 for 100.000 rows. Who wants to add an If statement evaluated 1.522.498 times ? Thanks to HurleyShanabarger who discovered this issue.
    1 point
  7. The point is that it shouldn't hang in the first place so need to be fixed in _ArrayDisplay when that is wrong.
    1 point
  8. Danp2

    Default keyword

    You can also do it like this -- If IsKeyword($iSortCol) = $KEYWORD_DEFAULT Then $iSortCol = 0 ;
    1 point
  9. Dmob, I understand you because it always frustrated me too. We see 1 column in both following cases, when creating an array with : Local $aArray[10] ; or Local $aArray[10][1] But in 1st case (the 1D case) number of cols = 0 And in 2nd case (the 2D case) number of cols = 1 @jpm simplified it when scripting the new ArrayDisplay, with this line : $_g_ArrayDisplay_nCols = ($_g_ArrayDisplay_iDims = 2) ? UBound($_g_ArrayDisplay_aArray, $UBOUND_COLUMNS) : 1 ; Jpm's 1D => 1 (new !) (comment at the end of line comes from my reworked version of ArrayDisplay) I think he did great, because it brought fresh air and simplified the whole function.
    1 point
  10. Hi @KDoc, I don't know a out of the box variant, but you requirement should be matched by that simple function: #include-once #include <Date.au3> ConsoleWrite(_GetCurrentDateTimeAs_YYYYMMDDHHMMSS() & @CRLF) Func _GetCurrentDateTimeAs_YYYYMMDDHHMMSS() Local Const $iStripAllWhitespaces = 8 Local $sDateTime = _NowCalc() $sDateTime = StringReplace($sDateTime, '/', '') $sDateTime = StringReplace($sDateTime, ':', '') Return StringStripWS($sDateTime, $iStripAllWhitespaces) EndFunc Is that enough or do you need it more dynamically? Best regards Sven ________________ Stay innovative!
    1 point
  11. That seems to work : #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> #include <WinAPIProc.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" Global Const $TIMER_NUMBER = 5, $DOUBLE_CLICK_DELAY = 150 ; <<<<<<< ADJUST IF NEEDED Global $aTimer[$TIMER_NUMBER][3], $iTimer = 0 Global $hMSHook, $hMSProc $hMSProc = DllCallbackRegister(_MouseProc, "long", "int;wparam;lparam") $hMSHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hMSProc), _WinAPI_GetModuleHandle(0)) _GDIPlus_Startup() OnAutoItExitRegister(_Cleanup) While True Sleep(50) WEnd Func ShowCircle($iColor) Local Const $iWidth = 100, $iHeight = 100, $iBgColor = 0xFFFF00 Local $hGUI = GUICreate("", $iWidth, $iHeight, MouseGetPos(0) - $iWidth / 2, MouseGetPos(1) - $iHeight / 2, $WS_POPUP, _ BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_NOACTIVATE)) GUISetBkColor($iBgColor, $hGUI) GUISetState(@SW_SHOWNOACTIVATE) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local $hBmp = _GDIPlus_BitmapCreateFromGraphics(100, 100, $hGraphics) Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBmp) Local $hBrush = _GDIPlus_BrushCreateSolid($iColor) _GDIPlus_GraphicsFillEllipse($hGfx, 0, 0, 100, 100, $hBrush) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBmp, 0, 0, 100, 100) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBmp) StartTimer($hGUI, $hHBitmap) EndFunc ;==>ShowCircle Func UpdateGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity) Local $tDim = DllStructCreate($tagBITMAP) _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), $tDim) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local $hScrDC = _WinAPI_GetDC($hGUI), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $tSize, $hMemDC, $tSource, 0, $tBlend, $ULW_ALPHA) _WinAPI_ReleaseDC($hGUI, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) ;_WinAPI_DeleteObject($hOld) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>UpdateGUI Func _Cleanup() _GDIPlus_Shutdown() _WinAPI_UnhookWindowsHookEx($hMSHook) DllCallbackFree($hMSProc) EndFunc ;==>_Cleanup Func StartTimer($hWnd, ByRef $hBitmap) $aTimer[$iTimer][0] = $hWnd $aTimer[$iTimer][1] = $hBitmap $aTimer[$iTimer][2] = 0 AdlibRegister("Timer" & $iTimer, 10) $iTimer = Mod($iTimer + 1, $TIMER_NUMBER) EndFunc ;==>StartTimer Func Timer0() Fade(0) EndFunc ;==>Timer0 Func Timer1() Fade(1) EndFunc ;==>Timer1 Func Timer2() Fade(2) EndFunc ;==>Timer2 Func Timer3() Fade(3) EndFunc ;==>Timer3 Func Timer4() Fade(4) EndFunc ;==>Timer4 Func Fade($iTmr) If $aTimer[$iTmr][2] = 15 Then GUIDelete($aTimer[$iTmr][0]) _WinAPI_DeleteObject($aTimer[$iTmr][1]) AdlibUnRegister("Timer" & $iTmr) Return EndIf $aTimer[$iTmr][2] += 1 UpdateGUI($aTimer[$iTmr][1], $aTimer[$iTmr][0], 150 - ($aTimer[$iTmr][2] * 10)) EndFunc ;==>Fade Func _MouseProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hMSHook, $nCode, $wParam, $lParam) Switch $wParam Case $WM_LBUTTONUP AdlibRegister(LeftClick, $DOUBLE_CLICK_DELAY) Case $WM_RBUTTONUP AdlibRegister(RightClick, 80) EndSwitch Return _WinAPI_CallNextHookEx($hMSHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc Func LeftClick() AdlibUnRegister(LeftClick) ShowCircle(0xFFE0A0FF) EndFunc ;==>LeftClick Func RightClick() AdlibUnRegister(RightClick) ShowCircle(0xFF10E010) EndFunc ;==>RightClick
    0 points
×
×
  • Create New...