Leaderboard
Popular Content
Showing content with the highest reputation since 04/15/2025 in Posts
-
_StringToTable() – Convert Text\array to a text formatted table The _StringToTable() function allows you to convert structured text (like tab-separated data), or array into a formatted, aligned table using Unicode box-drawing characters. Ideal for displaying readable output in console-based tools or logs. Example1: string to table Local $sData = _ "Company" & @TAB & "Contact" & @TAB & "Revenue" & @CRLF & _ "Alfreds Futterkiste" & @TAB & "Maria Anders" & @TAB & "1200" & @CRLF & _ "Centro Moctezuma" & @TAB & "Francisco Chang" & @TAB & "950" & @CRLF & _ "Island Trading" & @TAB & "Helen Bennett" & @TAB & "15800" ConsoleWrite(_StringToTable($sData, 3, @TAB, "L,C,R") & @CRLF) ┌──────────────────────┬───────────────────┬──────────┐ │ Company │ Contact │ Revenue │ ├──────────────────────┼───────────────────┼──────────┤ │ Alfreds Futterkiste │ Maria Anders │ 1200 │ │ Centro Moctezuma │ Francisco Chang │ 950 │ │ Island Trading │ Helen Bennett │ 15800 │ └──────────────────────┴───────────────────┴──────────┘ Example2: array to table ; Make example array Local $aArray[10][5] For $i = 0 To 9 For $j = 0 To 4 $aArray[$i][$j] = $i & "-" & $j Next Next ;_ArrayDisplay($aArray, "example array") ; Make header and insert to array (when needed) Local $sHeader = "Column 0|Column 1|Column 2|Column 3|Column 4" _ArrayInsert($aArray, 0, $sHeader) If @error Then Exit MsgBox(16, "@error: " & @error, "Something went wrong with _ArrayInsert()") Local $sOut = _StringToTable($aArray, 3, @TAB, "C,C,C,C,C") ConsoleWrite($sOut & @CRLF & @CRLF) ┌──────────┬──────────┬──────────┬──────────┬──────────┐ │ Column 0 │ Column 1 │ Column 2 │ Column 3 │ Column 4 │ ├──────────┼──────────┼──────────┼──────────┼──────────┤ │ 0-0 │ 0-1 │ 0-2 │ 0-3 │ 0-4 │ │ 1-0 │ 1-1 │ 1-2 │ 1-3 │ 1-4 │ │ 2-0 │ 2-1 │ 2-2 │ 2-3 │ 2-4 │ │ 3-0 │ 3-1 │ 3-2 │ 3-3 │ 3-4 │ │ 4-0 │ 4-1 │ 4-2 │ 4-3 │ 4-4 │ │ 5-0 │ 5-1 │ 5-2 │ 5-3 │ 5-4 │ │ 6-0 │ 6-1 │ 6-2 │ 6-3 │ 6-4 │ │ 7-0 │ 7-1 │ 7-2 │ 7-3 │ 7-4 │ │ 8-0 │ 8-1 │ 8-2 │ 8-3 │ 8-4 │ │ 9-0 │ 9-1 │ 9-2 │ 9-3 │ 9-4 │ └──────────┴──────────┴──────────┴──────────┴──────────┘ Example4: Example floating point format $sData = "" ; from https://www.autoitscript.com/forum/topic/212833-json-udf-using-json-c/#findComment-1542670 $sData &= " name | time[ms] | factor | Std. Dev | Std. Err. | min | max | range |" & @CRLF $sData &= " StringRegExp only | 1.691 | 1 | 0.351 | 0.035 | 1.304 | 3.167 | 1.863 |" & @CRLF $sData &= " jq UDF | 32.933 | 19.48 | 2.929 | 0.293 | 29.308 | 43.169 | 13.861 |" & @CRLF $sData &= " JsonC-UDF | 51.086 | 30.21 | 3.205 | 0.321 | 45.625 | 63.46 | 17.835 |" & @CRLF $sData &= " pure AutoIt JSON-UDF | 97.916 | 57.9 | 5.685 | 0.569 | 86.362 | 113.467 | 27.105 |" & @CRLF $sData &= " JSMN-based JSON-UDF | 108.248 | 64.01 | 5.512 | 0.551 | 99.029 | 130.864 | 31.835 |" & @CRLF $sOut = _StringToTable($sData, 3, "|", "L,3,2,3,3,3,3,3") ConsoleWrite($sOut & @CRLF & @CRLF) ┌──────────────────────┬──────────┬────────┬──────────┬───────────┬────────┬─────────┬────────┐ │ name │ time[ms] │ factor │ Std. Dev │ Std. Err. │ min │ max │ range │ ├──────────────────────┼──────────┼────────┼──────────┼───────────┼────────┼─────────┼────────┤ │ StringRegExp only │ 1.691 │ 1.00 │ 0.351 │ 0.035 │ 1.304 │ 3.167 │ 1.863 │ │ jq UDF │ 32.933 │ 19.48 │ 2.929 │ 0.293 │ 29.308 │ 43.169 │ 13.861 │ │ JsonC-UDF │ 51.086 │ 30.21 │ 3.205 │ 0.321 │ 45.625 │ 63.460 │ 17.835 │ │ pure AutoIt JSON-UDF │ 97.916 │ 57.90 │ 5.685 │ 0.569 │ 86.362 │ 113.467 │ 27.105 │ │ JSMN-based JSON-UDF │ 108.248 │ 64.01 │ 5.512 │ 0.551 │ 99.029 │ 130.864 │ 31.835 │ └──────────────────────┴──────────┴────────┴──────────┴───────────┴────────┴─────────┴────────┘ Made with ❤️ for readable and elegant output. ; https://www.autoitscript.com/forum/topic/212876-_stringtotable/ ;---------------------------------------------------------------------------------------- ; Title...........: _StringToTable.au3 ; Description.....: Converts a string to a formatted table with alignment and frame options. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.5 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Array.au3> #include <String.au3> Example1() ; Example string to table ;~ Example2() ; Example 2D array to table ;~ Example3() ; Example 1D array to table ;~ Example4() ; Example floating point format ;~ Example5() ; Example for new frame style ;--------------------------------------------------------------------------------------- Func Example1() ; Example string to table Local $sSum, $sOut Local $sData = _ "Company" & @TAB & "Contact" & @TAB & "Revenue" & @CRLF & _ "Alfreds Futterkiste" & @TAB & "Maria Anders" & @TAB & "1200" & @CRLF & _ "Centro Moctezuma" & @TAB & "Francisco Chang" & @TAB & "950" & @CRLF & _ "Island Trading" & @TAB & "Helen Bennett" & @TAB & "15800" $sOut = _StringToTable($sData, 0, @TAB, "L,C,R") ConsoleWrite($sOut & @CRLF & @CRLF) $sSum &= $sOut & @CRLF & @CRLF $sOut = _StringToTable($sData, 1, @TAB, "L,C,R") ConsoleWrite($sOut & @CRLF & @CRLF) $sSum &= $sOut & @CRLF & @CRLF $sOut = _StringToTable($sData, 2, @TAB, "L,C,R") ConsoleWrite($sOut & @CRLF & @CRLF) $sSum &= $sOut & @CRLF & @CRLF & @CRLF $sSum &= "Notes: For the correct display of output, it is recommended to use a MonoSpace font." & @CRLF $sSum &= "Window MonoSpace font: Consolas, DejaVu Sans Mono, Courier New, Lucida Console" & @CRLF ClipPut($sSum) ShellExecute("notepad.exe") WinWaitActive("[CLASS:Notepad]", "", 5) Sleep(100) Send("^v") EndFunc ;==>Example1 ;--------------------------------------------------------------------------------------- Func Example2() ; Example 2D array to table ; Make example array Local $aArray[10][5] For $i = 0 To 9 For $j = 0 To 4 $aArray[$i][$j] = $i & "-" & $j Next Next ;_ArrayDisplay($aArray, "example array") ; Make header and insert to array (when needed) Local $sHeader = "Column 0|Column 1|Column 2|Column 3|Column 4" _ArrayInsert($aArray, 0, $sHeader) If @error Then Exit MsgBox(16, "@error: " & @error, "Something went wrong with _ArrayInsert()") Local $sOut = _StringToTable($aArray, 3, -1, "C,C,C,C,C") ConsoleWrite($sOut & @CRLF & @CRLF) ClipPut($sOut) ShellExecute("notepad.exe") WinWaitActive("[CLASS:Notepad]", "", 5) Sleep(100) Send("^v") EndFunc ;==>Example2 ;--------------------------------------------------------------------------------------- Func Example3() ; Example 1D array to table Local $sMonth = "Months, January, February, March, April, May, June, July, August, September, October, November, December" Local $aMonth = StringSplit($sMonth, ", ", 3) Local $sOut = _StringToTable($aMonth, 3, -1, "C") ConsoleWrite($sOut & @CRLF & @CRLF) ClipPut($sOut) ShellExecute("notepad.exe") WinWaitActive("[CLASS:Notepad]", "", 5) Sleep(100) Send("^v") EndFunc ;==>Example3 ;--------------------------------------------------------------------------------------- Func Example4() ; Example floating point format Local $sData = "" ; from https://www.autoitscript.com/forum/topic/212833-json-udf-using-json-c/#findComment-1542670 $sData &= " name | time[ms] | factor | Std. Dev | Std. Err. | min | max | range |" & @CRLF $sData &= " StringRegExp only | 1.691 | 1 | 0.351 | 0.035 | 1.304 | 3.167 | 1.863 |" & @CRLF $sData &= " jq UDF | 32.933 | 19.48 | 2.929 | 0.293 | 29.308 | 43.169 | 13.861 |" & @CRLF $sData &= " JsonC-UDF | 51.086 | 30.21 | 3.205 | 0.321 | 45.625 | 63.46 | 17.835 |" & @CRLF $sData &= " pure AutoIt JSON-UDF | 97.916 | 57.9 | 5.685 | 0.569 | 86.362 | 113.467 | 27.105 |" & @CRLF $sData &= " JSMN-based JSON-UDF | 108.248 | 64.01 | 5.512 | 0.551 | 99.029 | 130.864 | 31.835 |" & @CRLF Local $sOut = _StringToTable($sData, 3, "|", "L,3,2,3,3,3,3,3") ConsoleWrite($sOut & @CRLF & @CRLF) ClipPut($sOut) ShellExecute("notepad.exe") WinWaitActive("[CLASS:Notepad]", "", 5) Sleep(100) Send("^v") EndFunc ;==>Example4 ;--------------------------------------------------------------------------------------- Func Example5() ; Example for new frame style Local $sData = "" ; from https://www.autoitscript.com/forum/topic/212833-json-udf-using-json-c/#findComment-1542670 $sData &= " name | time[ms] | factor | Std. Dev | Std. Err. | min | max | range |" & @CRLF $sData &= " StringRegExp only | 1.691 | 1 | 0.351 | 0.035 | 1.304 | 3.167 | 1.863 |" & @CRLF $sData &= " jq UDF | 32.933 | 19.48 | 2.929 | 0.293 | 29.308 | 43.169 | 13.861 |" & @CRLF $sData &= " JsonC-UDF | 51.086 | 30.21 | 3.205 | 0.321 | 45.625 | 63.46 | 17.835 |" & @CRLF $sData &= " pure AutoIt JSON-UDF | 97.916 | 57.9 | 5.685 | 0.569 | 86.362 | 113.467 | 27.105 |" & @CRLF $sData &= " JSMN-based JSON-UDF | 108.248 | 64.01 | 5.512 | 0.551 | 99.029 | 130.864 | 31.835 |" & @CRLF Local $sOut = _DblFrame($sData, "|", "L,3,2,3,3,3,3,3") ConsoleWrite($sOut & @CRLF & @CRLF) ClipPut($sOut) ShellExecute("notepad.exe") WinWaitActive("[CLASS:Notepad]", "", 5) Sleep(100) Send("^v") EndFunc ;==>Example5 ;--------------------------------------------------------------------------------------- ; #FUNCTION# -------------------------------------------------------------------------------------------------------------------- ; Name...........: _StringToTable ; Description....: Converts a string or array to a formatted table with alignment and frame options. ; Syntax.........: _StringToTable( $vString [, $iFrame = 2 [, $sSeparator = @TAB [, $sAlign = ""]]] ) ; Parameters.....: $vString - The input string or array containing data values. ; $iFrame - [optional] Frame type (0=NoFrame, 1=FrameNoHeader, 2=FrameAndHeader. (Default is 2) ; $sSeparator - [optional] Separator used in the input string. (Default is @TAB) ; $sAlign - [optional] Alignment options for each column "L,R,C,[0-9]". (Default is "" (left-aligned)) ; Return values..: The formatted table as a string. ; Author ........: ioa747 ; Notes .........: For the correct display of output, it is recommended to use a MonoSpace font. ; Window MonoSpace font: Consolas, DejaVu Sans Mono, Courier New, Lucida Console ; Link ..........: https://www.autoitscript.com/forum/topic/212876-_stringtotable/ ; Dependencies...: __FormatCell() ;-------------------------------------------------------------------------------------------------------------------------------- Func _StringToTable($vString, $iFrame = 2, $sSeparator = @TAB, $sAlign = "") ;Local $hTimer = TimerInit() If $iFrame < 0 Or $iFrame > 2 Or $iFrame = Default Then $iFrame = 2 If $sSeparator = Default Or $sSeparator = -1 Then $sSeparator = @TAB ; Convert array to string If IsArray($vString) Then Local $b2D = (UBound($vString, 0) = 1 ? False : True) If Not $b2D Then _ArrayColInsert($vString, 1) $vString = _ArrayToString($vString, $sSeparator) EndIf ;Prepare string $vString = StringRegExpReplace($vString, "(\r\n|\n)", @CRLF) $vString = StringReplace($vString, $sSeparator & @CRLF, @CRLF) $vString = StringReplace($vString, @CRLF & $sSeparator, @CRLF) $vString = StringStripCR(StringRegExpReplace($vString, "(\r\n)$", "")) ;ConsoleWrite($vString & @CRLF) Local $aRows = StringSplit($vString, @LF, 1) If $aRows[0] = 0 Then Return SetError(1, 0, "") Local $aTable[UBound($aRows)][0] Local $iLen, $iCols = 0 ; initialize rows and columns For $i = 1 To $aRows[0] Local $aCols = StringSplit($aRows[$i], $sSeparator, 1) If $i = 1 Then $iCols = $aCols[0] ReDim $aTable[$aRows[0]][$iCols] Else If $aCols[0] < $iCols Then ReDim $aCols[$iCols + 1] ;** EndIf For $j = 0 To $iCols - 1 $aTable[$i - 1][$j] = StringStripWS($aCols[$j + 1], 3) Next Next ; find the max column widths Local $aColWidths[$iCols] For $j = 0 To $iCols - 1 $aColWidths[$j] = 0 For $i = 0 To UBound($aTable) - 1 $iLen = StringLen($aTable[$i][$j]) If $aColWidths[$j] < $iLen Then $aColWidths[$j] = $iLen Next Next ; Alignment initialize Local $aAlign[$iCols] If $sAlign <> "" Then Local $aRawAlign = StringSplit($sAlign, ",", 2) Local $iRawCnt = UBound($aRawAlign) For $j = 0 To $iCols - 1 If $j >= $iRawCnt Then $aAlign[$j] = "L" Else $aAlign[$j] = StringStripWS($aRawAlign[$j], 3) If Not StringRegExp($aAlign[$j], "(?i)^(L|R|C|[0-9])$") Then $aAlign[$j] = "L" If StringRegExp($aAlign[$j], "^([0-9])$") Then ; re-find the max column widths For $i = 0 To UBound($aTable) - 1 $iLen = StringLen(StringFormat("%." & $aAlign[$j] & "f", $aTable[$i][$j])) $aColWidths[$j] = $aColWidths[$j] > $iLen ? $aColWidths[$j] : $iLen Next EndIf EndIf Next Else For $j = 0 To $iCols - 1 $aAlign[$j] = "L" Next EndIf Local Const $TL = "┌", $TR = "┐", $BL = "└", $BR = "┘", $H = "─", $V = "│", _ $C = "┼", $TH = "┬", $CH = "┴", $LH = "├", $RH = "┤" Local $bHeader = ($iFrame = 2) Local $bBorder = ($iFrame = 1 Or $iFrame = 2) Local $sPre = ($iFrame = 0 ? "" : " ") Local $sResult = "" ; Top border If $bBorder Then $sResult &= $TL For $j = 0 To $iCols - 1 $sResult &= _StringRepeat($H, $aColWidths[$j] + 2) $sResult &= ($j < $iCols - 1) ? $TH : $TR Next $sResult &= @LF EndIf ; Header row If $bHeader Then If $bBorder Then $sResult &= $V For $j = 0 To $iCols - 1 $sResult &= $sPre & __FormatCell($aTable[0][$j], $aColWidths[$j], $aAlign[$j]) & " " If $j < $iCols - 1 Then $sResult &= ($bBorder ? $V : "") Next If $bBorder Then $sResult &= $V $sResult &= @LF ; Header separator If $bBorder Then $sResult &= $LH For $j = 0 To $iCols - 1 $sResult &= _StringRepeat($H, $aColWidths[$j] + 2) If $j < $iCols - 1 Then $sResult &= ($bBorder ? $C : "") Else If $bBorder Then $sResult &= $RH EndIf Next $sResult &= @LF EndIf ; Data rows For $i = ($bHeader ? 1 : 0) To UBound($aTable) - 1 If $bBorder = 2 Then $sResult &= $V For $j = 0 To $iCols - 1 $sResult &= $sPre & __FormatCell($aTable[$i][$j], $aColWidths[$j], $aAlign[$j]) & " " If $j < $iCols - 1 Then $sResult &= $bBorder ? $V : "" Next If $bBorder Then $sResult &= $V $sResult &= @LF Next ; Bottom border If $bBorder Then $sResult &= $BL For $j = 0 To $iCols - 1 $sResult &= _StringRepeat($H, $aColWidths[$j] + 2) $sResult &= ($j < $iCols - 1) ? $CH : $BR Next EndIf ;$sResult = BinaryToString(StringToBinary($sResult, 4), 1) ; * ?? ;ConsoleWrite("> processed in: " & Round(TimerDiff($hTimer)) & " ms " & @LF) Return $sResult EndFunc ;==>_StringToTable ;--------------------------------------------------------------------------------------- Func __FormatCell($text, $width, $align) ; internal Local $Num = $align If StringRegExp($align, "^([0-9])$") Then $align = "N" Switch $align Case "N" ; "%.2f" If StringRegExp($text, "^[+-]?(\d*\.\d+|\d+\.?)$") Then Return StringFormat("%" & $width & "s", StringFormat("%." & $Num & "f", $text)) Else Return StringFormat("%" & $width & "s", $text) EndIf Case "R" Return StringFormat("%" & $width & "s", $text) Case "C" Local $pad = $width - StringLen($text) Local $left = Floor($pad / 2) Local $right = $pad - $left Return _StringRepeat(" ", $left) & $text & _StringRepeat(" ", $right) Case Else ; "L" Return StringFormat("%-" & $width & "s", $text) EndSwitch EndFunc ;==>__FormatCell ;--------------------------------------------------------------------------------------- Func _DblFrame($vString, $sSeparator = @TAB, $sAlign = "") ; * style template Local $sData = _StringToTable($vString, 3, $sSeparator, $sAlign) Local $aData = StringSplit($sData, @LF, 3) Local $iCnt = UBound($aData) - 1 Local $sOut For $i = 0 To $iCnt Switch $i Case 0 $aData[$i] = StringReplace($aData[$i], "┌", "╔", 1, 2) $aData[$i] = StringReplace($aData[$i], "─", "═", 0, 2) $aData[$i] = StringReplace($aData[$i], "┬", "╤", 0, 2) $aData[$i] = StringReplace($aData[$i], "┐", "╗", -1, 2) Case 2 $aData[$i] = StringReplace($aData[$i], "├", "╟", 1, 2) $aData[$i] = StringReplace($aData[$i], "┤", "╢", -1, 2) Case $iCnt $aData[$i] = StringReplace($aData[$i], "└", "╚", 1, 2) $aData[$i] = StringReplace($aData[$i], "─", "═", 0, 2) $aData[$i] = StringReplace($aData[$i], "┴", "╧", 0, 2) $aData[$i] = StringReplace($aData[$i], "┘", "╝", -1, 2) Case Else $aData[$i] = StringReplace($aData[$i], "│", "║", 1, 2) $aData[$i] = StringReplace($aData[$i], "│", "║", -1, 2) EndSwitch $sOut &= $aData[$i] & @CRLF Next $sOut = StringReplace($sOut, @CRLF, "", -1, 2) Return $sOut EndFunc ;==>_DblFrame ;--------------------------------------------------------------------------------------- Please, every comment is appreciated! leave your comments and experiences here! Thank you very much Relative: https://www.autoitscript.com/forum/topic/211237-treestructuredir/11 points
-
Hi all, I'll try to keep this succinct... Since windows 10 1903 it has been possible to embed UWP controls (i.e. XAML controls) in win32 apps. The container that holds a XAML control is a XAML Island. For non-legacy media playback, Microsoft tells us to use the WinRT MediaPlayer object with the MediaPlayerElement control. MediaPlayerElement is the UI & video rendering component of the player (the XAML control). The other MediaPlayer object is the bones of the player which you attach to the control. To get this working you annoyingly need to add the maxversiontested element to the application manifest. There's script in the zip which will copy AutoIt.exe (or AutoIt_x64.exe if you're using it) and update its manifest. If you replace the original file with the modified one, you should be able to successfully run the example with the F5 key. Or here's a screenshot if you just want to see the result! PS. As an aside, Another way of approaching modern playback is via MediaEngine which we've recently attempted to get going. This approach doesn't play well with autoit though, and you need to do ungodly things to prevent callbacks from crashing your script! MediaPlayer.zip7 points
-
Although I think the best way to use WebView2 in AutoIt would be to complete and use the work started by @LarsJ in this other @mLipok's topic, now it is possible to use WebView2 in AutoIt in a much simpler way. This is possible thanks to this ocx control and thanks to @Danyfirex for his decisive contribution. Now we can easily start embedding one or more WebView2 controls in our GUI in AutoIt. What we need is: the OrdoWebView2.ocx control and the \OrdoRC6 folder. These two are installed together with other programs (in the C:\Program Files (x86)\OrdoWebView2Control folder) by running the OrdoWebView2ActiveXControl.2.0.9.exe program downloadable from this link: https://freeware.ordoconcept.net/OrdoWebview2.php by clicking on "Download OrdoWebView2 SDK" at the bottom of the screen. Or, more simply, you can find them directly attached to this post by @Danyfirex. As explained in this post on VBForums (https://www.vbforums.com/showthread.php?899415-OrdoWebview2-ActiveX-WebView2-Browser-Control-(Replacement-of-the-MS-browser-control)&p=5651133&viewfull=1#post5651133): "On the latest versions of Windows 10 and Windows 11, only the following components are needed: OrdoWebView2.ocx OrdoRC6 folder and its contents, in the same directory as OrdoWebView2.ocx Finally, you need to register OrdoWebView2.ocx with regsvr32.exe OrdoWebView2.ocx". Also: Our AutoIt script and the OrdoWebView2.au3 must also be in the same directory along with the above. I have extracted the essential parts needed to create the WebView2 object from the DanyFirex's original example and grouped them into the OrdoWebView2.au3 UDF so that it can be easily included into a program. This is just a quick draft to get you started, but it can definitely be improved. Suggestions are welcome. Here are the basic UDF and a very basic example script: Embed 4 WebView2 controls in an AutoIt GUI More scripts to follow to test the functionality and interaction between OrdoWebView2 and AutoIt. See you later. P.S. Here is a reference link to the OrdoWebView2.ocx help (https://freeware.ordoconcept.net/Help/OrdoWebView2/) OrdoWebView2.au3 ; From the following POST By DanyFirex: ; https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/page/9/#findComment-1542694 ; ... first draft to be continue ... #include <WinAPI.au3> Global Const $gATL = DllOpen("ATL.DLL") Global Const $gOleaut32 = DllOpen("oleaut32.dll") _WinAPI_CoInitialize($COINIT_APARTMENTTHREADED) AtlAxWinInit() Global $pProgID = SysAllocString('OrdoWebView2.OrdoWebView') Func webview2_GUI_Create($w, $h, $x, $y, $hMain, _ $sEventsPrefix = '', _ ; ......................... The prefix of the functions you define to handle receiving events. The prefix is appended by the Objects event name. $sLang = "", _ ; ................................. Language defined by the 2-letter code from ISO 639. If omitted, the chosen language will be that of the user's system. $bIsPrivateNavigation = False, _ ; ............... if TRUE the browser goes into private browsing mode. Default value is False $sBrowserInstallPath = "", _ ; ................... sets the installation directory of the WebView2 fixed version. Only considered if UseEdgeFixedVersion is TRUE. $sUserDataFolder = "", _ ; ....................... defines the user's browsing data directory. If empty, use default user assignment directory. Ignored if IsPrivateNavigation is true $sAdditionalBrowserArguments = "", _ ; ........... Allows passing parameters to the Chromium WebView2 browser through command line switches. You can find a list of Chromium Command Line Switches here $iAllowSingleSignOnUsingOSPrimaryAccount = 0) ; .. Determines whether to enable single sign on with Azure Active Directory Local $hGUI_1 = GUICreate('', $w, $h, $x, $y, $WS_POPUPWINDOW) ; BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) Local $hResult = AtlAxCreateControl($pProgID, $hGUI_1) ; _SysFreeString($pProgID) Local $pIUnkown = AtlAxGetControl($hGUI_1) ; ConsoleWrite("AtlAxGetControl: " & $pIUnkown & @CRLF) _WinAPI_SetParent($hGUI_1, $hMain) ; trap this child gui within the main gu GUISetState(@SW_SHOW, $hGUI_1) Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}") Local $oOrdoWebViewEvents = ObjEvent($oOrdoWebView2, $sEventsPrefix, "__OrdoWebView") ; ConsoleWrite("$oOrdoWebView2: " & IsObj($oOrdoWebView2) & @CRLF) ; ConsoleWrite($oOrdoWebView2.GetWebView2Version() & @CRLF) ; ConsoleWrite($oOrdoWebView2.GetMostRecentInstallPath() & @CRLF) #cs $oOrdoWebView2.Anchor = True $oOrdoWebView2.Search_URL = "https://search.yahoo.com/search?p=%1" $oOrdoWebView2.HomeURL = "http://www.google.com" $oOrdoWebView2.SearchEngine = 2 $oOrdoWebView2.SearchAuto = True #ce $oOrdoWebView2.UseEdgeFixedVersion = False $oOrdoWebView2.InitEx($sLang, $bIsPrivateNavigation, $sBrowserInstallPath, $sUserDataFolder, $sAdditionalBrowserArguments, $iAllowSingleSignOnUsingOSPrimaryAccount) While Not $oOrdoWebView2.IsWebViewInit() ;wait initialization otherwise Navigate will fail Sleep(100) WEnd Local $aReturn = [$oOrdoWebView2, $hGUI_1] Return $aReturn ; $oOrdoWebView2 EndFunc ;==>webview2_GUI_Create Func AtlAxCreateControl($pProgID, $HWND) Local $aCall = DllCall($gATL, "long", "AtlAxCreateControl", "ptr", $pProgID, "handle", $HWND, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxCreateControl Func AtlAxGetControl($HWND) Local $aCall = DllCall($gATL, "long", "AtlAxGetControl", "handle", $HWND, "ptr*", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[2] EndFunc ;==>AtlAxGetControl Func AtlAxWinInit() Local $aCall = DllCall($gATL, "bool", "AtlAxWinInit") If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxWinInit Func _SysFreeString($pBSTR) ; Author: Prog@ndy If Not $pBSTR Then Return SetError(2, 0, 0) DllCall($gOleaut32, "none", "SysFreeString", "ptr", $pBSTR) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_SysFreeString Func SysAllocString($str) ; Author: monoceres Local $aCall = DllCall($gOleaut32, "ptr", "SysAllocString", "wstr", $str) If @error Then Return SetError(1, 0, 0) Return $aCall[0] EndFunc ;==>SysAllocString OrdoWebView2_Demo.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "OrdoWebView2.au3" Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _TestOrdoWebView() Func _TestOrdoWebView() Local $hMain_GUI = GUICreate("Main GUI", 990, 810, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUISetState(@SW_SHOW, $hMain_GUI) Local $hAutoIt_Button_1 = GUICtrlCreateButton("test", 10, 785) ; Create 4 controls Local $aWebView1 = webview2_GUI_Create(480, 380, 10, 10, $hMain_GUI) Local $aWebView2 = webview2_GUI_Create(480, 380, 500, 10, $hMain_GUI) Local $aWebView3 = webview2_GUI_Create(480, 380, 10, 400, $hMain_GUI) Local $aWebView4 = webview2_GUI_Create(480, 380, 500, 400, $hMain_GUI) ; Navigate to web pages $aWebView1[0].Navigate("https://www.kevs3d.co.uk/dev/js1kdragons/") ; "http://www.3quarks.com/en/SegmentDisplay/" $aWebView2[0].Navigate("https://gridstackjs.com/demo/anijs.html") ; "https://retejs.org/") $aWebView3[0].Navigate("https://www.youtube.com/watch?v=ojBYW3ycVTE") $aWebView4[0].Navigate("https://freeware.ordoconcept.net/OrdoWebview2.php") ; "https://freeware.ordoconcept.net/Help/OrdoWebView2/" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hAutoIt_Button_1 MsgBox(0, 'AutoIt', 'Hi') EndSwitch WEnd _SysFreeString($pProgID) GUIDelete($aWebView1[1]) GUIDelete($aWebView2[1]) GUIDelete($aWebView3[1]) GUIDelete($aWebView4[1]) GUIDelete($hMain_GUI) EndFunc ;==>_TestOrdoWebView ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc5 points
-
Hello friends, I haven't used AutoIt for a long time, but I always like these challenges, and I never forget you. Apparently there is some bug in how GUICtrlCreateObj works and I don't have time to look internally at the bug. This way I was able to create the instance of the object. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $gATL = DllOpen("ATL.DLL") Global Const $gOleaut32 = DllOpen("oleaut32.dll") Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _TestOrdoWebView() Func _TestOrdoWebView() ConsoleWrite("AtlAxWinInit: " & AtlAxWinInit() & @CRLF) Local $pProgID = SysAllocString('OrdoWebView2.OrdoWebView') ConsoleWrite("SysAllocString('OrdoWebView2.OrdoWebView'): " & $pProgID & @CRLF) Local $hGUI = GUICreate("OrdoWebView2.OrdoWebView Test", (@DesktopWidth) / 1.2, (@DesktopHeight) / 1.2, Default, Default, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) Local $hResult = AtlAxCreateControl($pProgID, $hGUI) _SysFreeString($pProgID) Local $pIUnkown = AtlAxGetControl($hGUI) ConsoleWrite("AtlAxGetControl: " & $pIUnkown & @CRLF) GUISetState() Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}") Local $oOrdoWebViewEvents = ObjEvent($oOrdoWebView2, "_OrdoWebView_", "__OrdoWebView") ConsoleWrite("$oOrdoWebView2: " & IsObj($oOrdoWebView2) & @CRLF) ConsoleWrite($oOrdoWebView2.GetWebView2Version() & @CRLF) ConsoleWrite($oOrdoWebView2.GetMostRecentInstallPath() & @CRLF) $oOrdoWebView2.Anchor = True $oOrdoWebView2.Search_URL = "https://search.yahoo.com/search?p=%1" $oOrdoWebView2.HomeURL = "http://www.google.com" $oOrdoWebView2.SearchEngine = 2 $oOrdoWebView2.SearchAuto = True $oOrdoWebView2.Init() While Not $oOrdoWebView2.IsWebViewInit() ;wait initialization otherwise Navigate will fail Sleep(100) WEnd $oOrdoWebView2.Navigate("https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/page/9/#findComment-1542505") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>_TestOrdoWebView Func _OrdoWebView_InitComplete($oIEpDisp) ConsoleWrite("_OrdoWebView_InitComplete" & @CRLF) EndFunc ;==>_OrdoWebView_InitComplete Func AtlAxCreateControl($pProgID, $HWND) Local $aCall = DllCall($gATL, "long", "AtlAxCreateControl", "ptr", $pProgID, "handle", $HWND, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxCreateControl Func AtlAxGetControl($HWND) Local $aCall = DllCall($gATL, "long", "AtlAxGetControl", "handle", $HWND, "ptr*", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[2] EndFunc ;==>AtlAxGetControl Func AtlAxWinInit() Local $aCall = DllCall($gATL, "bool", "AtlAxWinInit") If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxWinInit Func _SysFreeString($pBSTR) ; Author: Prog@ndy If Not $pBSTR Then Return SetError(2, 0, 0) DllCall($gOleaut32, "none", "SysFreeString", "ptr", $pBSTR) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_SysFreeString Func SysAllocString($str) ; Author: monoceres Local $aCall = DllCall($gOleaut32, "ptr", "SysAllocString", "wstr", $str) If @error Then Return SetError(1, 0, 0) Return $aCall[0] EndFunc ;==>SysAllocString ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos5 points
-
_StringToTable
WildByDesign and 3 others reacted to ioa747 for a topic
I agree with argumentum above, it's easier to do everything with double lines, than just the outline. Adding more frame types, requires more nested if, then , which has implications for all frame types. I'm thinking of removing frame =2 as well, right now it doesn't seem appealing to me, it will reduce both response time and readability of the script. as well However, the idea is not bad, and it's nice to get what you want. For this (and for the coding challenge) in the next version I will put a helper function that will do it. Which, (those reading) can have by now #include <Array.au3> #include <String.au3> _test() ;--------------------------------------------------------------------------------------- Func _test() Local $sTxt, $sOut Local $sData = _ "Company" & @TAB & "Contact" & @TAB & "Revenue" & @CRLF & _ "Alfreds Futterkiste" & @TAB & "Maria Anders" & @TAB & "1200" & @CRLF & _ "Centro Moctezuma" & @TAB & "Francisco Chang" & @TAB & "950" & @CRLF & _ "Island Trading" & @TAB & "Helen Bennett" & @TAB & "15800" $sOut = _DblFrame($sData, @TAB, "L,C,R") ConsoleWrite($sOut & @CRLF & @CRLF) EndFunc ;==>_test ;--------------------------------------------------------------------------------------- Func _DblFrame($vString, $sSeparator = @TAB, $sAlign = "") Local $sData = _StringToTable($vString, 3, $sSeparator, $sAlign) Local $aData = StringSplit($sData, @LF, 3) Local $iCnt = UBound($aData) -1 Local $sOut For $i = 0 To $iCnt Switch $i Case 0 $aData[$i] = StringReplace($aData[$i], "┌", "╔", 1, 2) $aData[$i] = StringReplace($aData[$i], "─", "═", 0, 2) $aData[$i] = StringReplace($aData[$i], "┬", "╤", 0, 2) $aData[$i] = StringReplace($aData[$i], "┐", "╗", -1, 2) Case 2 $aData[$i] = StringReplace($aData[$i], "├", "╟", 1, 2) $aData[$i] = StringReplace($aData[$i], "┤", "╢", -1, 2) Case $iCnt $aData[$i] = StringReplace($aData[$i], "└", "╚", 1, 2) $aData[$i] = StringReplace($aData[$i], "─", "═", 0, 2) $aData[$i] = StringReplace($aData[$i], "┴", "╧", 0, 2) $aData[$i] = StringReplace($aData[$i], "┘", "╝", -1, 2) Case Else $aData[$i] = StringReplace($aData[$i], "│", "║", 1, 2) $aData[$i] = StringReplace($aData[$i], "│", "║", -1, 2) EndSwitch $sOut &= $aData[$i] & @CRLF Next Return $sOut EndFunc ;==>_DblFrame4 points -
_StringToTable
Musashi and 3 others reacted to SOLVE-SMART for a topic
First of all and to clarify: I don't see this as a competition - just in case you folks would think of this regarding @ioa747 and me 😆 . I agree. I guess extending the border styles (frame types) is just a gimmick. Nevertheless, I played a bit with my version of DataToTable.au3 which lead to v0.2.0. In the README.md section output-result you can see a fourth border style "4=BorderAndHeaderEdgesWithAccent" as a example. In the CHANGELOG.md you will find how I changed it. To achieve the styling above (shared by @argumentum) it would lead to some more code adjustments, but at the moment I don't have the desire to implement it - sorry @WildByDesign 😅 . Best regards Sven4 points -
Hey Gianni, quick update, it looks like the native "Windows.UI.Xaml.Controls.Webview" class is not supported within Xaml islands - but we *might* be able to drop in the external "Microsoft.UI.Xaml.Controls.WebView2" control. This is part of WinUI2 I believe. Its a bit of a rabbit hole - there's WinUI2 and WinUI3, which seems to be quite different. As I understand it, WinUI3 is still being developed, but its supposed to provide controls for both Win32 and UAP apps. So that might negate the need for islands, and could be the better option in the long run I guess. (albeit we'll likely need dependencies or a runtime etc.)... Either way I'll throw a bit of time at this, it'll be interesting to see what we can tap into.4 points
-
WebDriver UDF - React-select dropdown list
mLipok and 3 others reacted to SOLVE-SMART for a topic
Here is the announced video, a little how-to one: 💡 Maybe I create few more videos like this for XPath usage and determination. I guess also for more JavaScript debugging (in the browser) etc. Time will show. Best regards Sven 👉 Btw: Forgive me, my spoken english is a bit rusty (as non native speaker). But for one take 🎬 only, it's not too bad (I hope so).4 points -
Ok we're back with a new stuff in post #1. You'll first need to compile "playerDemo_engine.au3", then run "playerDemo.au3". We're still using a modal to block execution in the engine script - wish we could do something nicer, but I guess it'll have to do for now. For comms between processes we're using windows messages (thanks nine for the inspiration!). Look for the $WM_ME* values in the constants file. The WM codes are the same values as those generated by the mediaengine, combined with WM_APP. There's one totally "made up" code - its for MediaEngine to send through its window handle to the UI process ($WM_ME_PLAYBACKWINDOW). Also with the WMs, there's a bit of jiggery pokey in order to pass floating point values over wparam and lparam. I found if you send values as a float or double, they pop out as an integer on the other end - so you lose everything after the decimal point. But sending the values as binary solves this. We just need to ensure we convert our "doubles" to "floats" for x86 so the values fit within wparam/lparam. One last thing... you can still crash the engine by flooding it with messages from the UI, but that's where we're at for now. We could probably fix this by only check incoming messages from within the event handler... Then the problem is the engine won't be contactable when its paused, so you'd need to flick between two modes of checking for messages. And it would also require a total rethink of how to pass comms from the UI back to the engine!4 points
-
JSON UDF using JSON-C
argumentum and 3 others reacted to TheXman for a topic
4 points -
UDF "data-to-table.au3"
mLipok and 2 others reacted to SOLVE-SMART for a topic
data-to-table.au3 UDF Description This library (UDF) allows you to transform input data, like strings or arrays, to a nice readable table output with different border styles and aligned table cell content. Output your data to console, file or GUI. 👉 Please check out the upcoming features section. Acknowledgements The UDF is highly inspired by the great UDF "StringToTable.au3" by @ioa747 . Thank you! Forum thread link: https://www.autoitscript.com/forum/topic/212876-_stringtotable/ All credits for the original logic go to @ioa747 who made the UDF with ❤️ for a readable and elegant output. Input ==> Output From string ... ; The $sData string is separated (columns) by tabs. Local Const $sData = _ 'Language Popularity (%) Job Demand Typical Use' & @CRLF & _ 'JavaScript 62.3 Very High Web Development, Frontend/Backend' & @CRLF & _ 'C# 27.1 High Game Development, Windows Apps, Web Dev' & @CRLF & _ 'Go 13.8 Growing Cloud Services, System Programming' & @CRLF & _ 'PowerShell 13.5 Low to Moderate Task Automation, DevOps, System Admin' & @CRLF & _ 'AutoIt 0.5 Low Windows GUI Automation, Scripting' ... or array ... ; Default separator is @TAB. Local Const $aData[][5] = _ [ _ ['Language', 'Popularity (%)', 'Job Demand', 'Typical Use' ], _ ['JavaScript', '62.3', 'Very High', 'Web Development, Frontend/Backend' ], _ ['C#', '27.1', 'High', 'Game Development, Windows Apps, Web Dev' ], _ ['Go', '13.8', 'Growing', 'Cloud Services, System Programming' ], _ ['PowerShell', '13.5', 'Low to Moderate', 'Task Automation, DevOps, System Admin' ], _ ['AutoIt', '0.5', 'Low', 'Windows GUI Automation, Scripting' ] _ ] ... to ... ╔────────────┬────────────────┬─────────────────┬─────────────────────────────────────────╗ │ Language │ Popularity (%) │ Job Demand │ Typical Use │ ├────────────┼────────────────┼─────────────────┼─────────────────────────────────────────┤ │ JavaScript │ 62.3 │ Very High │ Web Development, Frontend/Backend │ │ C# │ 27.1 │ High │ Game Development, Windows Apps, Web Dev │ │ Go │ 13.8 │ Growing │ Cloud Services, System Programming │ │ PowerShell │ 13.5 │ Low to Moderate │ Task Automation, DevOps, System Admin │ │ AutoIt │ 0.5 │ Low │ Windows GUI Automation, Scripting │ ╚────────────┴────────────────┴─────────────────┴─────────────────────────────────────────╝ ... or other border styles (see below). Links of interest 👀 README ✨ the UDF (library) 🏃♂️ usage example 📑 CHANGELOG 🚀 Latest release Border styles Contribution, BUGs, issues, suggestions, wishes via GitHub issues / GitHub pull requests and/or here in the forum (also fine) Support give the project a ⭐ on GitHub follow me there come up with questions, suggestions, wishes 😀 Licenses Distributed under the MIT License. So don't worry and do whatever you want with it 😀 . -------------- Best regards Sven3 points -
_StringToTable
SOLVE-SMART and 2 others reacted to argumentum for a topic
Now this looks better: ╭──────────────────────┬──────────┬────────┬──────────┬───────────┬────────┬─────────┬────────╮ │ name │ time[ms] │ factor │ Std. Dev │ Std. Err. │ min │ max │ range │ ├──────────────────────┼──────────┼────────┼──────────┼───────────┼────────┼─────────┼────────┤ │ StringRegExp only │ 1.691 │ 1.00 │ 0.351 │ 0.035 │ 1.304 │ 3.167 │ 1.863 │ │ jq UDF │ 32.933 │ 19.48 │ 2.929 │ 0.293 │ 29.308 │ 43.169 │ 13.861 │ │ JsonC-UDF │ 51.086 │ 30.21 │ 3.205 │ 0.321 │ 45.625 │ 63.460 │ 17.835 │ │ pure AutoIt JSON-UDF │ 97.916 │ 57.90 │ 5.685 │ 0.569 │ 86.362 │ 113.467 │ 27.105 │ │ JSMN-based JSON-UDF │ 108.248 │ 64.01 │ 5.512 │ 0.551 │ 99.029 │ 130.864 │ 31.835 │ ╰──────────────────────┴──────────┴────────┴──────────┴───────────┴────────┴─────────┴────────╯ with round corners ( mac / win11 style ) Joke aside, about making the char(s) an array and use the "set" array so the whole code don't have to change because someone came up with something "new" ? ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ █ name │ time[ms] │ factor │ Std. Dev │ Std. Err. │ min │ max │ range █ █══════════════════════╪══════════╪════════╪══════════╪═══════════╪════════╪═════════╪════════█ █ StringRegExp only │ 1.691 │ 1.00 │ 0.351 │ 0.035 │ 1.304 │ 3.167 │ 1.863 █ █ jq UDF │ 32.933 │ 19.48 │ 2.929 │ 0.293 │ 29.308 │ 43.169 │ 13.861 █ █ JsonC-UDF │ 51.086 │ 30.21 │ 3.205 │ 0.321 │ 45.625 │ 63.460 │ 17.835 █ █ pure AutoIt JSON-UDF │ 97.916 │ 57.90 │ 5.685 │ 0.569 │ 86.362 │ 113.467 │ 27.105 █ █ JSMN-based JSON-UDF │ 108.248 │ 64.01 │ 5.512 │ 0.551 │ 99.029 │ 130.864 │ 31.835 █ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ┏━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━┯━━━━━━━━━┯━━━━━━━━┓ ┃ name │ time[ms] │ factor │ Std. Dev │ Std. Err. │ min │ max │ range ┃ ┠──────────────────────┼──────────┼────────┼──────────┼───────────┼────────┼─────────┼────────┨ ┃ StringRegExp only │ 1.691 │ 1.00 │ 0.351 │ 0.035 │ 1.304 │ 3.167 │ 1.863 ┃ ┃ jq UDF │ 32.933 │ 19.48 │ 2.929 │ 0.293 │ 29.308 │ 43.169 │ 13.861 ┃ ┃ JsonC-UDF │ 51.086 │ 30.21 │ 3.205 │ 0.321 │ 45.625 │ 63.460 │ 17.835 ┃ ┃ pure AutoIt JSON-UDF │ 97.916 │ 57.90 │ 5.685 │ 0.569 │ 86.362 │ 113.467 │ 27.105 ┃ ┃ JSMN-based JSON-UDF │ 108.248 │ 64.01 │ 5.512 │ 0.551 │ 99.029 │ 130.864 │ 31.835 ┃ ┗━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━┷━━━━━━━━┛ and what I would call "24 pin dot matrix"3 points -
_StringToTable
Musashi and 2 others reacted to WildByDesign for a topic
My initial thought with this was to make some elegant and beautiful MsgBox's, particularly About dialogs, etc. But I realized that the output from _stringtotable simply wasn't lining up properly in a MsgBox. So I decided try it with the ExtMsgBox UDF since it has more customizing options. That also came up all scrambled. Until... I realized that I would need to use a monospaced font like in other projects. Cascadia Mono didn't look as nice. So I did Consolas and it looked great. Basically, the following code was added: #include "ExtMsgBox.au3" _ExtMsgBoxSet(1, 4, 0x202020, 0xe0e0e0, -1, "Consolas", 1200, 1200) _ExtMsgBox (0, 0, "_ExtMsgBox", $sOut) The _ExtMsgBox (0, 0, "_ExtMsgBox", $sOut) just needed to be adapted into the right area of examples, of course. Screenshots: So this opens up some nice possibilities for my usage of it. Thanks again for sharing this. Also, @SOLVE-SMART I am going to follow your progress on this as well.3 points -
Hi everyone, On the back of this recent post around xaml islands, I've started to make some progress on those event handlers we were talking about earlier in this thread. So below Is my first attempt at a colour picker with notifications. (if you don't see the control, you'll likely need to swap out the application manifest, as detailed in the other thread!) If we can get things working nicely, I'd probably incorporate something into the WinRT library which would handle the cumbersome part of building the objects. I think people should only need worry about writing handlers and "registering" them! ColorPicker.zip3 points
-
App Control Tray & Policy Manager (App Control for Business)
ioa747 and 2 others reacted to WildByDesign for a topic
App Control Tray & Policy Manager (WildByDesign/WDACTrayTool: System Tray Tool for WDAC) This is likely my most powerful and featured creation with AutoIt. As always, I want to share and give back anything that I create in case it may benefit others. Features: system tray tool for managing App Control for Business (WDAC) policies GUI for managing App Control for Business (WDAC) policies scheduled tasks notifications auto dark-light mode for GUI and system tray built on GitHub Actions Screenshots: Includes: DarkMode UDF originally by @NoNameCode, updated by @argumentum libNotif by @matwachich ExtMsgBox by @Melba23 GUIListViewEx by @Melba23 TaskScheduler by @water XML by mLipok, Eltorro, Weaponx, drlava, Lukasz Suleja, oblique, Mike Rerick, Tom Hohmann, guinness, GMK Ownerdrawn status bar by @pixelsearch , including @Kafu, @Andreik, @argumentum _GUICtrlListView_SaveCSV by @guinness ModernMenuRaw by Holger Kotsch, @ProgAndy, @LarsJ3 points -
Resizable status bar without SBARS_SIZEGRIP
ioa747 and 2 others reacted to pixelsearch for a topic
Hellooo @jpm thanks for your answer, it's always nice to hear from you. So I did well not opening a trac ticket Done and done, without label, thanks to @Andreik and @argumentum for the inspiration. The status bar doesn't reach the right side of the window, because a function named _MyGUICtrlStatusBar_SetParts is called, with this result : #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $g_hGui, $g_hSizebox, $g_hOldProc, $g_hStatus, $g_iHeight, $g_aText, $g_aRatioW, $g_iBkColor, $g_iTextColor, $g_hDots ; Global $g_hBrush ; no need, as _GUICtrlStatusBar_SetBkColor() placed after _WinAPI_SetWindowTheme() does the job correctly Example() ;============================================== Func Example() _GDIPlus_Startup() Local Const $SBS_SIZEBOX = 0x08, $SBS_SIZEGRIP = 0x10 Local $iW = 300, $iH = 100 Dim $g_iBkColor = 0x383838, $g_iTextColor = 0xFFFFFF $g_hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor($g_iBkColor) ;----------------- ; Create a sizebox window (Scrollbar class) BEFORE creating the StatusBar control $g_hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 0, 0, 0, 0, $g_hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP ; Subclass the sizebox (by changing the window procedure associated with the Scrollbar class) Local $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam') $g_hOldProc = _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc)) Local $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZENWSE) _WinAPI_SetClassLongEx($g_hSizebox, -12, $hCursor) ; $GCL_HCURSOR = -12 ; $g_hBrush = _WinAPI_CreateSolidBrush($g_iBkColor) ;----------------- $g_hStatus = _GUICtrlStatusBar_Create($g_hGui, -1, "", $WS_CLIPSIBLINGS) ; ClipSiblings style +++ Local $aParts[3] = [90, 180, 280] If $aParts[Ubound($aParts) - 1] = -1 Then $aParts[Ubound($aParts) - 1] = $iW ; client width size _MyGUICtrlStatusBar_SetParts($g_hStatus, $aParts) Dim $g_aText[Ubound($aParts)] = ["Part 0", "Part 1", "Part 2"] Dim $g_aRatioW[Ubound($aParts)] For $i = 0 To UBound($g_aText) - 1 _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW) ; _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW + $SBT_NOBORDERS) ; interesting ? $g_aRatioW[$i] = $aParts[$i] / $iW Next Local $idChangeText = GUICtrlCreateLabel("Change Text", 110, 25, 80, 30, $SS_CENTER + $SS_CENTERIMAGE), $iInc GUICtrlSetColor(-1, 0xFFFF00) ; yellow ; to allow the setting of StatusBar BkColor at least under Windows 10 _WinAPI_SetWindowTheme($g_hStatus, "", "") ; Set status bar background color _GUICtrlStatusBar_SetBkColor($g_hStatus, $g_iBkColor) $g_iHeight = _GUICtrlStatusBar_GetHeight($g_hStatus) + 3 ; change the constant (+3) if necessary $g_hDots = CreateDots($g_iHeight, $g_iHeight, 0xFF000000 + $g_iBkColor, 0xFF000000 + $g_iTextColor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_MOVE, "WM_MOVE") GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idChangeText $iInc += 1 For $i = 0 To UBound($g_aText) - 1 $g_aText[$i] = "Part " & $i & " : Inc " & $iInc Next _WinAPI_RedrawWindow($g_hStatus) EndSwitch WEnd _GDIPlus_BitmapDispose($g_hDots) _GUICtrlStatusBar_Destroy($g_hStatus) _WinAPI_DestroyCursor($hCursor) ; _WinAPI_DeleteObject($g_hBrush) _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, $g_hOldProc) DllCallbackFree($hProc) _GDIPlus_Shutdown() EndFunc ;==>Example ;============================================== Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) ; Andreik If $iMsg = $WM_PAINT Then Local $tPAINTSTRUCT Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) Local $iWidth = DllStructGetData($tPAINTSTRUCT, 'rPaint', 3) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 1) Local $iHeight = DllStructGetData($tPAINTSTRUCT, 'rPaint', 4) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 2) Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsDrawImageRect($hGraphics, $g_hDots, 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndIf Return _WinAPI_CallWindowProc($g_hOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ScrollbarProc ;============================================== Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor) ; Andreik Local $iDotSize = Int($iHeight / 10) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor) _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor) Local $a[6][2] = [[2,6], [2,4], [2,2], [4,4], [4,2], [6,2]] For $i = 0 To UBound($a) - 1 _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - $iDotSize * $a[$i][0], $iHeight - $iDotSize * $a[$i][1], $iDotSize, $iDotSize, $hBrush) Next _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap EndFunc ;==>CreateDots ;============================================== Func _MyGUICtrlStatusBar_SetParts($hWnd, $aPartEdge) ; Pixelsearch If Not IsArray($aPartEdge) Then Return False Local $iParts = UBound($aPartEdge) Local $tParts = DllStructCreate("int[" & $iParts & "]") For $i = 0 To $iParts - 1 DllStructSetData($tParts, 1, $aPartEdge[$i], $i + 1) Next DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $SB_SETPARTS, "wparam", $iParts, "struct*", $tParts) _GUICtrlStatusBar_Resize($hWnd) Return True EndFunc ;==>_MyGUICtrlStatusBar_SetParts ;============================================== Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; Pixelsearch #forceref $iMsg, $wParam, $lParam If $hWnd = $g_hGUI Then Local Static $bIsSizeBoxShown = True Local $aSize = WinGetClientSize($g_hGui) Local $aGetParts = _GUICtrlStatusBar_GetParts($g_hStatus) Local $aParts[$aGetParts[0]] For $i = 0 To $aGetParts[0] - 1 $aParts[$i] = Int($aSize[0] * $g_aRatioW[$i]) Next If BitAND(WinGetState($g_hGui), $WIN_STATE_MAXIMIZED) Then _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) ; set parts until GUI right border (AutoIt function forces it) _WinAPI_ShowWindow($g_hSizebox, @SW_HIDE) $bIsSizeBoxShown = False Else If $g_aRatioW[UBound($aParts) -1] <> 1 Then $aParts[UBound($aParts) -1] = $aSize[0] - $g_iHeight ; right size of right part stuck on sizebox (no gap) _MyGUICtrlStatusBar_SetParts($g_hStatus, $aParts) ; set parts until sizebox (see preceding line) or until GUI right border WinMove($g_hSizebox, "", $aSize[0] - $g_iHeight, $aSize[1] - $g_iHeight, $g_iHeight, $g_iHeight) If Not $bIsSizeBoxShown Then _WinAPI_ShowWindow($g_hSizebox, @SW_SHOW) $bIsSizeBoxShown = True EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE ;============================================== Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam If $hWnd = $g_hGUI Then _WinAPI_RedrawWindow($g_hSizebox) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOVE ;============================================== Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) ; Kafu #forceref $hWnd, $iMsg, $wParam Local Static $tagDRAWITEM = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;hwnd hwndItem;handle hDC;long rcItem[4];ulong_ptr itemData" Local $tDRAWITEM = DllStructCreate($tagDRAWITEM, $lParam) If $tDRAWITEM.hwndItem <> $g_hStatus Then Return $GUI_RUNDEFMSG ; only process the statusbar Local $itemID = $tDRAWITEM.itemID ; status bar part number : 0 if simple bar (or 0, 1, 2... if multi parts) Local $hDC = $tDRAWITEM.hDC Local $tRect = DllStructCreate("long left;long top;long right;long bottom", DllStructGetPtr($tDRAWITEM, "rcItem")) ; _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $g_hBrush) ; backgound color _WinAPI_SetTextColor($hDC, $g_iTextColor) ; text color _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $tRect.top + 1) DllStructSetData($tRect, "left", $tRect.left + 1) _WinAPI_DrawText($hDC, $g_aText[$itemID], $tRect, $DT_LEFT) Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM3 points -
Resizable status bar without SBARS_SIZEGRIP
WildByDesign and 2 others reacted to argumentum for a topic
3 points -
Resizable status bar without SBARS_SIZEGRIP
pixelsearch and 2 others reacted to WildByDesign for a topic
3 points -
JSON UDF using JSON-C
Musashi and 2 others reacted to seangriffin for a topic
I created this UDF for JSON using JSON-C because I needed high performance parsing of JSON data in my script. I needed to query large data arrays of several thousand entries and other UDFs were taking many seconds to do so. With this UDF a query of 5,000 array entries takes me about 600ms (see Example2.au3). This UDF executes JSON functions through a JSON-C DLL to achieve better performance. The JSON-C project is https://github.com/json-c/json-c. To download this UDF please visit https://github.com/seanhaydongriffin/JsonC-UDF. Two examples are provided (Example1.au3 and Example2.au3) that demonstrate all the functions.3 points -
Please help with Run PowerShell Command 'quotes"
Trong and 2 others reacted to AspirinJunkie for a topic
Yes, the escaping of the quotation marks within the commands can be quite annoying. So you have to escape the quotation marks in the command. This is a bit easier if you swap the double quotation marks with the single ones. Something like this: Local $command_r = 'PowerShell -Command "' & StringReplace($powerShellCommand, '"', '\"') & '"' Why you are using @ComSpec (i.e. the cmd.exe) although you want to call the powershell instead is not clear to me. I have written the following function myself. Maybe it will help you here: #include <WinAPIConv.au3> ; Get the list of running processes and filter for processes named "notepad" Local $commandToRun = "Get-Process | Where-Object {$_.ProcessName -eq 'notepad'} | Format-List Name, Id, MainWindowTitle" Local $powerShellResult = _prc_runPS($commandToRun) If @error Then MsgBox(16, "Error", "Could not get results from PowerShell.") Else If $powerShellResult Then MsgBox(64, "PowerShell Result", "Result returned from PowerShell: " & $powerShellResult) Else MsgBox(64, "Information", "No processes match the criteria.") EndIf EndIf ; Another example: Get the PowerShell version Local $versionCommand = "$PSVersionTable.PSVersion" Local $powerShellVersion = _prc_runPS($versionCommand) If Not @error Then MsgBox(64, "PowerShell Version", "PowerShell Version: " & $powerShellVersion) EndIf ; #FUNCTION# ====================================================================================== ; Name ..........: _prc_runPS() ; Description ...: Executes a Powershell command and returns its output as a string ; Syntax ........: _prc_runPS($sCmd, [$nFlags = 0x8, [$sWorkDir = '', [$sOptions = '-NoProfile -ExecutionPolicy Bypass', [$nTimeOut = 0, $bLoopRead = False]]]]]) ; Parameters ....: $sCmd - the powershell command to be executed as you would use it directly in the powershell ; you can also use line breaks ; $nFlags - [optional] flags that control the handling of the two streams stdout and stderr: ; 0x2: [Default] Return a string with the content of stdout ; 0x4: [Default] Return a string with the content of stderr ; 0x6: Return a array with the content of stdout in $Array[0] and stderr in $Array[1] ; 0x8: Return a string with the combined content of stdout and stderr ; $sWorkDir - [optional] the working directory like in Run() ; $sOptions - [String] additional parameters to be passed to powershell.exe ; $nTimeOut - [optional] the maximum time to wait for the process to be completed (see @error return) ; default = 0: infinite; every other number: wait time in seconds ; $bLoopRead - if true: stdout and stderr are read in a loop; if false: they are read in one go ; Return values .: Success: String with powershell output or if $nFlags = 0x6: array with cmdline outputs and set ; @extended = return code of the process ; Failure: "" and set @error to: ; | 1: error during run; @extended = @error of Run() ; | 2: ProcessWaitClose reaches timeout before completion ; | 3: content written in stderr - indicates error messages of the program (not a real error) ; Author ........: AspirinJunkie ; Modified ......: 2025-03-10 ; Related .......: _WinAPI_OemToChar() ; Example .......: Yes ; $x = _prc_runPS('$obj = New-Object -ComObject "Shell.Application"' & @CRLF & _ ; '$obj | Get-Member') ; ConsoleWrite($x & @CRLF) ; ================================================================================================= Func _prc_runPS($sCmd, $nFlags = 0x8, $sWorkDir = '', $sOptions = '-NoProfile -ExecutionPolicy Bypass', $nTimeOut = 0, $bLoopRead = False) ; handling Default keyword word for the parameters If IsKeyWord($nFlags) = 1 Then $nFlags = 0x8 If IsKeyWord($sWorkDir) = 1 Then $sWorkDir = "" If IsKeyWord($sOptions) = 1 Then $sOptions = '-NoProfile -ExecutionPolicy Bypass' ; format command as call parameter, passed to powershell.exe $sCmd = StringFormat('powershell.exe %s -Command "%s"', $sOptions, StringReplace($sCmd, '"', '\"',0,1)) ; start the cmd/process Local $iPID = Run($sCmd, $sWorkDir, @SW_Hide, $nFlags) If @error Then Return SetError(1, @error, "") Local $iExit, $sStdOut = "", $sStdErr = "" If $bLoopRead Then ; fill stdout and/or stderr over a loop Do If BitAND($nFlags, 0x4) Then $sStdErr &= StderrRead($iPID) $sStdOut &= StdoutRead($iPID) If @error Then ExitLoop Until 0 ; determine the exit code $iExit = ProcessWaitClose($iPID, 0) ElseIf ProcessWaitClose($iPID, $nTimeOut) = 0 Then ; wait until process ends Return SetError(2, 0, "") Else ; read out the process results in one go $iExit = @extended $sStdOut = StdoutRead($iPID) $sStdErr = BitAND($nFlags, 0x4) ? StderrRead($iPID) : "" EndIf ; return only stderr If $nFlags = 0x4 Then Return SetExtended($iExit, _WinAPI_OemToChar($sStdErr)) ; return array if stdout and stderr should be read separately ElseIf $nFlags = 0x6 Then Local $aRet[2] = [_WinAPI_OemToChar($sStdOut), _WinAPI_OemToChar($sStdErr)] Return SetError($sStdErr = "" ? 0 : 3, $iExit, $aRet) EndIf ; return a string Return SetExtended($iExit, _WinAPI_OemToChar($sStdOut)) EndFunc3 points -
Long time ago some posted a VB Wrapper for the controls To run them you need to install the VB6 Controls Runtime Plus 2.2 Dependency files: https://sourceforge.net/projects/vb6extendedruntime/ You only need this to install (not the rest !!) Once installed you can run the included AU3 Example scripts : I guess once you have installed the VB6 runtime control you can get the Edge Wrapper to work as well... Success _VB Controls.zip3 points
-
LibreOffice UDF Help and Support
argumentum and one other reacted to JALucena for a topic
Hi everybody since two weeks ago i have been working with this UDF in several proyects and I think its great! In the past i worked with this UDF: https://www.autoitscript.com/forum/topic/151530-ooolibo-calc-udf/ which is fantastic too. I think i have found a bug in the function _LOCalc_DocViewWindowSettings from the library LibreOfficeCalc_Doc.au3. In the line 2161 there is a call to the function __LOCalc_ArrayFill and the fourth and fifth parameters are switched. where it says __LOCalc_ArrayFill($abView, $oCurCont.HasColumnRowHeaders(), $oCurCont.HasVerticalScrollBar(), $oCurCont.HasSheetTabs(), $oCurCont.HasHorizontalScrollBar(), _ it must be __LOCalc_ArrayFill($abView, $oCurCont.HasColumnRowHeaders(), $oCurCont.HasVerticalScrollBar(), $oCurCont.HasHorizontalScrollBar(), $oCurCont.HasSheetTabs(), _ After modified it works fine. Thank you for your job.2 points -
SciTE AI assistant The first approach, to integrate an AI assistant into SciTE works directly with the ollama. I use a small model qwen2.5-coder:3b as default, so that I don't have to wait too long for a response. However, I have set as a parameter which model it calls, so that it changes the model per job if necessary The first job is to make function headers Simply run the script, select a function body within SciTE and press the {F10} key It's not perfect, but it's a template. ; https://www.autoitscript.com/forum/topic/212888-scite-ai-assistant ;---------------------------------------------------------------------------------------- ; Title...........: SciTE_AI_Assistant.au3 ; Description.....: SciTE AI assistant - first feature: Function headers generator ; Simply select a function within SciTE and press the {F10} key. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.7 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <File.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Global $DebugInfo = True ; True = debug info * <-- HotKeySet("{F10}", "GenerateFunctionHeader") ; * <-- While 1 Sleep(100) WEnd ;--------------------------------------------------------------------------------------- Func GenerateFunctionHeader() HotKeySet("{F10}") Local $hWnd = WinActivate("[CLASS:SciTEWindow]") If Not $hWnd Then Return SetError(HotKeySet("{F10}", "GenerateFunctionHeader")) Local $sSelected = _SciteIO() ;Get Selection If @error Then ToolTip(" Copy failed.") Else If StringLeft($sSelected, 4) = "func" Then Send('{UP}') Local $sOut = AI_GenerateFunctionHeader($sSelected) If @error Then ToolTip(@error) Else _SciteIO(@CRLF & @CRLF & $sOut & @CRLF & @CRLF) EndIf Else ToolTip("No Func selected") EndIf EndIf Sleep(2000) ToolTip("") HotKeySet("{F10}", "GenerateFunctionHeader") EndFunc ;==>GenerateFunctionHeader ;--------------------------------------------------------------------------------------- Func AI_GenerateFunctionHeader($sFullFunction, $sAssistant = -1) If $sAssistant = -1 Then $sAssistant = "qwen2.5-coder:3b" Local $sInstruction, $sSystem, $sOut $sInstruction = "Generate a function header for the given AutoIt function." & @CRLF $sInstruction &= "Use the exact standard UDF comment format, as shown in the example." & @CRLF $sInstruction &= "DO NOT invent or assume any parameters, return values, or behavior not explicitly visible in the function." & @CRLF $sInstruction &= "If the function has no parameters, leave 'Parameters' empty." & @CRLF $sInstruction &= "If it does not return a value, then in 'Return values' write 'None'." & @CRLF $sInstruction &= "Align all parameter names to the same column width using consistent spaces. The hyphen (-) must appear in the same column for all parameters." & @CRLF $sInstruction &= "If the function interacts with GUI elements, include that in the 'Remarks' section." & @CRLF $sInstruction &= "If the 'Remarks' line exceeds 130 characters, break it into multiple lines starting each with '; ' like in the example." & @CRLF $sInstruction &= "Optional parameters must be shown using nested brackets as per the example." & @CRLF $sInstruction &= "Match spacing exactly as in the example (e.g., align parameter names and descriptions)." & @CRLF $sInstruction &= "Use concise, factual language—do not embellish or rephrase beyond what's explicit in the function." & @CRLF $sInstruction &= "In 'Return values', include detailed descriptions of any @error values that may be set." & @CRLF $sInstruction &= "Use the following format for @error documentation: '@error = X: Explanation' as shown in the example." & @CRLF $sInstruction &= "If applicable, describe both the success and failure outcomes clearly, using 'Success:' and 'Failure:'." & @CRLF $sInstruction &= "The 'Author' is ioa747. Dependencies must match actual function calls only. Do not invent links or libraries." & @CRLF $sInstruction &= "Avoid unnecessary technical jargon. Keep lines compact and accurate." & @CRLF & @CRLF $sInstruction &= "Example format:" & @CRLF $sInstruction &= "; #FUNCTION# ====================================================================================================================" & @CRLF $sInstruction &= "; Name...........: StreamToEdit" & @CRLF $sInstruction &= "; Description....: Generate response from the AI assistant with streaming support." & @CRLF $sInstruction &= "; Syntax.........: StreamToEdit( $sPrompt [, $sAssistant = ""qwen2.5-coder:1.5b"" [, $sSystem = ""You are an AI assistant."" [, $fTemperature = 0.3 [, $iSeed = 0]]]] )" & @CRLF $sInstruction &= "; Parameters.....: $sPrompt - The prompt to be sent to the assistant." & @CRLF $sInstruction &= "; $sAssistant - [optional] The name of the AI assistant. (Default is ""qwen2.5-coder:3b"")" & @CRLF $sInstruction &= "; $sSystem - [optional] The system instruction provided by the user. (Default is ""You are an AI assistant."")" & @CRLF $sInstruction &= "; $fTemperature - [optional] The temperature value for the assistant's output. (Default is 0.3)" & @CRLF $sInstruction &= "; $iSeed - [optional] The seed value for the assistant's response. (Default is 0)" & @CRLF $sInstruction &= "; Return values .: Success: Returns the available models if the specified model is found." & @CRLF $sInstruction &= "; Failure: Sets @error and returns an empty string with a custom message." & @CRLF $sInstruction &= "; @error = 1: Ollama is not running at the default URL." & @CRLF $sInstruction &= "; @error = 2: The specified model was not found." & @CRLF $sInstruction &= "; Author ........: ioa747" & @CRLF $sInstruction &= "; Modified ......: " & @CRLF $sInstruction &= "; Remarks .......: This function uses a WinHttp request to communicate with the Ollama API." & @CRLF $sInstruction &= "; Related .......: " & @CRLF $sInstruction &= "; Link ..........: " & @CRLF $sInstruction &= "; Example .......: " & @CRLF $sInstruction &= "; ===============================================================================================================================" & @CRLF & @CRLF $sInstruction &= "Now generate a header comment for the following function:" & @CRLF $sInstruction &= "```AutoIt" & @CRLF $sInstruction &= $sFullFunction & @CRLF $sInstruction &= "```" & @CRLF Local $hTimer = TimerInit() $sOut = AskToAI($sInstruction, $sAssistant, $sSystem, 0, 1) If @error Then Return SetError(@error, 0, $sOut) Return "> " & $sAssistant & " processed in: " & Round(TimerDiff($hTimer) / 1000, 3) & " seconds " & @CRLF & $sOut EndFunc ;==>AI_GenerateFunctionHeader ;--------------------------------------------------------------------------------------- Func AskToAI($sPrompt, $sAssistant = -1, $sSystem = -1, $iTemperature = -1, $iSeed = -1) If $sSystem = "" Or $sSystem = -1 Or $sSystem = Default Then $sSystem = "You are an AI assistant designed to analyze AutoIt code." ; best mini models result with: qwen2.5-coder:1.5b ; qwen2.5-coder:3b 1.8 GB ; llama3.2:3b-instruct-q8_0 3.2 GB If $sAssistant = "" Or $sAssistant = -1 Or $sAssistant = Default Then $sAssistant = "qwen2.5-coder:3b" If $iTemperature = "" Or $iTemperature = -1 Or $iTemperature = Default Then $iTemperature = 0.3 If $iSeed = "" Or $iSeed = -1 Or $iSeed = Default Then $iSeed = 0 Json_EscapeString($sAssistant) Json_EscapeString($sSystem) Json_EscapeString($sPrompt) Local $sRequest = '{' $sRequest &= '"model": "' & $sAssistant & '", ' $sRequest &= '"system": "' & $sSystem & '", ' $sRequest &= '"prompt": "' & $sPrompt & '", ' $sRequest &= '"stream": false, ' $sRequest &= '"temperature": ' & $iTemperature & ', ' $sRequest &= '"seed": ' & $iSeed $sRequest &= '}' DW("$sRequest=>" & $sRequest & @CRLF) ;_FileWriteLog(StringTrimRight(@ScriptFullPath, 4) & ".log", $sRequest) Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1") ; ResolveTimeout: 5 sec ; ConnectTimeout: 10 sec ; SendTimeout: 30 sec ; ReceiveTimeout: 120 sec $oHttp.SetTimeouts(5000, 10000, 30000, 120000) $oHttp.Open("POST", "http://localhost:11434/api/generate", False) $oHttp.SetRequestHeader("Content-Type", "application/json") $oHttp.Send($sRequest) ; Check if request was successful If $oHttp.Status <> 200 Then Local $aErr = HTTP_STATUS_CODES($oHttp.Status, $oHttp.ResponseText) MsgBox(16, " ( " & $aErr[0] & " ) " & $aErr[1], $aErr[2]) Return SetError(1, 0, $oHttp.ResponseText) EndIf Local $sResponse = $oHttp.ResponseText DW("$sResponse=>" & $sResponse & @CRLF) ; Parse response => suporting value: .model ; .created_at ; .response ; .done_reason Local $mJson = Json_Map($sResponse) ; DW("$mJson.response=" & $mJson.response & @CRLF) MapExists($mJson, "response") If @error Then MsgBox(16, "AskToAI() l: " & @ScriptLineNumber, "_JsonMap() fail to response") Return SetError(2, 0, "_JsonMap() fail to response") EndIf $sResponse = $mJson.response Return $sResponse EndFunc ;==>AskToAI ;--------------------------------------------------------------------------------------- Func _SciteIO($sTxt = "") Local $hWnd = WinActivate("[CLASS:SciTEWindow]") If Not $hWnd Then Return SetError(1) Local $ClipBack = ClipGet() ; backup clip data Local $hCtrlHnd, $ClipData, $iTimeout = 2000 ClipPut("<empty>") Local $iStartTime = TimerInit() If $sTxt = "" Then ; ### get selection to clip ### $hCtrlHnd = ControlGetHandle($hWnd, '', 'Scintilla1') _SendMessage($hCtrlHnd, $WM_COPY) While TimerDiff($iStartTime) < $iTimeout ; Wait until the timeout $ClipData = ClipGet() If $ClipData <> "<empty>" Then ExitLoop Sleep(10) WEnd Else ; ### set Txt to Console ### $hCtrlHnd = ControlGetHandle($hWnd, '', 'Scintilla2') ClipPut($sTxt) While TimerDiff($iStartTime) < $iTimeout ; Wait until the timeout $ClipData = ClipGet() If $ClipData <> "<empty>" Then ExitLoop Sleep(10) WEnd If $ClipData <> "<empty>" Then Local $iWndHeight = ControlGetPos ($hWnd, "", $hCtrlHnd) If $iWndHeight[3] = 0 Then WinMenuSelectItem($hWnd, "", "&View", "&Output") Sleep(10) ControlSend($hWnd, "", $hCtrlHnd, "^{DOWN}") If Not $DebugInfo Then WinMenuSelectItem($hWnd, "", "&Tools", "Clear &Output") ;* Clear console Output Sleep(10) _SendMessage($hCtrlHnd, $WM_PASTE) EndIf EndIf ClipPut($ClipBack) ; Restore clip data Return ($ClipData = "<empty>" ? SetError(2) : $ClipData) EndFunc ;==>_SciteIO ;--------------------------------------------------------------------------------------- Func HTTP_STATUS_CODES($iStatus, $sResponseText = "") Local $aResult[3] = [$iStatus, "Unknown Status", "An unknown HTTP status code was returned."] Local $HTTP_STATUS_CODES[41][3] = [[40, "HTTP status", "description"] _ , [100, "HTTP_STATUS_CONTINUE", "The request can be continued."] _ , [101, "HTTP_STATUS_SWITCH_PROTOCOLS", "The server has switched protocols in an upgrade header."] _ , [200, "HTTP_STATUS_OK", "The request completed successfully."] _ , [201, "HTTP_STATUS_CREATED", "The request has been fulfilled and resulted in the creation of a new resource."] _ , [202, "HTTP_STATUS_ACCEPTED", "The request has been accepted for processing, but the processing has not been completed."] _ , [203, "HTTP_STATUS_PARTIAL", "The returned meta information in the entity-header is not the definitive set available from the originating server."] _ , [204, "HTTP_STATUS_NO_CONTENT", "The server has fulfilled the request, but there is no new information to send back."] _ , [205, "HTTP_STATUS_RESET_CONTENT", "The request has been completed, and the client program should reset the document view that caused the request to be sent to allow the user to easily initiate another input action."] _ , [206, "HTTP_STATUS_PARTIAL_CONTENT", "The server has fulfilled the partial GET request for the resource."] _ , [207, "HTTP_STATUS_WEBDAV_MULTI_STATUS", "During a World Wide Web Distributed Authoring and Versioning (WebDAV) operation, this indicates multiple status codes for a single response. The response body contains Extensible Markup Language (XML) that describes the status codes."] _ , [300, "HTTP_STATUS_AMBIGUOUS", "The requested resource is available at one or more locations."] _ , [301, "HTTP_STATUS_MOVED", "The requested resource has been assigned to a new permanent Uniform Resource Identifier (URI), and any future references to this resource should be done using one of the returned URIs."] _ , [302, "HTTP_STATUS_REDIRECT", "The requested resource resides temporarily under a different URI."] _ , [303, "HTTP_STATUS_REDIRECT_METHOD", "The response to the request can be found under a different URI and should be retrieved using a GET HTTP verb on that resource."] _ , [304, "HTTP_STATUS_NOT_MODIFIED", "The requested resource has not been modified."] _ , [305, "HTTP_STATUS_USE_PROXY", "The requested resource must be accessed through the proxy given by the location field."] _ , [307, "HTTP_STATUS_REDIRECT_KEEP_VERB", "The redirected request keeps the same HTTP verb. HTTP/1.1 behavior."] _ , [400, "HTTP_STATUS_BAD_REQUEST", "The request could not be processed by the server due to invalid syntax."] _ , [401, "HTTP_STATUS_DENIED", "The requested resource requires user authentication."] _ , [402, "HTTP_STATUS_PAYMENT_REQ", "Not implemented in the HTTP protocol."] _ , [403, "HTTP_STATUS_FORBIDDEN", "The server understood the request, but cannot fulfill it."] _ , [404, "HTTP_STATUS_NOT_FOUND", "The server has not found anything that matches the requested URI."] _ , [405, "HTTP_STATUS_BAD_METHOD", "The HTTP verb used is not allowed."] _ , [406, "HTTP_STATUS_NONE_ACCEPTABLE", "No responses acceptable to the client were found."] _ , [407, "HTTP_STATUS_PROXY_AUTH_REQ", "Proxy authentication required."] _ , [408, "HTTP_STATUS_REQUEST_TIMEOUT", "The server timed out waiting for the request."] _ , [409, "HTTP_STATUS_CONFLICT", "The request could not be completed due to a conflict with the current state of the resource. The user should resubmit with more information."] _ , [410, "HTTP_STATUS_GONE", "The requested resource is no longer available at the server, and no forwarding address is known."] _ , [411, "HTTP_STATUS_LENGTH_REQUIRED", "The server cannot accept the request without a defined content length."] _ , [412, "HTTP_STATUS_PRECOND_FAILED", "The precondition given in one or more of the request header fields evaluated to false when it was tested on the server."] _ , [413, "HTTP_STATUS_REQUEST_TOO_LARGE", "The server cannot process the request because the request entity is larger than the server is able to process."] _ , [414, "HTTP_STATUS_URI_TOO_LONG", "The server cannot service the request because the request URI is longer than the server can interpret."] _ , [415, "HTTP_STATUS_UNSUPPORTED_MEDIA", "The server cannot service the request because the entity of the request is in a format not supported by the requested resource for the requested method."] _ , [449, "HTTP_STATUS_RETRY_WITH", "The request should be retried after doing the appropriate action."] _ , [500, "HTTP_STATUS_SERVER_ERROR", "The server encountered an unexpected condition that prevented it from fulfilling the request."] _ , [501, "HTTP_STATUS_NOT_SUPPORTED", "The server does not support the functionality required to fulfill the request."] _ , [502, "HTTP_STATUS_BAD_GATEWAY", "The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request."] _ , [503, "HTTP_STATUS_SERVICE_UNAVAIL", "The service is temporarily overloaded."] _ , [504, "HTTP_STATUS_GATEWAY_TIMEOUT", "The request was timed out waiting for a gateway."] _ , [505, "HTTP_STATUS_VERSION_NOT_SUP", "The server does not support the HTTP protocol version that was used in the request message."]] For $i = 1 To $HTTP_STATUS_CODES[0][0] If $HTTP_STATUS_CODES[$i][0] = $iStatus Then ;$aResult[0] = $HTTP_STATUS_CODES[$i][0] $aResult[1] = $HTTP_STATUS_CODES[$i][1] $aResult[2] = $HTTP_STATUS_CODES[$i][2] ExitLoop EndIf Next ConsoleWrite("! $aResult[0]=" & $aResult[0] & ", [1]=" & $aResult[1] & ", [2]=" & $aResult[2] & @TAB & "( " & $sResponseText & " )" & @CRLF) $aResult[2] &= @CRLF & @CRLF & "Details: " & $sResponseText Return $aResult EndFunc ;==>HTTP_STATUS_CODES ;--------------------------------------------------------------------------------------- Func DW($sString, $iLine = @ScriptLineNumber) If Not $DebugInfo Then Return ConsoleWrite("(" & $iLine & ") " & $sString) EndFunc ;==>DW ;--------------------------------------------------------------------------------------- Func Json_EscapeString(ByRef $sString) ;=== Converts normal string to a JSON-safe string === ; Escape backslashes first to avoid double-processing $sString = StringReplace($sString, '\', '\\', 0, 1) ; Escape known JSON control characters $sString = StringReplace($sString, Chr(8), '\b', 0, 1) ; Backspace $sString = StringReplace($sString, Chr(12), '\f', 0, 1) ; Formfeed $sString = StringReplace($sString, @CRLF, '\n', 0, 1) ; CRLF → \n $sString = StringReplace($sString, @LF, '\n', 0, 1) ; LF → \n $sString = StringReplace($sString, @CR, '\r', 0, 1) ; CR → \r $sString = StringReplace($sString, @TAB, '\t', 0, 1) ; Tab → \t ; Escape double quotes $sString = StringReplace($sString, '"', '\"', 0, 1) ; Escape \u00XX characters ; nothing yet Return $sString EndFunc ;==>Json_EscapeString ;--------------------------------------------------------------------------------------- Func Json_UnEscapeString(ByRef $sString) ;=== Converts a JSON-escaped string back into normal string === If StringInStr($sString, '\') = 0 Then Return $sString ; Unescape quotes and backslashes first $sString = StringReplace($sString, '\"', '"', 0, 1) $sString = StringReplace($sString, '\\', '\', 0, 1) ; Unescape standard control characters $sString = StringReplace($sString, '\b', Chr(8), 0, 1) $sString = StringReplace($sString, '\f', Chr(12), 0, 1) $sString = StringReplace($sString, '\n', @LF, 0, 1) $sString = StringReplace($sString, '\r', @CR, 0, 1) $sString = StringReplace($sString, '\t', @TAB, 0, 1) ; Unescape \u00XX characters $sString = StringReplace($sString, '\u003c', '<', 0, 1) $sString = StringReplace($sString, '\u003e', '>', 0, 1) Return $sString EndFunc ;==>Json_UnEscapeString ;--------------------------------------------------------------------------------------- Func Json_Map($sJson) ;=== It not support numbers, booleans, arrays or nested objects. === Local $mJson[] ; Remove curly braces and trim $sJson = StringStripWS(StringTrimLeft(StringTrimRight($sJson, 1), 1), 3) ; Match all "key": "value" pairs Local $aPairs = StringRegExp($sJson, '"([^"]+)"\s*:\s*"((?:\\.|[^"\\])*)"', 3) If @error Then Return SetError(2, 0, 0) For $i = 0 To UBound($aPairs) - 1 Step 2 Local $sKey = $aPairs[$i] Local $sVal = $aPairs[$i + 1] Json_UnEscapeString($sVal) $mJson[$sKey] = $sVal ;ConsoleWrite("$sKey=" & $sKey & @CRLF) Next Return $mJson EndFunc ;==>Json_Map ;--------------------------------------------------------------------------------------- I will update the thread as soon as anything new comes up. Please, every comment is appreciated! leave your comments and experiences here! Thank you very much2 points
-
GUI Button Responsiveness Drops After Setting Color or Background Color
ioa747 and one other reacted to pixelsearch for a topic
Hello @TitaniusPlatinum I had the same concern a few weeks ago, in this post . Here is a part of the comment : Melba23's code indicates the way to handle this. May I suggest yöu save his code on your computer. I kept his useful code about a month ago, saving it under a catchy name '"Double-click a label (WM_COMMAND).au3" Good luck2 points -
Win 11 - My own border color ( Help area )
Musashi 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 -
DarkMode UDF for AutoIt's Win32GUIs
argumentum and one other reacted to UEZ for a topic
Is there a way to check if visible GUI is in dark mode? Edit: this seems to work: ;Coded by UEZ build 2025-05-14 #include <AutoItConstants.au3> #include <StringConstants.au3> #include <WinAPISysWin.au3> Const $DWMWA_USE_IMMERSIVE_DARK_MODE = @OSBuild < 18362 ? 19 : 20 Func _WinAPI_IsWindowDarkMode($hWnd) Local $value = DllStructCreate("int dm") Local $ret = DllCall("dwmapi.dll", "long", "DwmGetWindowAttribute","hwnd", $hWnd, "uint", $DWMWA_USE_IMMERSIVE_DARK_MODE, "struct*", $value, "uint", DllStructGetSize($value)) If @error Or $ret[0] <> 0 Then Return 0 Return $value.dm <> 0 EndFunc Global $aWinList = WinList(), $i, $iStatus For $i = 1 To $aWinList[0][0] If _WinAPI_IsWindowVisible($aWinList[$i][1]) Then If IsHWnd($aWinList[$i][1]) Then $iStatus = _WinAPI_IsWindowDarkMode($aWinList[$i][1]) ConsoleWrite($aWinList[$i][1] & ": " & $iStatus & " -> " & StringRegExpReplace($aWinList[$i][0], "[\r\n]+", "") & @CRLF) EndIf EndIf Next2 points -
SciTE AI assistant
argumentum and one other reacted to SOLVE-SMART for a topic
You are such a nice person @ioa747. In my opinion there is no apology necessary at all. There was a misunderstanding and that's it. But thanks for the clarification - no worries and thanks for your effort regarding this LLM <==> AutoIt thingy 😁 . Best regards Sven2 points -
JSON UDF in pure AutoIt
SOLVE-SMART and one other reacted to AspirinJunkie for a topic
Ok, so let's just say that the function is not “broken” after all, does what it is supposed to do and does it correctly without any known errors? It has always been the responsibility of the application code to use their respective dependencies correctly. Especially as non-public interfaces are used here, which were never intended to be used by the user. The _JSON_Generate() function is intended to format a string in a JSON-compliant manner as a user. Its behavior has not changed over time. A change would have no effect on the described functionality of the UDF, which is why there is no need for action from my point of view.2 points -
Listview replacing, coloring, doubleclick
argumentum and one other reacted to pixelsearch for a topic
Ok, I'll finally post something in this thread, though we had a solution for 2 days ("we" = me and a helpful tester via PM, for confirmation on a different OS) But the sentence "Back to your issue, I will not give you the answer." refrained us for posting anything, to avoid creating new tensions. Just have a look at this post above, then 1) Change this line... For $i = 1 To 10 ...to For $i = 1 To 500 Now the script throws the error you reported : $tCustDraw.clrTextBk = ($mColor[$tCustDraw.IDFrom])[$iItem][$iSubItem] ? ($mColor[$tCustDraw.IDFrom])[$iItem][$iSubItem] : 0xFFFFFF $tCustDraw.clrTextBk = ($mColor[$tCustDraw.IDFrom])^ ERROR 2) Then move this block of 3 lines... GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) GUIRegisterMsg($WM_LBUTTONUP, WM_LBUTTONUP) GUISetState() ...and place it just before While True : GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) GUIRegisterMsg($WM_LBUTTONUP, WM_LBUTTONUP) GUISetState() While True ...now everything should work fine. It seems that after a few hundreds of list items added, then WM_NOTIFY is always triggered (the listview needs to be redrawn). So if you place the block of 3 lines too early, then the script will crash because the array $aColor is not defined (when map is encountered within the WM_NOTIFY function) Moving the 3 lines just before the main loop should fix it. Please tell us if this solution works for you.2 points -
I'm closing this topic as I have found a solution. Basically, in the app I'm flipping between my regular domain, and the global domain, and the flipping action was not properly setting things up in the initial go-from-regular-to-global-domain action. This was causing the AD query to fail. Thanks to everyone who may have already looked at this issue, and I'm now sorry that I brought this up. Bob2 points
-
_StringToTable
argumentum and one other reacted to ioa747 for a topic
I added functionality to accept and array as input. I renamed $iString to $vString, and now it verifies whether $vString is an array and converts it to a string as needed.2 points -
Yeah I think so, I'm getting E_FAIL at the moment trying to create the control though. I think I'll need to look closer at these WinUI 2 libraries.. The other thing is- I'm not sure how it handles its User Data Folder for Xaml islands. In a UWP app this would apparently be squirreled away in the "ApplicationData\LocalFolder subfolder in the package's folder" - so not sure how this will translate! The code would look like something like this to create the control... #include "Include\Classes\Windows.UI.Xaml.Controls.Webview.au3" #include "Include\Classes\Windows.Foundation.Uri.au3" ...... Local $pCtrl_Fact = _WinRT_GetActivationFactory("Windows.UI.Xaml.Controls.WebView", $sIID_IWebviewFactory4) _WinRT_DisplayInterfaces($pCtrl_Fact) Local $pControl = IWebViewFactory4_CreateInstanceWithExecutionMode($pCtrl_Fact, $mWebViewExecutionMode["SameThread"]) IDesktopWindowXamlSource_SetContent($pDesktopWinXamlSrc, $pControl) Local $pSrcFact = _WinRT_GetActivationFactory("Windows.Foundation.Uri", $sIID_IUriRuntimeClassFactory) Local $pSrc = IUriRuntimeClassFactory_CreateUri($pSrcFact, "https://www.autoitscript.com/forum") IWebView_Navigate($pControl, $pSrc)2 points
-
Modern cameras and cellphones include a lot of data about photos taken into the image as EXIF data, which includes exposure info, GPS coordinates, and exposure date/time. In many file operations (moving, editing, etc) the dates don't reflect the real time of exposure, this script fixes that. To use this script you'll have to first install the app from exiftool.org onto your computer. This script simply allows you to select a folder and it grabs the date/time from all the JPGs in it and changes their file created and modified dates to correspond to the EXIF date. Pretty basic, but just adjust the code as you like! ;PROCESS JPG IMAGES IN A SELECTED FOLDER WITH EXIFTOOL TO RETRIEVE SHOOTING DATE AND REWRITES FILE DATES. ;SCANS A DIRECTORY FOR IMAGES AND SETS THE DATES CREATED AND MODIFIED FROM THE EXIF SHOOTING DATE ;The EXIFTOOL app needs to be downloaded from https://exiftool.org/ (then adjust its folder name below) #include <autoitconstants.au3> #include <MsgBoxConstants.au3> $dirname = FileSelectFolder('Select a Folder','') Local $hSearch = FileFindFirstFile($dirname & "\*.jpg") If $hSearch = -1 Then ; Check if the search was successful. MsgBox($MB_SYSTEMMODAL, "", "Error: No JPG files were found in that folder.") exit EndIf Local $imagefile = "", $iResult = 0 local $arr[1] = ['JPG with EXIF GPS - ' & $dirname] SplashTextOn("EXIF DATE CHECK...", "Setting DATE MODIFIED from EXIF in images...",400,100,500,100) While 1 $imagefile = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop $pid = Run(@ComSpec & " /c " & 'd:\apps\exiftool.exe -DateTimeOriginal ' & $dirname & '\' & $imagefile, "", @SW_HIDE, 2) ProcessWaitClose($pid) $sOutput = StringMid(StdoutRead($pid),35) $sOutput = StringRegExpReplace($sOutput,'[: ]','') ConsoleWrite("EXF: " & $sOutput & @CRLF) ;Commment out the fields you don't want to be updated... FileSetTime($dirname & '\' & $imagefile,$sOutput, 0) ;SET FILE MODIFIED TIME TO SHOOTING TIME FROM EXIF FileSetTime($dirname & '\' & $imagefile,$sOutput, 1) ;SET FILE CREATED TIME TO SHOOTING TIME FROM EXIF ; FileSetTime($dirname & '\' & $imagefile,$sOutput, 2) ;SET FILE ACCESSED TIME TO SHOOTING TIME FROM EXIF ConsoleWrite('UPDATED:' & @CRLF) ConsoleWrite('MOD: ' & FileGetTime($dirname & '\' & $imagefile, 0, 1) & @CRLF) ConsoleWrite('CRE: ' & FileGetTime($dirname & '\' & $imagefile, 1, 1) & @CRLF) ConsoleWrite('ACC: ' & FileGetTime($dirname & '\' & $imagefile, 2, 1) & @CRLF) ControlSetText('EXIF DATE CHECK...', "", "Static1", $dirname & '\' & $imagefile & ' ' & $sOutput) WEnd FileClose($hSearch) splashoff() msgbox(64,'Done','File date processing completed.')2 points
-
MediaPlayerElement - WinRT Xaml Island
argumentum and one other reacted to MattyD for a topic
Yeah, there's a couple of options really, You could just modify that "update manifest.au3" so it replaces the resource in your compiled script (rather than @autoitexe). But my original approach was to modify AutoItWrapper.au3. On line 2670 I inserted this. FileWriteLine($hTempFile2, ' <maxversiontested Id="10.0.18362.1" />') Then in your script, you need the following directive to trigger that bit of code: #Autoit3Wrapper_Res_Compatibility=Win10 I don't think the actual build number is critical - I'd imagine things should be OK so long as the build is after win10 1903. Win10 22H2 is 10.0.19045.0 if you wanted to specify something more current!2 points -
App Control Tray & Policy Manager (App Control for Business)
pixelsearch and one other reacted to WildByDesign for a topic
Thank you @pixelsearch and @argumentum for your recent help in getting me past my struggle with the ownerdrawn status bar. That was the last piece needed for my complete GUI rewrite and I was able to release version 6 this morning, compiled on GitHub Actions. If you have any desire to view the code or play with the compiled binaries (mainly AppControlPolicy.exe) to see how well the custom status bar functions in the running program, feel free. I am thankful and appreciative for your time and help. An interesting side effect: Everything got way faster, somehow. Rewriting the entire GUI somehow made everything a lot faster. Yay! The program does require Windows 11 though because App Control for Business (WDAC aka Windows Defender Application Control) requires Windows 11 and is on all SKUs. Link: Release App Control Tray and Policy Manager 6.0 · WildByDesign/WDACTrayTool By the way, the system tray tool component got a lot of improvements recently as well.2 points -
Resizable status bar without SBARS_SIZEGRIP
pixelsearch and one other reacted to WildByDesign for a topic
Please disregard my last comment about DPI scaling issues with your status bar. I made one minor measurement mistake and it was causing my ListView to partly cover the status bar under different DPI scaling settings. Your status bar is 100% perfect as it is under different DPI scaling settings. Further, my suggestion to add changing of the font was also a bad suggestion. The font in your status bar already scales the text size properly with DPI scaling. Changing the font, as I found out the hard way, actually caused the text of the status bar to no longer scale properly under different DPI settings. TL;DR: Everything is perfect. No changes required. Have a great weekend with the family!2 points -
Idk if this will make any difference, but when I registered the ocx I was inside the folder where it was located (instead of entering the full path). ps. i did not install the SDK. Just the .7z of Dany pps. you need to run it x86, it does not work x642 points
-
Resizable status bar without SBARS_SIZEGRIP
argumentum and one other reacted to pixelsearch for a topic
Now that it comes to changing fonts, DPI etc... I suggest you think twice : if argumentum script solves it in these situations, why not giving a complete try with his script based on labels to detect the eventual flaws ? It will be probably easier to manage with labels, if you need to work on fonts & DPI Just my 2 cts... Dinner in town with family in a few min, see you soon. Have a great week-end everybody2 points -
Microsoft Edge - WebView2, embed web code in your native application
argumentum and one other reacted to Gianni for a topic
You can start the OrdoWebView2 control in "incognito" mode by setting the .IsPrivateNavigation parameter to True in the InitEx method, as described in the OrdoWebView2.ocx control help (https://freeware.ordoconcept.net/Help/OrdoWebView2/topics/InitEx.htm). This way the user data folder should be automatically and silently created in a temporary location and is not stored permanently, but only exists during the session and is deleted when it ends. P.S. In order not to hijack this topic too much, I created a new Topic specifically related to the OrdoWebView2.ocx control2 points -
Resizable status bar without SBARS_SIZEGRIP
WildByDesign and one other reacted to pixelsearch for a topic
imho there's something wrong in the function _GUICtrlStatusBar_SetParts found in the include file GuiStatusBar.au3 Gary Frost forces the last part of the status bar to have a value of -1, even if the user explicitely indicates another value, for example : User in script... Local $aParts[3] = [75, 150, 230] ...becomes in UDF Local $aParts[3] = [75, 150, -1] Here are the results below : The picture on the right is what the user wants (better display of the last Part 2) and not what the UDF forces us to display. msdn never wrote that the last parameter must be -1, here is what we can read on msdn's site : If an element is -1, the right edge of the corresponding part extends to the border of the window. It's written "IF", not "it must be -1 and you have to use all the window width for your status bar" For what it's worth...2 points -
Resizable status bar without SBARS_SIZEGRIP
WildByDesign and one other reacted to pixelsearch for a topic
A new functionality has been added to my 2nd script (found on previous page) Now all parts of the status bar got a flexible width during resizing : On the left side of the image above, the status bar parts show (on purpose) too long texts... which won't be a problem after we resize the GUI You'll notice 2 GUI's on the right side of the image above : 1) One got a visible border around the status bar parts 2) The 2nd one doesn't have borders : just pick the line of code you prefer in the script : _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW) ; _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW + $SBT_NOBORDERS) ; interesting ? Also, I added this test... If _GUICtrlStatusBar_IsSimple($g_hStatus) Then _GUICtrlStatusBar_Resize($g_hStatus) Else ... EndIf ...because maybe someone will use the script with a simple status bar ("simple" = no parts) just for the color change. Without the test, a normal fatal error would happen. The test on a simple status bar has been done, it seems correct, fingers crossed2 points -
Resizable status bar without SBARS_SIZEGRIP
ioa747 and one other reacted to pixelsearch for a topic
With @KaFu's help in his post, adapted to our script : #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WinAPIGdi.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $g_hGui, $g_hSizebox, $g_hOldProc, $g_hBrush, $g_hStatus, $g_iHeight, $g_aText, $g_aRatioW, $g_iBkColor, $g_iTextColor Example() ;============================================== Func Example() Local Const $SBS_SIZEBOX = 0x08, $SBS_SIZEGRIP = 0x10 Local $iW = 300, $iH = 100 Dim $g_iBkColor = 0x808080, $g_iTextColor = 0xFFFFFF $g_hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor($g_iBkColor) ;----------------- ; Create a sizebox window (Scrollbar class) BEFORE creating the StatusBar control $g_hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 0, 0, 0, 0, $g_hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP ; Subclass the sizebox (by changing the window procedure associated with the Scrollbar class) Local $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam') $g_hOldProc = _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc)) Local $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZENWSE) _WinAPI_SetClassLongEx($g_hSizebox, -12, $hCursor) ; $GCL_HCURSOR = -12 $g_hBrush = _WinAPI_CreateSolidBrush($g_iBkColor) ;----------------- $g_hStatus = _GUICtrlStatusBar_Create($g_hGui, -1, "", $WS_CLIPSIBLINGS) ; ClipSiblings style +++ Local $aParts[3] = [90, 180, -1] _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) Dim $g_aText[Ubound($aParts)] = ["Part 0", "Part 1", "Part 2"] Dim $g_aRatioW[Ubound($aParts)] For $i = 0 To UBound($g_aText) - 1 _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW) ; _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW + $SBT_NOBORDERS) ; interesting ? $g_aRatioW[$i] = $aParts[$i] / $iW Next Local $idChangeText = GUICtrlCreateButton("Change Text", 110, 25, 80, 30), $iInc GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) ; to allow the setting of StatusBar BkColor at least under Windows 10 _WinAPI_SetWindowTheme($g_hStatus, "", "") ; Set status bar background color _GUICtrlStatusBar_SetBkColor($g_hStatus, $g_iBkColor) $g_iHeight = _GUICtrlStatusBar_GetHeight($g_hStatus) + 3 ; change the constant (+3) if necessary GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idChangeText $iInc += 1 For $i = 0 To UBound($g_aText) - 1 $g_aText[$i] = "Part " & $i & " : Inc " & $iInc Next _WinAPI_RedrawWindow($g_hStatus) EndSwitch WEnd _GUICtrlStatusBar_Destroy($g_hStatus) _WinAPI_DeleteObject($g_hBrush) _WinAPI_DestroyCursor($hCursor) _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, $g_hOldProc) DllCallbackFree($hProc) GUIDelete($g_hGui) EndFunc ;==>Example ;============================================== Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) ; Andreik If $hWnd = $g_hSizebox Then Switch $iMsg Case $WM_ERASEBKGND Local $tRect = _WinAPI_GetClientRect($hWnd) _WinAPI_FillRect($wParam, $tRect, $g_hBrush) Return True Case $WM_PAINT Local $tPAINTSTRUCT Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) Local $tRect = _WinAPI_CreateRect($tPAINTSTRUCT.Left, $tPAINTSTRUCT.Top, $tPAINTSTRUCT.Right, $tPAINTSTRUCT.Bottom) _WinAPI_FillRect($hDC, $tRect, $g_hBrush) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndSwitch EndIf Return _WinAPI_CallWindowProc($g_hOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ScrollbarProc ;============================================== Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; Pixelsearch #forceref $iMsg, $wParam, $lParam If $hWnd = $g_hGUI Then Local $aSize = WinGetClientSize($g_hGui) If _GUICtrlStatusBar_IsSimple($g_hStatus) Then _GUICtrlStatusBar_Resize($g_hStatus) Else Local $aGetParts = _GUICtrlStatusBar_GetParts($g_hStatus) Local $aParts[$aGetParts[0]] For $i = 0 To $aGetParts[0] - 2 $aParts[$i] = Int($aSize[0] * $g_aRatioW[$i]) Next $aParts[$aGetParts[0] - 1] = -1 _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) EndIf WinMove($g_hSizebox, "", $aSize[0] - $g_iHeight, $aSize[1] - $g_iHeight, $g_iHeight, $g_iHeight) _WinAPI_ShowWindow($g_hSizebox, (BitAND(WinGetState($g_hGui), $WIN_STATE_MAXIMIZED) ? @SW_HIDE : @SW_SHOW)) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE ;============================================== Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) ; Kafu #forceref $hWnd, $iMsg, $wParam Local $tDRAWITEMSTRUCT = DllStructCreate("uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;HWND hwndItem;HANDLE hDC;long rcItem[4];ULONG_PTR itemData", $lParam) If $tDRAWITEMSTRUCT.hwndItem <> $g_hStatus Then Return $GUI_RUNDEFMSG ; only process the statusbar Local $itemID = $tDRAWITEMSTRUCT.itemID ; status bar part number (0, 1, ...) Local $hDC = $tDRAWITEMSTRUCT.hDC Local $tRect = DllStructCreate("long left;long top;long right; long bottom", DllStructGetPtr($tDRAWITEMSTRUCT, "rcItem")) Local $iTop = $tRect.top, $iLeft = $tRect.left Local $hBrush = _WinAPI_CreateSolidBrush($g_iBkColor) ; backgound color _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush) _WinAPI_SetTextColor($hDC, $g_iTextColor) ; text color _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $iTop + 1) DllStructSetData($tRect, "left", $iLeft + 1) _WinAPI_DrawText($hDC, $g_aText[$itemID], $tRect, $DT_LEFT) _WinAPI_DeleteObject($hBrush) $tDRAWITEMSTRUCT = 0 Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM2 points -
Got bored today, while working on my au3unit project, and made this class-ish solution with functions, variables and maps. Maybe someone will use it 😜 Features: public class properties public static class properties public methods public static methods class Inheritance Repository: https://github.com/genius257/au3-functional-class ZIP download: https://github.com/genius257/au3-functional-class/archive/8503c876f65cb0cf339a324d0483d588a63eb4df.zip Online example file: https://github.com/genius257/au3-functional-class/blob/8503c876f65cb0cf339a324d0483d588a63eb4df/example.au3 Enjoy 😀2 points
-
Media Foundation - Media Engine.
CYCho and one other reacted to argumentum for a topic
$sSource = FileOpenDialog("Open Media", @ScriptDir & "\", "Video Files (*.mp4;*.m4v;*.mpg;*.wmv;*.mov;*.mkv)" & _ "|Audio Files (*.mp3;*.aac;*.m4a;*.wma)|Good luck (*.*)", $FD_FILEMUSTEXIST) If Not FileExists($sSource) Then ContinueLoop2 points -
App Control Tray & Policy Manager (App Control for Business)
ioa747 and one other reacted to WildByDesign for a topic
So I just had my very first “Aha!” moment is my AutoIt journey and it proved to be extremely beneficial. Beginner Level 2 unlocked! 😄 App Control Policy Manager was my first AutoIt GUI app. The underlying functionality and logic is extremely powerful and I am proud of that. However, the UI/UX is not its strong point. Problems: too many buttons and controls visible harder for me to resize and DPI scaling Goals: ensure policy ListView is main focal point as it should be move all button functions into menu bar move info from status label into status bar This would make sure that the policy ListView is the star of the show and with less distractions. It would also make it so much easier to deal with resizing and DPI scaling changes. Challenges: dark mode menu bar (success) dark mode status bar There was absolutely no way I was going to do this GUI transformation if I could not achieve a dark mode menu bar. Last night and this morning I was able to achieve a fully dark mode, beautiful menu bar. It was quick and easy to add my already existing functions to the menu items and everything is working. I am going to try to tackle the dark mode status bar later today. I am posting from my phone right now so I can’t share a current screenshot or code at the moment but I will later in the day.2 points -
Microsoft Edge - WebView2, embed web code in your native application
SOLVE-SMART and one other reacted to Danyfirex for a topic
@ptrex here you have. OrdoWebView.7z Saludos2 points -
Please help with Run PowerShell Command 'quotes"
SOLVE-SMART and one other reacted to AspirinJunkie for a topic
Exactly - it is not escaping for Powershell code. But we're not at that level yet (as I said before: escaping with such nested interpreters is quite annoying...) Escaping per \" is not intended for powershell.exe but for the Windows API function CreateProcessA/W (which is the basis for the AutoIt function Run()). This function must ensure that the parameters are passed correctly to powershell.exe and the syntax is such that double quotation marks are escaped via \". A little clearer with the example: If you execute the following via Run (or from the command line): powershell.exe -Command "Write-Host \"This is a \"\"short\"\" test with multiple \"\"quotes\"\".\"" Then powershell.exe receives the following code as a parameter: Write-Host "This is a ""short"" test with multiple ""quotes""." And your double quotation marks for the powershell are correct again! This is exactly what the _prc_runPS() function does here.2 points -
Good find. I was trying to use one of my IPC to connect both running processes. Even with the MsgBox I am having a hard time to send messages to rendering process. However the Main process can receive quite nicely messages from the rendering process. Along the way I made a small UDF to create interface object, based on our discussion and from a post I saw from trancexx. I also included it in the script. I'll let you decide what you want to do with this version 2 of the engine. MediaEngine.zip2 points
-
Round buttons
pixelsearch and one other reacted to ioa747 for a topic
collection of round buttons ; https://www.autoitscript.com/forum/topic/211721-round-buttons/ ;---------------------------------------------------------------------------------------- ; Title...........: RoundButtons.au3 ; Description.....: collection of round buttons ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $MyGui, $aBtn[7][2] Example() Func Example() $MyGui = GUICreate(" My GUI Icons", 300, 500) $aBtn[0][0] = 6 ; cnt of buttons $aBtn[1][1] = "red" $aBtn[1][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[1][1] & "_normal.ico", 0, 20, 20, 64, 64, $SS_NOTIFY) $aBtn[2][1] = "yellow" $aBtn[2][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[2][1] & "_normal.ico", 0, 20, 100, 64, 64, $SS_NOTIFY) $aBtn[3][1] = "green" $aBtn[3][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[3][1] & "_normal.ico", 0, 20, 180, 64, 64, $SS_NOTIFY) $aBtn[4][1] = "turquoise" $aBtn[4][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[4][1] & "_normal.ico", 0, 20, 260, 64, 64, $SS_NOTIFY) $aBtn[5][1] = "cyan" $aBtn[5][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[5][1] & "_normal.ico", 0, 20, 340, 64, 64, $SS_NOTIFY) $aBtn[6][1] = "magenta" $aBtn[6][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[6][1] & "_normal.ico", 0, 20, 420, 64, 64, $SS_NOTIFY) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $aBtn[1][0] ConsoleWrite($aBtn[1][1] & @CRLF) Case $aBtn[2][0] ConsoleWrite($aBtn[2][1] & @CRLF) Case $aBtn[3][0] ConsoleWrite($aBtn[3][1] & @CRLF) Case $aBtn[4][0] ConsoleWrite($aBtn[4][1] & @CRLF) Case $aBtn[5][0] ConsoleWrite($aBtn[5][1] & @CRLF) Case $aBtn[6][0] ConsoleWrite($aBtn[6][1] & @CRLF) EndSwitch _IsOver() WEnd GUIDelete() EndFunc ;==>Example Func _IsOver() Local Static $iActive, $iClicked = 0 Local $aActive = GUIGetCursorInfo($MyGui) If $aActive[2] And $iClicked = 1 Then Return If $iActive <> $aActive[4] Then $iActive = $aActive[4] For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $aActive[4] Then GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_hover.ico") Else GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_normal.ico") EndIf Next EndIf If $aActive[2] Or $iClicked = 1 Then For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $aActive[4] Then If $iClicked = 0 Then GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_click.ico") $iClicked = 1 Else GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_hover.ico") $iClicked = 0 EndIf EndIf Next EndIf EndFunc ;==>_IsOver Extract buttons folder in @ScriptDir Buttons.zip Please, every comment is appreciated! leave your comments and experiences here! Thank you very much2 points -
Melque_Lima, There is a very useful search function at top-right of the page. A quick search found several solutions. M232 points