Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/24/2025 in all areas

  1. I need from from time to time to run small processes to perform task that would otherwise clog the main process. Yes, there is a number of other UDF that could have done it very well, but I felt they were an over-kill for what I wanted. Don't throw me stones, I know it's not really multi-threading, but it is as close as I could get with simple AutoIt. If someone wonders why I called it PMT, the P stands for Pretending. And I'm also not pretending it is an elaborate UDF. Just small and simple to use... Version 2025-01-03 * changed how temporary files are deleted * changed location of temporary files to use standard folder * added support to unusual location of AutoIt Version 2025-01-02 * corrected bug when temporary files has space within their name. Version 2024-03-24 * corrected bug when 8 parameters (max) is passed to the function Example : #AutoIt3Wrapper_Res_SaveSource=y #include "PMT-UDF.AU3" #include <Constants.au3> _PMT_Init() Local $hProc1 = _PMT_Start("Test1", Default, "Test 1") _PMT_Start("Test2") _PMT_Start("Test3", 5) Local $sResponse While Sleep(50) $sResponse = _PMT_GetResponse($hProc1) If @error Then Exit MsgBox($MB_OK, "Error", "Process has dropped") If $sResponse <> "" Then MsgBox($MB_OK, "Success", $sResponse & @CRLF) ExitLoop EndIf WEnd Func Test1($sTitle, $sMessage) Local $iResp = MsgBox($MB_OK, $sTitle, $sMessage) Return "Done with value " & $iResp EndFunc Func Test2() MsgBox($MB_OK, "2", "Test 2") EndFunc Func Test3($iTimeout) MsgBox($MB_OK, "3", "Test 3", $iTimeout) EndFunc You can pass up to 8 parameters to _PMT_Start. It is up to you to manage the right number. You cannot pass structures, maps or arrays as parameter (only bool, ptr, hWnd, int, float, string, and the keyword Default). You could use my WCD-IPC if need be to exchange large amount of data. If you want to run it compiled, you need to have add #AutoIt3Wrapper_Res_SaveSource=y at the start of your script. In the case you decide to compile your script, _PMT_Init allows you to identity where AutoIt3 is located (in the situation where AutoIt is not installed in the usual directory) to get the right includes in your "threads". Let me know if you have any question, or suggestion, I will be glad to hear them. Enjoy. PMT-UDF.au3
    1 point
  2. @Parsix The WebView2 object does need a UDF (User Data Folder) to store cached info / cookies etc. https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/user-data-folder?tabs=win32 So it will always look for a custom user folder to store this information.
    1 point
  3. Delighted to hear this, thanks for the 4 tests ! By the way, I'll try to find a way to solve this : while we resize the GUI, the distance between the right side of the last statusbar part and the sizebox should stay constant. Actually, this distance increases a bit while we enlarge the GUI ( due to the calculation which uses $g_aRatioW ) but it would probably display better if this particular distance was constant, with the sizebox always "stuck" to the right size of the last statusbar part during resizing. It's not really important, we'll see... Meanwhile, I tried to group several examples from the help file, so I'll be able to have results not only from my computer, but also from a Win11 computer in a few days. These results may help to understand better what should exactly be the height/width of the sizebox etc... I'll have a bit less time to do this, as family is coming tomorrow and we'll spend some time together
    1 point
  4. Dan_555

    Dan's misc. Scripts

    Here is my latest script: Color Selector and a simple color distance calculation. #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #Region ### START Koda GUI section ### Form= #NoTrayIcon $color1="" $color2="" _TwoColorSelection($color1,$color2) ConsoleWrite ($color1 & " / " & $color2 & @CRLF) Exit Func _TwoColorSelection(ByRef $col1, ByRef $col2) Local $upd=1, $tmp Local $SL[6][2] Local $ColorForm1 = GUICreate("Color Selector:", 323, 302, -1, -1) For $x=0 to 2 $SL[$x][0] = GUICtrlCreateSlider(8+($x*46), 14, 31, 208, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_VERT)) GUICtrlSetLimit(-1, 255, 0) $SL[$x+3][0] = GUICtrlCreateSlider(187+($x*46), 14, 31, 208, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_VERT)) GUICtrlSetLimit(-1, 255, 0) Next GUICtrlCreateLabel("R G B", 14, 3, 128, 15) GUICtrlCreateLabel("R G B", 192, 3, 128, 15) Local $BTNCOLL = GUICtrlCreateButton("@@##TEST##@@", 8, 225, 124, 30) Local $BTNCOLR = GUICtrlCreateButton("@@##TEST##@@", 187, 224, 127, 30) Local $InpLeftH = GUICtrlCreateInput("", 24, 260, 84, 16, 9) ;9 = Centered + Uppercase Local $InpRightH = GUICtrlCreateInput("", 207, 260, 84, 16, 9) ;9 = Centered + Uppercase Local $InpLeft = GUICtrlCreateInput("", 24, 279, 84, 16, 9) ;9 = Centered + Uppercase Local $InpRight = GUICtrlCreateInput("", 207, 279, 84, 16, 9) ;9 = Centered + Uppercase GUICtrlCreateLabel("Distance:", 135, 255, 44, 24) Local $labelDistance = GUICtrlCreateLabel("", 134, 270, 64, 24) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() $SL="" Return ;Case $SL[0][0], $SL[1][0], $SL[2][0], $SL[3][0], $SL[4][0], $SL[5][0] ;Probably not needed because of the loop ; $upd=1 EndSwitch For $x=0 to 5 ;Check if the sliders have been changed with keyboard or mousewheel movement $tmp=GuiCtrlRead($SL[$x][0],2) if $SL[$x][1]<>$tmp then $upd=1 $SL[$x][1]=$tmp ExitLoop EndIf Next If $upd=1 Then Local $1R = 255 - GUICtrlRead($SL[0][0], 2), $1G = 255 - GUICtrlRead($SL[1][0], 2), $1B = 255 - GUICtrlRead($SL[2][0], 2) Local $2R = 255 - GUICtrlRead($SL[3][0], 2), $2G = 255 - GUICtrlRead($SL[4][0], 2), $2B = 255 - GUICtrlRead($SL[5][0], 2) Local $1RH = Hex($1R, 2), $1GH = Hex($1G, 2), $1BH = Hex($1B, 2) Local $2RH = Hex($2R, 2), $2GH = Hex($2G, 2), $2BH = Hex($2B, 2) $color1=$1RH & $1GH & $1BH $color2=$2RH & $2GH & $2BH GUICtrlSetData($InpLeftH, $color1) GUICtrlSetData($InpRightH, $color2 ) GUICtrlSetData($InpLeft, $1R & "," & $1G & "," & $1B) GUICtrlSetData($InpRight, $2R & "," & $2G & "," & $2B) GUICtrlSetBkColor($BTNCOLL, "0X" & $1RH & $1GH & $1BH) GUICtrlSetBkColor($BTNCOLR, "0X" & $2RH & $2GH & $2BH) GUICtrlSetColor($BTNCOLR, "0X" & $1RH & $1GH & $1BH) GUICtrlSetColor($BTNCOLL, "0X" & $2RH & $2GH & $2BH) $CD = CalculateColorDistance(GUICtrlRead($InpLeftH), GUICtrlRead($InpRightH)) GUICtrlSetData($labelDistance, $CD & " 0x" & Hex($CD, 4)) $upd=0 EndIf WEnd EndFunc ;==>_ColorSelection Func CalculateColorDistance($RGB1 = "000000", $RGB2 = "FFFFFF") ;Format RGB as hex string If IsString($RGB1) = 1 Then $RGB1 = StringReplace($RGB1, "0x", "") Else $RGB1=Hex($RGB1,6) EndIf If IsString($RGB2) = 1 Then $RGB2 = StringReplace($RGB2, "0x", "") Else $RGB2=Hex($RGB2,6) EndIf If StringLen($RGB1) < 6 Then Return -1 If StringLen($RGB2) < 6 Then Return -1 If StringLen($RGB1) > 6 Then $RGB1 = StringRight($RGB1, 6) ;Assuming the ARGB format If StringLen($RGB2) > 6 Then $RGB2 = StringRight($RGB2, 6) ;Assuming the ARGB format Local $1R = Int("0x" & StringMid($RGB1, 1, 2)), $1G = Int("0x" & StringMid($RGB1, 3, 2)), $1B = Int("0x" & StringMid($RGB1, 5, 2)) Local $2R = Int("0x" & StringMid($RGB2, 1, 2)), $2G = Int("0x" & StringMid($RGB2, 3, 2)), $2B = Int("0x" & StringMid($RGB2, 5, 2)) ;$DR = $1R - $2R ;$DG = $1G - $2G ;$DB = $1B - $2B Return Int(Abs($1R - $2R) + Abs($1G - $2G) + Abs($1B - $2B)) EndFunc ;==>CalculateColorDistance The distance calculations is very basic. Provide 2 color values in RGB format (e.g. "FF10FF" or 0x12FCD4). Each pair of R,G and B values is first substracted then the distance is calculated by adding them. As an extra feature: The color values are calculated even when the slider is changed by the mouse wheel (or arrow keys).
    1 point
  5. @LarsJ If problem CreateCoreWebView2EnvironmentWithOptions ERR then add to the autoit script: EnvSet ("WEBVIEW2_USER_DATA_FOLDER", @AppDataDir & "\WebView2") (or any other folder where the script can write)
    1 point
×
×
  • Create New...