Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 10/08/2025 in Posts

  1. V1.0.0 released! 🎊 Event on toast interaction now works! 🎉
    6 points
  2. Hello! I'm working on a new GUI builder that I have been making great progress on! A helpful forum member ioa747 answered a question I had which started me on my journey, and now I'd like to present to you an alpha version of the software. As of now only Form and Button works in a rudimentary fashion. To run this, open Guiscape.au3 and go from there! I'd love to hear your feedback and suggestions. 🙂 Latest versions will be on Github from now on. https://github.com/matthewrg/Guiscape Guiscape.zip Downloads: 35
    5 points
  3. Added File path validation to prevent path traversal attacks Parameter safety warnings for autoit.consoleParams to detect potentially dangerous shell metacharacters Workspace symbol performance optimizations with batch processing to prevent UI freezing on large projects Configuration options autoit.workspaceSymbolMaxFiles (default: 500) and autoit.workspaceSymbolBatchSize (default: 10) Configuration option autoit.symbolMaxLines (default: 50000) to control maximum lines processed for symbol information Warning message when files exceed symbol processing limit with actionable instructions Comprehensive unit tests for completion provider with 8 test cases Comprehensive README documentation improvements with installation guide, quick start section, platform support matrix, troubleshooting guide, and reorganized configuration Distribution scripts for packaging the extension to multiple marketplaces: package-all.js for simultaneous packaging to VS Code Marketplace and OpenVSX package-openvsx.js for OpenVSX-specific packaging with publisher name handling Fixed Command injection risk in registry update functionality by replacing exec with execFile for safer argument handling Multiple global output panels opening for AutoIt on startup Memory leak in completion provider where include cache grew indefinitely across document switches Incorrect array comparison logic in completion cache invalidation Cross-document contamination of completion items from include files Changed Simplified ESLint configuration by using globals package and removing redundant rules Workspace symbol cache now uses incremental updates instead of full invalidation on file changes Completion provider now uses per-document Map-based caching with LRU eviction (50 document limit) Include cache automatically cleans up when documents are closed Symbol processing limit increased from hardcoded 10,000 to configurable 50,000 lines by default Removed The unused autoit.YAML-tmLanguage file Rate and View on VS Code Marketplace Star & Submit Issues on GitHub
    5 points
  4. This example script is a desktop live wallpaper program. It is a combination of MediaPlayerElement - WinRT Xaml Island by @MattyD and Move window behind desktop icons by @Parsix. It basically creates a GUI layer under the desktop icons but above the wallpaper (eg. in a WorkerW window within Program Manager). Features: Configuration file (LiveWallpaper.ini) Plays .mp4 videos and likely many more formats Light on CPU (uses GPU for video processing) Play/Pause video by double-click (can change to single-click in config) Option to Loop video Transparency level (to blend video with your real wallpaper) Start button trigger to play media Multi-monitor support Important Note: To run this, the XAML Islands require the following value in the AutoIt binary manifest: <maxversiontested Id="10.0.18362.1"/> There are two options. The first is ExternalManifest.au3 which essentially drops an external manifest file that includes that value beside your existing AutoIt binaries (eg. AutoIt3.exe.manifest and AutoIt3_x64.exe.manifest). This will allow you to run LiveWallpaper.au3 in your file manager by double-clicking on the script. However, the downside to this method is that it will not work through VSCode or SciTE and therefore you cannot get any ConsoleWrite info if you need it. The second option is Update Manifest.au3 which patches your actual AutoIt binary to include the required maxversiontested value. It makes a backup of your original AutoIt binary and you have to copy the modified one over your original. This is the better method if you want to extend the LiveWallpaper code, run through VSCode or SciTE and add/get console output. If you intend to compile as a binary, that compiled binary needs the maxversiontested value. You need to set the "win10" compatibility flag with AutoIt3Wrapper (already at top of LiveWallpaper.au3) and you need to be using the absolute latest beta version of AutoIt3Wrapper.au3 because the maxversiontested value has been added to it. To Do (possibilities): Option for volume level Option for playback rate Hotkeys etc. Live Wallpaper Videos: I have only tested a bunch of .mp4 videos with this, including 4K. I have included bloom.mp4 which is rather low quality, but I wanted something that people can test with and it's small enough for attachment space. But there are many, many live wallpaper web sites out there. Some videos look good on loop (like a fireplace), while others don't. I'm sure lots of other video formats work. But I have only tested .mp4 and that is the format that most video wallpaper sites use. LiveWallpaper.7z
    4 points
  5. I've done enough editing of image files to know a few things. If you are going to have % of transparency you should have a small input section from 0 - 255 as exacting levels of transparency. Most people cannot tell the difference of 1% to about 5% level of transparency, but some might want the option to have exacting levels for better control. Don't presume that about me. I don't like to lie as much as stretching the truth so far that is snaps back on me like a rubber band that has broke from the stress.
    4 points
  6. Nine

    GIF Animation (cached)

    After giving it some thoughts, I went with a callback function to modify any aspect of the GIF frame by frame. You need to provide a valid callback function receiving a GDI+ image handle (originating from the GIF) and returning a modified GDI+ handle to fit the size of the GIF control creation. A few tests showed me that the callback function seems to be the fastest approach. Added a basic example showing how to use the callback. New version available
    4 points
  7. Hi @genius257 Your input data reader works great! I added several inputs and buttons for a quick, rough test, and the values entered into the "toast" are returned to the callback and parsed correctly by your function. It appears that a notification toast doesn't allow more than 5 inputs; each selector input can't contain more than 5 options, and buttons can't exceed 5. Text inputs allow about 2,000 characters. But these limitations are due to the inherent features of Microsoft notification toasts, not your code. ... these toasts are funny... Bye and thanks again! cheers #include "./src/toast.au3" #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <InetConstants.au3> #include <WinApiReg.au3> #include <WinApiIcons.au3> #include <GDIPlus.au3> #include <WinAPIConv.au3> If Not FileExists(@TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Then _GDIPlus_Startup() $thIcons = DllStructCreate("HWND") $x = _WinAPI_ExtractIconEx(@AutoItExe, 0, 0, $thIcons, 1) ConsoleWrite($x & @CRLF) $hBitmap = _GDIPlus_BitmapCreateFromHICON(DllStructGetData($thIcons, 1)) _GDIPlus_ImageSaveToFileEx($hBitmap, @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png", _GDIPlus_EncodersGetCLSID("PNG")) _GDIPlus_BitmapDispose($hBitmap) ConsoleWrite(@error & @CRLF) _GDIPlus_Shutdown() _WinAPI_DestroyIcon(DllStructGetData($thIcons, 1)) EndIf Global Const $sAppName = @ScriptName Global $tCLSID = _Toast_CoCreateGuid() Global $sGUID = _WinAPI_StringFromGUID($tCLSID) ConsoleWrite("app CLSID: " & $sGUID & @CRLF) _Toast_Initialize($sAppName, $tCLSID, OnToastActivation, "AutoIt Toast Example", @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Opt("GuiOnEventMode", 1) Global $hWnd = GUICreate("Toast example", 700, 320) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE") Global $hButton01 = GUICtrlCreateButton("From template", 10, 10, 200, 120) GUICtrlSetOnEvent(-1, "ToastFromTemplateExample") Global $hButton02 = GUICtrlCreateButton("From XML string", 10, 140, 200, 120) GUICtrlSetOnEvent(-1, "ToastFromXmlString") Global $hRich = _GUICtrlRichEdit_Create($hWnd, "", 220, 10, 470, 300) GUISetState() While 1 Sleep(10) WEnd Func ToastFromTemplateExample() Local $oXml = _Toast_CreateToastTemplateXmlDocument() Local $pToast = _Toast_CreateToastNotificationFromXmlObject($oXml) _Toast_Show($pToast) EndFunc ;==>ToastFromTemplateExample Func DownloadImage() If FileExists(@TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg") Then Return _GUICtrlRichEdit_AppendText($hRich, "Trying to download avatar image from gravatar..." & @CRLF) Local $iBytes = InetGet("https://gravatar.com/avatar/e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778", @TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg", $INET_FORCEBYPASS) Local $error = @error If @error <> 0 Then _GUICtrlRichEdit_AppendText($hRich, "Failed to download image" & @CRLF) Return EndIf _GUICtrlRichEdit_AppendText($hRich, "Done! " & $iBytes & " bytes downloaded" & @CRLF) EndFunc ;==>DownloadImage Func ToastFromXmlString() DownloadImage() ; https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml Local $sToast = "" $sToast &= "<toast activationType=""foreground"" launch=""action=viewAlarm&amp;alarmId=3"" scenario=""alarm"">" ; action=mainContent;alarmId=3 $sToast &= "" $sToast &= " <visual>" $sToast &= " <binding template=""ToastGeneric"">" $sToast &= " <text>Time to wake up!</text>" $sToast &= " <text>To prove you're awake, select which of the following fruits is yellow...</text>" $sToast &= ' <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>' $sToast &= " </binding>" $sToast &= " </visual>" $sToast &= "" $sToast &= " <actions>" $sToast &= "<!-- #1 First input-->" $sToast &= " <input id=""Options"" type=""selection"" defaultInput=""Selection1"">" $sToast &= " <selection id=""Selection1"" content=""Option 1/5""/>" $sToast &= " <selection id=""Selection2"" content=""Option 2/5""/>" $sToast &= " <selection id=""Selection3"" content=""Option 3/5""/>" $sToast &= " <selection id=""Selection4"" content=""Option 4/5""/>" $sToast &= " <selection id=""Selection5"" content=""Option 5/5""/>" ; $sToast &= " <selection id=""Selection6"" content=""Option 6/6""/>" ; No more than 5 options allowed $sToast &= " </input>" $sToast &= "<!-- #2 Second input-->" $sToast &= " <input id=""Poem"" type=""text"" placeHolderContent=""Please write a poem"" />" $sToast &= "<!-- #3 Third input-->" $sToast &= " <input id=""Season"" type=""selection"" defaultInput=""Autumn"">" $sToast &= " <selection id=""Spring"" content=""Spring""/>" $sToast &= " <selection id=""Summer"" content=""Summer""/>" $sToast &= " <selection id=""Autumn"" content=""Autumn""/>" $sToast &= " <selection id=""Winter"" content=""Winter""/>" $sToast &= " </input>" $sToast &= "<!-- #4 Fourth input-->" $sToast &= " <input id=""Mood"" type=""selection"" defaultInput=""Love"">" $sToast &= " <selection id=""Happy"" content=""I'm Happy 😀""/>" $sToast &= " <selection id=""Sad"" content=""I'm Sad 😢""/>" $sToast &= " <selection id=""Love"" content=""I'm in love ❤️""/>" $sToast &= " <selection id=""Angry"" content=""I'm mad at the whole world 🖕""/>" $sToast &= " </input>" $sToast &= "<!-- #5 Fifth input-->" $sToast &= " <input id=""Gender"" type=""selection"" defaultInput=""Female"">" $sToast &= " <selection id=""Male"" content=""I'm a man""/>" $sToast &= " <selection id=""Female"" content=""I'm a woman""/>" $sToast &= " </input>" #cs ; --- No more than 5 inputs allowed and no more than 5 entry --- $sToast &= "<!-- #6 Sixth input-->" $sToast &= " <input id=""WeekDay"" type=""selection"" defaultInput=""Wednesday"">" $sToast &= " <selection id=""Monday"" content=""Monday""/>" $sToast &= " <selection id=""Tuesday"" content=""5 Sincronizza contatti""/>" $sToast &= " <selection id=""Wednesday"" content=""Wednesday""/>" $sToast &= " <selection id=""Thursday"" content=""Thursday""/>" $sToast &= " <selection id=""Friday"" content=""Friday""/>" $sToast &= " <selection id=""Saturday"" content=""Saturday""/>" $sToast &= " <selection id=""Sunday"" content=""Sunday""/>" $sToast &= " </input>" #ce ; --- No more than 5 inputs allowed and no more than 5 entry --- $sToast &= "" $sToast &= " <!-- Button 1 -->" $sToast &= " <action content=""Yes, I agree""" $sToast &= " arguments=""action=Agree""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 2 -->" $sToast &= " <action content=""No, I disagree""" $sToast &= " arguments=""action=Disagree""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 3 -->" $sToast &= " <action content=""Save data""" $sToast &= " arguments=""action=Save""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 4 -->" $sToast &= " <action content=""Open settings""" $sToast &= " arguments=""action=Open""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 5 -->" $sToast &= " <action content=""Dismiss""" $sToast &= " arguments=""action=Dismiss""" $sToast &= " activationType=""background""/>" #cs ; --- No more than 5 buttons allowed --- $sToast &= " <!-- Button 6 -->" $sToast &= " <action content=""Snooze""" $sToast &= " arguments=""action=Snooze""" $sToast &= " activationType=""background""/>" #ce ; --- No more than 5 buttons allowed --- $sToast &= " </actions>" $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>' $sToast &= "</toast>" ;#ce Local $pToast = _Toast_CreateToastNotificationFromXmlString($sToast) If @error <> 0 Then _GUICtrlRichEdit_AppendText($hRich, _WinAPI_GetErrorMessage(@error)) Return EndIf _Toast_Show($pToast) _GUICtrlRichEdit_AppendText($hRich, $pToast & @TAB & "VarGetType: " & VarGetType($pToast) & @CRLF) EndFunc ;==>ToastFromXmlString ; https://learn.microsoft.com/en-us/windows/win32/api/notificationactivationcallback/nf-notificationactivationcallback-inotificationactivationcallback-activate Func OnToastActivation($pSelf, $appUserModelId, $invokedArgs, $data, $count) _GUICtrlRichEdit_AppendText($hRich, _ "Toast activated!" & @CRLF _ & " " & "appUserModelId: " & $appUserModelId & @TAB & "VarGetType: " & VarGetType($appUserModelId) & @CRLF _ & " " & "invokedArgs: " & $invokedArgs & @TAB & "VarGetType: " & VarGetType($invokedArgs) & @CRLF _ & " " & "$data: " & $data & @TAB & "VarGetType: " & VarGetType($data) & @TAB & DllStructGetData($data, 1) & @CRLF _ ; ??? also _WinAPI_GetString ... no good as well & " " & "$count: " & $count & @TAB & "VarGetType: " & VarGetType($count) & @CRLF _ ) _GUICtrlRichEdit_AppendText($hRich, @CRLF & "-----------------------------" & @CRLF) Local $pData = $data For $i = 1 To $count $tData = DllStructCreate('PTR Key;PTR Value;', $pData) $key = _WinAPI_GetString($tData.Key) $value = _WinAPI_GetString($tData.Value) ; ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value)) _GUICtrlRichEdit_AppendText($hRich, StringFormat('"%s"="%s"\n', $key, $value)) $pData += DllStructGetSize($tData) Next Return $_Toast_S_OK EndFunc ;==>OnToastActivation Func GUI_CLOSE() Exit EndFunc ;==>GUI_CLOSE
    4 points
  8. Hi @Gianni, Thanks you, glad to see the interest in the code Yes, the $data variable contains a pointer to a array of NOTIFICATION_USER_INPUT_DATA elements. The length of the array is given via the $count variable. Something like this should do it: $pData = $data For $i = 1 To $count $tData = DllStructCreate('PTR Key;PTR Value;', $pData) $key = _WinAPI_GetString($tData.Key) $value = _WinAPI_GetString($tData.Value) ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value)) $pData += DllStructGetSize($tData) Next I think I'll update the example with inputs to demonstrate later, and I'll also add a helper function to convert the data array into a Map
    4 points
  9. A bit more progress with this subclassing stuff.. Multiselect with shift key down, and some very rough alignment code. ;~ #AutoIt3Wrapper_UseX64=N ;TODO: snap always rounds down, so you can't drag all the way right/bottom if you run out of window. ;Need to change the tipping point to 1/2 way between points. #include <WindowsSysColorConstants.au3> #include <guiConstants.au3> #include <winapi.au3> #include <guiButton.au3> #include <guiEdit.au3> #include <WinAPIvkeysConstants.au3> #include <BorderConstants.au3> Global Const $tagMINMAXINFO = "long Reserved[2]; long MaxSize[2]; long MaxPosition[2]; long MinTrackSize[2]; long MaxTrackSize[2]" Global Const $MK_LBUTTON = 0x0001 Global Const $MK_RBUTTON = 0x0002 Global Const $MK_SHIFT = 0x0004 Global Const $MK_CONTROL = 0x0008 Global Const $MK_MBUTTON = 0x0010 Global Const $MK_XBUTTON1 = 0x0020 Global Const $MK_XBUTTON2 = 0x0040 Global $iSnap = 15, $iMinCtrlW = 15, $iMinCtrlH = 15 Global $mh_SelCtrls[] Global $hCursor_Cross = _WinAPI_LoadCursor(0, $IDC_CROSS) Global $hGui = GUICreate("", 300, 200, 100, 100, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX)) GUISetState() Global $hGui2 = GUICreate("", 200, 300, 450, 100) Global $idAlignTop = GUICtrlCreateButton("Align Top", 100, 10, 80, 25) Global $idButton = GUICtrlCreateRadio("Button", 10, 10, 80, 25) GUICtrlSetState(-1, $GUI_CHECKED) Global $idCheck = GUICtrlCreateRadio("Checkbox", 10, 40, 80, 25) Global $idRadio = GUICtrlCreateRadio("Radio", 10, 70, 80, 25) Global $idEdit = GUICtrlCreateRadio("Edit", 10, 100, 80, 25) Global $idInput = GUICtrlCreateRadio("Input", 10, 130, 80, 25) ;~ Global $idList = GUICtrlCreateRadio("List", 10, 160, 80, 25) Global $hCtrlProc = DllCallbackRegister("CtrlProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Global $pCtrlProc = DllCallbackGetPtr($hCtrlProc) Global $hWndProc = DllCallbackRegister("WndProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Global $pWndProc = DllCallbackGetPtr($hWndProc) _WinAPI_SetWindowSubclass($hGui, $pWndProc, 1000) GUISetState() Local $iMsg, $aKeys, $tWinPos, $tParPos, $iTop While WinExists($hGui) $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $idAlignTop $tParPos = _WinAPI_GetClientRect($hGui) $iTop = $tParPos.Bottom $aKeys = MapKeys($mh_SelCtrls) For $hWnd In $aKeys If $mh_SelCtrls[$hWnd] Then $tWinPos = _WinAPI_GetWindowRect($hWnd) _WinAPI_ScreenToClient($hGUI, $tWinPos) If $tWinPos.Top < $iTop Then $iTop = $tWinPos.Top EndIf Next For $hWnd In $aKeys If $mh_SelCtrls[$hWnd] Then $tWinPos = _WinAPI_GetWindowRect($hWnd) _WinAPI_ScreenToClient($hGUI, $tWinPos) _WinAPI_ScreenToClient($hGUI, DllStructGetPtr($tWinPos, 3)) _WinAPI_MoveWindow($hWnd, $tWinPos.Left, $iTop, $tWinPos.Right - $tWinPos.Left, $tWinPos.Bottom - $tWinPos.Top) EndIf Next EndSwitch WEnd _WinAPI_RemoveWindowSubclass($hGui, $pWndProc, 1000) Func WndProc($hWnd, $iMsg, $wParam, $lParam, $iIdSubclass, $dwRefData) #forceref $hWnd, $iMsg, $wParam, $lParam, $iIdSubclass, $dwRefData Local $iRet Local Static $bDrawRect, $tPaintRect = DllStructCreate($tagRect) Switch $iMsg Case $WM_SETCURSOR Local $iSrc = _WinAPI_LoWord($lParam);, $iEvent = _WinAPI_HiWord($lParam) If $iSrc = $HTCLIENT Then _WinAPI_SetCursor($hCursor_Cross) $iRet = 1 Else $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndIf Case $WM_LBUTTONDOWN Local $tPoint = _WinAPI_MakePoints($lParam) $tPaintRect.Left = $tPoint.X $tPaintRect.Top = $tPoint.Y $tPaintRect.Left -= Mod($tPaintRect.Left, $iSnap) $tPaintRect.Top -= Mod($tPaintRect.Top, $iSnap) $bDrawRect = True ;~ _WinAPI_TrackMouseEvent($hWnd, $TME_LEAVE) $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_MOUSEMOVE Local $tPoint = _WinAPI_MakePoints($lParam) If BitAND($wParam, $MK_LBUTTON) = $MK_LBUTTON Then _WinAPI_InvalidateRect($hWnd, $tPaintRect, True) $tPaintRect.Right = $tPoint.X $tPaintRect.Bottom = $tPoint.Y $tPaintRect.Right -= Mod($tPaintRect.Right, $iSnap) $tPaintRect.Bottom -= Mod($tPaintRect.Bottom, $iSnap) _WinAPI_InvalidateRect($hWnd, $tPaintRect, True) $iRet = 0 Else If $bDrawRect Then _WinAPI_InvalidateRect($hWnd, $tPaintRect, True) $bDrawRect = False $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndIf Case $WM_PAINT If $bDrawRect Then Local $tPaintStruct = $tagPAINTSTRUCT Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaintStruct) Local $hPen = _WinAPI_CreatePen($PS_DOT, 1, _WinAPI_RGB(0, 0, 0)) Local $hBrush = _WinAPI_GetStockObject($WHITE_BRUSH) _WinAPI_SelectObject($hDC, $hPen) _WinAPI_SelectObject($hDC, $hBrush) _WinAPI_Rectangle($hDC, $tPaintRect) _WinAPI_DeleteObject($hPen) _WinAPI_DeleteObject($hBrush) _WinAPI_EndPaint($hWnd, $tPaintStruct) $iRet = 0 Else $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndIf Case $WM_LBUTTONUP Local $tPoint = _WinAPI_MakePoints($lParam) If $bDrawRect Then $bDrawRect = False $tPaintRect.Right = $tPoint.X $tPaintRect.Bottom = $tPoint.Y $tPaintRect.Right -= Mod($tPaintRect.Right, $iSnap) $tPaintRect.Bottom -= Mod($tPaintRect.Bottom, $iSnap) _WinAPI_InvalidateRect($hWnd, $tPaintRect, True) If Abs($tPaintRect.Left - $tPaintRect.Right) >= $iMinCtrlW _ ;MinWidth & Height. And Abs($tPaintRect.Top - $tPaintRect.Bottom) >= $iMinCtrlH Then ;Yes, this can be done better - too lazy right now! Select Case GUICtrlRead($idButton) = $GUI_CHECKED ;Need border & clipsiblings to paint custom frame. using UDF for button to avoid any surprises in autoit's default btn proc Local $hCtrl = _GUICtrlButton_Create($hWnd, "", _ ($tPaintRect.Left < $tPaintRect.Right) ? $tPaintRect.Left : $tPaintRect.Right, _ ($tPaintRect.Top < $tPaintRect.Bottom) ? $tPaintRect.Top : $tPaintRect.Bottom, _ Abs($tPaintRect.Left - $tPaintRect.Right), _ Abs($tPaintRect.Top - $tPaintRect.Bottom), _ BitOR($BS_PUSHLIKE, $WS_BORDER, $WS_CLIPSIBLINGS)) _WinAPI_SetWindowSubclass($hCtrl, $pCtrlProc, _WinAPI_GetDlgCtrlID($hCtrl)) Case GUICtrlRead($idCheck) = $GUI_CHECKED Local $hCtrl = _GUICtrlButton_Create($hWnd, "Checkbox", _ ($tPaintRect.Left < $tPaintRect.Right) ? $tPaintRect.Left : $tPaintRect.Right, _ ($tPaintRect.Top < $tPaintRect.Bottom) ? $tPaintRect.Top : $tPaintRect.Bottom, _ Abs($tPaintRect.Left - $tPaintRect.Right), _ Abs($tPaintRect.Top - $tPaintRect.Bottom), _ BitOR($BS_AUTOCHECKBOX, $WS_BORDER, $WS_CLIPSIBLINGS)) _WinAPI_SetWindowSubclass($hCtrl, $pCtrlProc, _WinAPI_GetDlgCtrlID($hCtrl)) Case GUICtrlRead($idRadio) = $GUI_CHECKED Local $hCtrl = _GUICtrlButton_Create($hWnd, "Radio", _ ($tPaintRect.Left < $tPaintRect.Right) ? $tPaintRect.Left : $tPaintRect.Right, _ ($tPaintRect.Top < $tPaintRect.Bottom) ? $tPaintRect.Top : $tPaintRect.Bottom, _ Abs($tPaintRect.Left - $tPaintRect.Right), _ Abs($tPaintRect.Top - $tPaintRect.Bottom), _ BitOR($BS_AUTORADIOBUTTON, $WS_BORDER, $WS_CLIPSIBLINGS)) _WinAPI_SetWindowSubclass($hCtrl, $pCtrlProc, _WinAPI_GetDlgCtrlID($hCtrl)) Case GUICtrlRead($idEdit) = $GUI_CHECKED Local $hCtrl = _GUICtrlEdit_Create($hWnd, "", _ ($tPaintRect.Left < $tPaintRect.Right) ? $tPaintRect.Left : $tPaintRect.Right, _ ($tPaintRect.Top < $tPaintRect.Bottom) ? $tPaintRect.Top : $tPaintRect.Bottom, _ Abs($tPaintRect.Left - $tPaintRect.Right), _ Abs($tPaintRect.Top - $tPaintRect.Bottom), _ BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_BORDER, $WS_CLIPSIBLINGS)) _WinAPI_SetWindowSubclass($hCtrl, $pCtrlProc, _WinAPI_GetDlgCtrlID($hCtrl)) Case GUICtrlRead($idInput) = $GUI_CHECKED Local $hCtrl = _GUICtrlEdit_Create($hWnd, "", _ ($tPaintRect.Left < $tPaintRect.Right) ? $tPaintRect.Left : $tPaintRect.Right, _ ($tPaintRect.Top < $tPaintRect.Bottom) ? $tPaintRect.Top : $tPaintRect.Bottom, _ Abs($tPaintRect.Left - $tPaintRect.Right), _ Abs($tPaintRect.Top - $tPaintRect.Bottom), _ BitOR($ES_LEFT, $ES_AUTOHSCROLL, $WS_BORDER, $WS_CLIPSIBLINGS)) _WinAPI_SetWindowSubclass($hCtrl, $pCtrlProc, _WinAPI_GetDlgCtrlID($hCtrl)) EndSelect EndIf EndIf $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_SIZE ;This prevents autoit's docking logic from moving controls around on window restore. ;if we ony use the udf functions to create ctrls this is not needed. $iRet = _WinAPI_DefWindowProcW($hWnd, $iMsg, $wParam, $lParam) ;~ Case $WM_MOUSELEAVE ;TODO: trap mouse in window while left button is down. Case Else $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndSwitch Return $iRet EndFunc ;==>WndProc Func CtrlProc($hWnd, $iMsg, $wParam, $lParam, $iIdSubclass, $dwRefData) Local $iRet Local Static $hHasFocus Switch $iMsg Case $WM_GETMINMAXINFO, $WM_SIZING, $WM_MOVING, $WM_SIZE, $WM_MOVE, $WM_EXITSIZEMOVE $iRet = _Ctrl_MoveSizeCtrlProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_NCHITTEST $iRet = _Ctrl_MoveSizeCtrlProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_SETCURSOR $iRet = _Ctrl_MoveSizeCtrlProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_MOUSEACTIVATE ;"Selected" control logic. If Not BitAND(0x8000, _WinAPI_GetAsyncKeyState($VK_SHIFT)) Then Local $aKeys = MapKeys($mh_SelCtrls) For $i = 0 To UBound($aKeys) - 1 If $aKeys[$i] Then $mh_SelCtrls[$aKeys[$i]] = False _WinAPI_RedrawWindow($aKeys[$i], 0, 0, BitOR($RDW_FRAME, $RDW_INVALIDATE)) EndIf Next $mh_SelCtrls[$hWnd] = True Else $mh_SelCtrls[$hWnd] = MapExists($mh_SelCtrls, $hWnd) ? Not $mh_SelCtrls[$hWnd] : True EndIf ;NCL_LBUTTONDOWN doesn't retrigger if ctrl already has focus. If _WinAPI_GetFocus() = $hWnd Then _WinAPI_RedrawWindow($hWnd, 0, 0, BitOR($RDW_FRAME, $RDW_INVALIDATE)) $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_NCLBUTTONDOWN $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) If $mh_SelCtrls[$hWnd] Then _WinAPI_SetFocus($hWnd) Case $WM_SETFOCUS $hHasFocus = $hWnd _SendMessage($wParam, $WM_KILLFOCUS, $hWnd) $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hWnd, 0, 0, BitOR($RDW_FRAME, $RDW_INVALIDATE)) Case $WM_KILLFOCUS _WinAPI_RedrawWindow($hWnd, 0, 0, BitOR($RDW_FRAME, $RDW_INVALIDATE)) $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_NCLBUTTONDBLCLK ;Prevent double-click maximizing in "caption" - also now set caption. If $wParam = $HTCAPTION Then ;Set text If Not BitAND(0x8000, _WinAPI_GetAsyncKeyState($VK_SHIFT)) Then Local $iCaptionLen = _SendMessage($hWnd, $WM_GETTEXTLENGTH) Local $tCaption = DllStructCreate(StringFormat("wchar text[%d]", $iCaptionLen + 1)) _SendMessage($hWnd, $WM_GETTEXT, DllStructGetSize($tCaption), $tCaption, 0, "wparam", "struct*") Local $sCaption = InputBox("Edit Caption", " ", $tCaption.Text, "", 150, 60, BitAND($lParam, 0xFFFF), BitShift($lParam, 16)) If Not @error Then _SendMessage($hWnd, $WM_SETTEXT, 0, $sCaption, 0, "wparam", "wstr") EndIf Else $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndIf Case $WM_NCPAINT _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Local $hDC = _WinAPI_GetWindowDC($hWnd) Local $tRect = _WinAPI_GetWindowRect($hWnd) $tRect.Right = $tRect.Right - $tRect.Left $tRect.Bottom = $tRect.Bottom - $tRect.Top $tRect.Left = 0 $tRect.Top = 0 Local $iCol = _WinAPI_GetSysColor($COLOR_3DFACE) If MapExists($mh_SelCtrls, $hWnd) Then If $mh_SelCtrls[$hWnd] Then _ $iCol = ($hHasFocus = $hWnd) ? _WinAPI_RGB(0, 0xAA, 0) : _WinAPI_RGB(0, 0xAA, 0xAA) EndIf Local $hBrush = _WinAPI_CreateSolidBrush($iCol) _WinAPI_SelectObject($hDC, $hBrush) _WinAPI_FrameRect($hDC, $tRect, $hBrush) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($hWnd, $hDC) $iRet = 0 Case $WM_KEYDOWN If $wParam = $VK_DELETE Then _WinAPI_PostMessage($hWnd, $WM_DESTROY, 0, 0) Else $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndIf Case $WM_DESTROY _WinAPI_RemoveWindowSubclass($hWnd, $pCtrlProc, $iIdSubclass) $iRet = _WinAPI_DefWindowProcW($hWnd, $iMsg, $wParam, $lParam) Switch _WinAPI_GetClassName($hWnd) Case "Button" _GUICtrlButton_Destroy($hWnd) Case "Edit" _GUICtrlEdit_Destroy($hWnd) EndSwitch MapRemove($mh_SelCtrls, $hWnd) Case Else ;~ ConsoleWrite(Hex($iMsg) & @CRLF) $iRet = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndSwitch Return $iRet EndFunc ;==>CtrlProc Func _Ctrl_MoveSizeCtrlProc($hWnd, $iMsg, $wParam, $lParam) Local $iRetVal Local $tMsePoints, $tWinRect, $tMinMaxInfo, $tTgtRect Local $iSource, $iEvent Local $iFrameHitSize = 10 Local Static $iXOffset, $iYOffset Switch $iMsg Case $WM_NCHITTEST $tMsePoints = _WinAPI_MakePoints($lParam) $tWinRect = _WinAPI_GetWindowRect($hWnd) $iRetVal = $HTCLIENT ;only in caption bar if left button is down. (no kb input availabe in caption!) Local $iTestKey = _WinAPI_GetSystemMetrics($SM_SWAPBUTTON) ? $VK_RBUTTON : $VK_LBUTTON If BitAnd(0x8000, _WinAPI_GetAsyncKeyState($iTestKey)) Then $iRetVal = $HTCAPTION If $tMsePoints.X - $tWinRect.Left < $iFrameHitSize Then $iRetVal = $HTLEFT If $tMsePoints.X > ($tWinRect.Right - $iFrameHitSize) Then $iRetVal = $HTRIGHT If $tMsePoints.Y - $tWinRect.Top < $iFrameHitSize Then Switch $iRetVal Case $HTLEFT $iRetVal = $HTTOPLEFT Case $HTRIGHT $iRetVal = $HTTOPRIGHT Case Else $iRetVal = $HTTOP EndSwitch ElseIf $tMsePoints.Y > ($tWinRect.Bottom - $iFrameHitSize) Then Switch $iRetVal Case $HTLEFT $iRetVal = $HTBOTTOMLEFT Case $HTRIGHT $iRetVal = $HTBOTTOMRIGHT Case Else $iRetVal = $HTBOTTOM EndSwitch EndIf If $tMsePoints.X < 0 Then $iRetVal = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) If $tMsePoints.Y < 0 Then $iRetVal = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hWnd) Case $WM_GETMINMAXINFO ;Min width jumps to ~150 with WS_BORDER - I guess it gets min window size: SM_CYMINTRACK $tMinMaxInfo = DllStructCreate($tagMINMAXINFO, $lParam) $tMinMaxInfo.MinTrackSize(1) = $iMinCtrlW $tMinMaxInfo.MinTrackSize(2) = $iMinCtrlH $iRetVal = 0 Case $WM_SIZING $tWinRect = _WinAPI_GetWindowRect($hWnd) $tTgtRect = DllStructCreate($tagRect, $lParam) $tTgtRect.Left += Mod($tWinRect.Left - $tTgtRect.Left, $iSnap) $tTgtRect.Top += Mod($tWinRect.Top - $tTgtRect.Top, $iSnap) $tTgtRect.Right += Mod($tWinRect.Right - $tTgtRect.Right, $iSnap) $tTgtRect.Bottom += Mod($tWinRect.Bottom - $tTgtRect.Bottom, $iSnap) $iRetVal = True Case $WM_MOVING $tWinRect = _WinAPI_GetWindowRect($hWnd) $tTgtRect = DllStructCreate($tagRect, $lParam) $iXOffset += $tTgtRect.Left - $tWinRect.Left $iYOffset += $tTgtRect.Top - $tWinRect.Top Local $iSnapH = Floor($iXOffset / $iSnap) * $iSnap Local $iSnapV = Floor($iYOffset / $iSnap) * $iSnap $iXOffset -= $iSnapH $iYOffset -= $iSnapV $tTgtRect.Left = $tWinRect.Left + $iSnapH $tTgtRect.Right = $tWinRect.Right + $iSnapH $tTgtRect.Top = $tWinRect.Top + $iSnapV $tTgtRect.Bottom = $tWinRect.Bottom + $iSnapV $iRetVal = 0 Case $WM_EXITSIZEMOVE $iXOffset = 0 $iYOffset = 0 $iRetVal = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Case $WM_SETCURSOR $iSource = _WinAPI_WordToShort(_WinAPI_LoWord($lParam)) $iEvent = _WinAPI_HiWord($lParam) If $iSource = $HTCAPTION And $iEvent = $WM_LBUTTONDOWN Then _WinAPI_SetCursor($hCursor_Cross) $iRetVal = 1 Else $iRetVal = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndIf Case Else $iRetVal = _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndSwitch Return $iRetVal EndFunc Func _WinAPI_MakePoints($iValue) Local $tPoints = DllStructCreate("struct;short X;short Y;endstruct") DllStructSetData($tPoints, 1, _WinAPI_LoWord($iValue)) DllStructSetData($tPoints, 2, _WinAPI_HiWord($iValue)) Return $tPoints EndFunc Func _WinAPI_SetCursorPos($iX, $iY) Local $aCall = DllCall("user32.dll", "bool", "SetCursorPos", "int", $iX, "int", $iY) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc Func _WinAPI_MapWindowPoints($hWndFrom, $hWndTo, $pPoints, $iNumPoints) Local $aCall = DllCall("user32.dll", "int", "MapWindowPoints", "hwnd", $hWndFrom, "hwnd", $hWndTo, "ptr", $pPoints, "uint", $iNumPoints) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc
    3 points
  10. Released Peace version 1.6.8.11. It now support VST plugins by controlling and using Equalizer APO's Configuration Editor. The Peace AutoEQ interface now includes OPRA by Roon (collaborators such as Oratory1990). A new import interface has been created for better import. And a theme can be installed directly from within Peace through a new theme installation interface.
    3 points
  11. So you are a real language ✨Universalist ✨
    3 points
  12. A generic map function: ;Coded by UEZ build 2025-10-29 Func Map($val, $source_start, $source_stop, $dest_start, $dest_stop) Return (($val - $source_start) * ($dest_stop - $dest_start) / ($source_stop - $source_start) + $dest_start) EndFunc $iCol = Int(Map(87, 0, 100, 0, 255)) ConsoleWrite($iCol & " - 0x" & Hex($iCol, 2) & @CRLF) ;87% from color value (0 - 255) $iCol = 1 + Int(Map($iCol, 0, 255, 0, 100)) ;and back again ConsoleWrite($iCol & " - 0x" & Hex($iCol, 2) & @CRLF)
    3 points
  13. Updated v25.205.1420.14 available in Beta.
    3 points
  14. Progress! ... Click the form button beside of the cursor button (more than once if you want to). Now the windows are clipped to the left too! #include-once Opt("WinTitleMatchMode", 4) ; advanced Opt("MouseCoordMode" , 2) #include <WindowsStylesConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> Global $formList[], $formCount = 0 Global Const $main_width = 815 Global Const $main_height = 860 Global Const $main_left = (@DesktopWidth / 2) - ($main_width / 2) Global Const $main_top = (@DesktopHeight / 2) - ($main_height / 2) Global Const $guiCanvas = GuiCreate("GUI Canvas", $main_width, $main_height, $main_left, $main_top) Global Const $canvas = GuiCreate('', ($main_width - 105), ($main_height - 35), 95, 5, $WS_CHILD, $WS_EX_OVERLAPPEDWINDOW, $guiCanvas) GUISetFont(10, -1, -1, "Segoe UI", $guiCanvas) #region ; menu items Global Const $menu_file = GUICtrlCreateMenu ("File") Global Const $menu_save_definition = GUICtrlCreateMenuitem("Save", $menu_file) ; Roy add-on Global Const $menu_load_definition = GUICtrlCreateMenuitem("Load", $menu_file) ; Roy add-on GUICtrlCreateMenuitem('' , $menu_file) ; Roy add-on Global Const $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_file) Global Const $menu_edit = GUICtrlCreateMenu ("Edit") Global Const $menu_vals = GUICtrlCreateMenuitem("Vals" , $menu_edit) ; added by: TheSaint Global Const $menu_wipe = GUICtrlCreateMenuitem("Clear all controls", $menu_edit) Global Const $menu_about = GUICtrlCreateMenuitem("About" , $menu_edit) ; added by: TheSaint GUICtrlSetState($menu_wipe, $GUI_DISABLE) Global Const $menu_settings = GUICtrlCreateMenu ("Settings") Global Const $menu_show_grid = GUICtrlCreateMenuItem("Show grid" , $menu_settings) Global Const $menu_grid_snap = GUICtrlCreateMenuItem("Snap to grid" , $menu_settings) Global Const $menu_paste_pos = GUICtrlCreateMenuItem("Paste at mouse position" , $menu_settings) Global Const $menu_show_ctrl = GUICtrlCreateMenuItem("Show control when moving", $menu_settings) Global Const $menu_show_hidden = GUICtrlCreateMenuItem("Show hidden controls" , $menu_settings) GUICtrlSetState($menu_show_grid , $GUI_CHECKED ) GUICtrlSetState($menu_grid_snap , $GUI_CHECKED ) GUICtrlSetState($menu_paste_pos , $GUI_CHECKED ) GUICtrlSetState($menu_show_ctrl , $GUI_CHECKED ) GUICtrlSetState($menu_show_hidden, $GUI_UNCHECKED) #endregion ; menu items #region ; toolbar Global Const $default_cursor = CreateToolButton("Cursor" , 5, 5) Global Const $toolForm = CreateToolButton("Form" , 45, 5) Global Const $toolGroup = CreateToolButton("Group" , 5, 45) Global Const $toolButton = CreateToolButton("Button" , 45, 45) Global Const $toolCheckbox = CreateToolButton("Checkbox" , 5, 85) Global Const $toolRadio = CreateToolButton("Radio" , 45, 85) Global Const $toolEdit = CreateToolButton("Edit" , 5, 125) Global Const $toolInput = CreateToolButton("Input" , 45, 125) Global Const $toolLabel = CreateToolButton("Label" , 5, 165) Global Const $toolUpDown = CreateToolButton("UpDown" , 45, 165) Global Const $toolList = CreateToolButton("List" , 5, 205) Global Const $toolCombo = CreateToolButton("Combo" , 45, 205) Global Const $toolDate = CreateToolButton("Date" , 5, 245) Global Const $toolTreeview = CreateToolButton("Treeview" , 45, 245) Global Const $toolProgress = CreateToolButton("Progress" , 5, 285) Global Const $toolAvi = CreateToolButton("Avi" , 45, 285) Global Const $toolIcon = CreateToolButton("Icon" , 5, 325) Global Const $toolPic = CreateToolButton("Pic" , 45, 325) Global Const $toolSlider = CreateToolButton("Slider" , 5, 365) Global Const $toolMenu = CreateToolButton("Menu" , 45, 365) Global Const $toolContextMenu = CreateToolButton("Context Menu", 5, 405) Global Const $toolTab = CreateToolButton("Tab" , 45, 405) #endregion ; toolbar main() Func main() GUISetState(@SW_SHOWNORMAL, $guiCanvas) GUISetState(@SW_SHOWNORMAL, $canvas) Local $msg Do $msg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $msg[1] Case $guiCanvas Switch $msg[0] Case $toolForm CreateForm() Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch Until False EndFunc Func CreateForm() GUISwitch($canvas) $formCount += 1 Local Const $form = GuiCreate("Form " & $formCount, 400, 600, 5, 5, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $canvas) $formList["Form" & $formCount] = $form GUISetState(@SW_SHOWNORMAL, $form) GUISwitch($guiCanvas) Return $form EndFunc Func CreateToolButton(Const $name, Const $left, Const $top) Local Const $tool = GUICtrlCreateRadio($name, $left, $top, 40, 40, BitOR($BS_PUSHLIKE, $BS_ICON)) GUICtrlSetImage($tool, @ScriptDir & "\resources\Icons\" & $name & ".ico") GUICtrlSetTip($tool, $name) Return $tool EndFunc
    3 points
  15. I just wanted to take a moment to thank everyone again who helped with this issue. I've completed the part of the project that relates to the menubar. I actually ended up coloring that line in such a way that it gives the GUI some depth and also made the statusbar sizing and style to match it. When I started learning AutoIt a little over a year ago, I never thought that such beautiful GUIs could be made. I was able to make that line semi-transparent along with the rest of the GUI so that it does the blur behind well and also the Windows 11 materials (Mica, Acrylic, etc.) Cheers everyone! 🍷
    3 points
  16. I am sure he's happy after 5 years!!! 😉
    3 points
  17. That's a very good point. I shouldn't have used a hardcoded path like that. I like the creative way that you used the @AutoItExe macro to get the AutoIt install directory. Thanks for sharing. This was a really fun example. Thanks for sharing. I didn't expect that a child GUI would work in this type of situation, so that was a neat surprise.
    3 points
  18. to test different patterns simultaneously ; https://www.autoitscript.com/forum/topic/212981-move-window-behind-desktop-icons/page/2/#findComment-1544444 #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hWorkerW = _GetDesktopWorkerW() If @error Then Exit MsgBox(16, @ScriptName, "! Error - Couldn't find WorkerW under Progman", 30) ConsoleWrite("WorkerW = " & $hWorkerW & @CRLF) ; Overlay GUICreate Local $hGUI = GUICreate("Overlay", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW) Local $BkColor = 0x000000 GUISetBkColor($BkColor, $hGUI) GUISetFont(12) _WinAPI_SetParent($hGUI, $hWorkerW) _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED)) _WinAPI_SetLayeredWindowAttributes($hGUI, 0, 150, $LWA_ALPHA) GUISetState(@SW_SHOWNOACTIVATE) Local $aChildGui[10] = [9], $aLbl[10] = [9] Local $iW = @DesktopWidth * 0.33, $iH = @DesktopHeight * 0.33, $iX = 0, $iY = 20, $iCnt = 0 For $i = 1 To 3 For $j = 1 To 3 $iCnt += 1 $aChildGui[$iCnt] = GUICreate("Child_" & $iCnt, $iW, $iH, $iX, $iY, $WS_CHILD, $WS_EX_TOOLWINDOW, $hGUI) $BkColor = "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) ConsoleWrite("$BkColor=" & $BkColor & @CRLF) GUISetBkColor($BkColor, $aChildGui[$iCnt]) $aLbl[$iCnt] = GUICtrlCreateLabel("Child_" & $iCnt & ", BkColor:" & $BkColor, 0, 0, $iW, 25) GUICtrlSetFont(-1, 18) GUISetState(@SW_SHOWNOACTIVATE) $iX += $iW Next $iX = 0 $iY += $iH Next $iCnt = 0 While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(50) $iCnt += 1 If $iCnt > 40 Then $iCnt = 0 For $i = 1 To $aChildGui[0] $BkColor = "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) GUISetBkColor($BkColor, $aChildGui[$i]) GUICtrlSetData($aLbl[$i], "Child_" & $i & ", BkColor:" & $BkColor) Next EndIf WEnd EndFunc ;==>Example Func _GetDesktopWorkerW() Local $hWorkerW = 0, $hProgman = _WinAPI_GetShellWindow() _WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 3000, $SMTO_NORMAL) ; same as _SendMessage() Local $aEnumWindows = WinList("[CLASS:WorkerW]") For $n = 1 To $aEnumWindows[0][0] Local $hWnd = $aEnumWindows[$n][1] If _WinAPI_GetParent($hWnd) = $hProgman Then Return SetError(0, $hProgman, $hWnd) Next Return SetError(1, $hProgman, 0) EndFunc ;==>_GetDesktopWorkerW
    3 points
  19. I was so grouchy at the thought of blasting away my Windows partition to reinstall Windows but thankfully I figured it out before I got that far. In Advanced System Properties (SystemPropertiesAdvanced.exe) in the Performance settings dialog - Visual Effects tab, there is a checkbox labelled "Animate controls and element inside windows". Apparently that simple little checkbox controls whether or not a WorkerW window is even allowed to be created under Progman. I have always disabled any and all animation effects in Windows for years. And this was one of them. After checking this box, WorkerW is able to be created under Progman and all is good now. All examples work on my machine now. I would have reinstalled Windows and it still would have failed because disabling animation effects is one of the first things that I do after a clean install. 😄
    3 points
  20. wakillon

    SlidingToolbar

    No need to click for see it, just put your mouse on the left side of your screen Why on the left? Because the taskbar is already crowded, on the right side we scroll, and at the top when we use our browser tab by tab, it's not convenient to have a GUI in the way. You can add Shortcut, InternetShortcut, Files, and Folder by drag and drop on any button (special folders not supported) Right click menu on it for delete item See tray menu for options To exit, click on the InfoBar at the bottom of the GUI or by tray menu SlidingToolbar.7z
    3 points
  21. UEZ

    AutoIt Snippets

    I don't know if something like this has already been posted. DarkMode API Calls (undocumented): ;Coded by UEZ build 2025-10-10 ;IMMERSIVE_HC_CACHE_MODE Enum $IHCM_USE_CACHED_VALUE, $IHCM_REFRESH Enum $Default, $AllowDark, $ForceDark, $ForceLight, $Max ;$iPreferredAppMode ;~ Enum $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20 Func _WinAPI_ShouldAppsUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 132) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldAppsUseDarkMode Func _WinAPI_AllowDarkModeForWindow($hWND, $bAllow = True) Local $aResult = DllCall("UxTheme.dll", "bool", 133, "hwnd", $hWND, "bool", $bAllow) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_AllowDarkModeForWindow Func _WinAPI_AllowDarkModeForApp($bAllow = True) ;Windows 10 Build 17763 Return _WinAPI_SetPreferredAppMode($bAllow ? 1 : 0) ; 1 = AllowDark, 0 = Default EndFunc ;==>_WinAPI_AllowDarkModeForApp Func _WinAPI_SetPreferredAppMode($iPreferredAppMode) ;Windows 10 Build 18362+ Local $aResult = DllCall("UxTheme.dll", "long", 135, "long", $iPreferredAppMode) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_SetPreferredAppMode Func _WinAPI_FlushMenuThemes() Local $aResult = DllCall("UxTheme.dll", "none", 136) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_FlushMenuThemes Func _WinAPI_RefreshImmersiveColorPolicyState() Local $aResult = DllCall("UxTheme.dll", "none", 104) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_RefreshImmersiveColorPolicyState Func _WinAPI_IsDarkModeAllowedForWindow($hWND) Local $aResult = DllCall("UxTheme.dll", "bool", 137, "hwnd", $hWND) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForWindow Func _WinAPI_GetIsImmersiveColorUsingHighContrast($iIMMERSIVE_HC_CACHE_MODE) Local $aResult = DllCall("UxTheme.dll", "bool", 106, "long", $iIMMERSIVE_HC_CACHE_MODE) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_GetIsImmersiveColorUsingHighContrast Func _WinAPI_OpenNcThemeData($hWND, $tClassList) Local $aResult = DllCall("UxTheme.dll", "hwnd", 49, "hwnd", $hWND, "struct*", $tClassList) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_OpenNcThemeData Func _WinAPI_ShouldSystemUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 138) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldSystemUseDarkMode Func _WinAPI_IsDarkModeAllowedForApp() Local $aResult = DllCall("UxTheme.dll", "bool", 139) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForApp Requires OSBuild > 17762! API may change in next Windows updates! PS: I've reinvented the wheel ->
    3 points
  22. Several adjustments were made within the UDF. 1. Writing Excel function cells _xlsx_WriteFromArray() can now write Excel functions. For this, the element value in the input array must be a string that starts with `=`. The string itself is then interpreted as an Excel function. Example: =IF(F2>E2,"yes","no") Note: For Excel to interpret this correctly, only the English notation is permitted. If you need to write a string that starts with `=` but should not be interpreted as a function, escape the first `=` by doubling it (`==`). 2. Smallest possible .xlsx output files The .xlsx file generated with _xlsx_WriteFromArray() has been consistently optimized for minimal size. Files produced this way are close to the minimum possible for the format given the data. Sample dataset: [[1,2,3],[4,5,6]] Excel: 8.45 KB _xlsx_WriteFromArray(): 1.23 KB 3. Formatting of date and time If an element value in the input array for _xlsx_WriteFromArray() contains a date or time, the cell in the .xlsx file is formatted accordingly as date, time, or date/time style. The string format for these cells must be as follows: Date: YYYY-MM-DD Time: HH:MM[:SS[.mmmmmm]] Date + Time: YYYY-MM-DD[T ]HH:MM[:SS[.mmmmmm]] Note: Date and Date+Time remain as string values. A pure time, however, is encoded as a number (Excel notation where 24h = 1.0). Bug fixes and style _xlsx_2Array() can now also handle files whose sharedstrings.xml elements have a prefix (= higher compatibility). _xlsx_2Array() now also reads files that skip empty rows (= higher compatibility). Au3Check no longer emits (partly incorrect) warnings when using the UDF.
    3 points
  23. here is a simple powershell command I use to set an ignore exclusion in Defender for a specific folder Run(@ComSpec & ' /c powershell -Command Add-MpPreference -ExclusionPath ' & '"' & @ScriptDir & '"' & ' -Force', @ScriptDir, @SW_HIDE) Use this command where ever your compiled script is to be created. By changing the word Add to Remove, it will remove the set exclusion. This script will require Administrative rights to be able to perform its function(s).
    3 points
  24. Thank you! 🥰 It's a problem I'm in the middle of working on. I got side quested with this DPI stuff. 😂 I learned a lot and now I have something to bring into my future projects! Updated at GitHub because I made some oopsies!
    2 points
  25. TheSaint

    Kobo Cover Fixer

    REMOVED the Kobo Cover Fixer v2-4.zip update download, due to a serious bug. It will be replaced soon as, but right now I am still testing, which isn't easy in my circumstances, which is no doubt how the issue slipped through. Basically the Restore feature worked in the wrong direction copy wise, and probably the Clone feature did too. I am presuming they originally worked in the right directions or I would have noticed before now. So likely this is the result of a recent new feature I added, and which I might have been interrupted in when implementing. Due to the flaky nature of the USB connection to my Kobo device, which may be a device hardware issue or just driver related, testing and troubleshooting for me, are a challenge. In essence, I only get a small window of time to operate in. Basically my device needs to be flat, and I get roughly an hour before it is charged after connecting to my PC. Once the device battery is charged, the Kobo device gets stuck in a connect/disconnect loop, so almost impossible to work with. You might think an hour would be sufficient time, and it is if all goes to plan. However it doesn't leave much leeway for testing latest changes or troubleshooting. This is chiefly because I have a lot of ebooks on my Kobo device ... just shy of a thousand, of which somewhat less than a hundred are side-loaded ebooks. It takes a good while checking the images for all those ebooks, especially when doing visual comparison, as happens when a mismatch between the clone folder on my PC and the images folder on the Kobo device. Anyway, BIG APOLOGIES to the six downloaders of v2.4, who may have been or might be, impacted by the wrong direction copy issue ... hopefully their cover sources remain. I discovered this issue a couple of hours ago and are already working on a fix, perhaps already fixed. Luckily right now, I am just about to start reading a physical trade paperback, so my Kobo device won't be needed for reading for a couple of days or so. In an effort to deal with this more quickly, I have temporarily set my Kobo device to never go to sleep, so the battery can get flatter quicker, and I can do some final testing, hopefully in a few hours or tomorrow. P.S. I'd been following my latest instructions to ensure I didn't miss anything in regard to them, so the good news is they passed up to where I needed to troubleshoot the copy issue, so up until just before I needed to run the Clone feature ... after restoring the cover images in my Clone folder from my Images Backup folder ... so glad I had that. NOTE TO SELF - I should suggest using the BACKUP IMAGES option before running the 'Clone' feature ... certainly on first use. Having that backup has saved my bacon a few times. So I should amend those newly created instructions.
    2 points
  26. ...developing GUI stuff is a pain. Mostly because you'd need at least 2 monitors and at least on with scaling as otherwise, you can't clearly see what it looks like. On the other hand, that would be a pain to code without an stablished UDF for it. Therefore, since we don't have a stablish UDF ( that I know of ) forget the HiDPI stuff and make the GUI editor without that into consideration. If "GuiCtrls_HiDpi" (UDF in progress) or another UDF comes along or, "New and improved: AutoIt v3.4.0.0. Now with HiDPI" comes into existence, then patching the editor shouldn't be a big deal. Santa Claus/Saint Nicholas/Saint Nick/Father Christmas/Kris Kringle/bearded dude: I wish for a "dark/light mode, DPI aware" all in one UDF 😇 TIA
    2 points
  27. Local. Inside the function.
    2 points
  28. I was just trying to figure out what that extra info really contributes! 😉
    2 points
  29. The starting digit is 0 not 1, so it is 256 levels of transparency.
    2 points
  30. Not if you format the function headers in the correct way, then you just need to prepare a few text files and run a script. Please see Simple Library Docs Generator
    2 points
  31. wakillon

    AutoIt Snippets

    Trick for display your favorite directories in FileSaveDialog and FileOpenDialog with Win 11 The favorite directories are set in registry to : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\comdlg32\Placesbar Example of Placesbar Reg File Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\comdlg32\Placesbar] "Place1"="C:\\" "Place2"="C:\\Program Files (x86)\\AutoIt3\\Include" "Place4"="D:\\" "Place0"=dword:00000011 "Place3"=dword:00000010 11 is "My Computer" and 10 the Desktop #Region ;************ Includes ************ #Include <WinAPITheme.au3> #EndRegion ;************ Includes ************ $hGui = GUICreate('', 500, 500) GUISetState() ; Default display FileSaveDialog('Save file', @WorkingDir, 'Scripts (*.au3)', $FD_PATHMUSTEXIST, '', $hGui) ; ; Display with PlacesBar _WinAPI_SetThemeAppProperties($STAP_ALLOW_NONCLIENT) FileSaveDialog('Save file', @WorkingDir, 'Scripts (*.au3)', $FD_PATHMUSTEXIST, '', $hGui) FileOpenDialog('Select a file', @WorkingDir & '\', 'Images (*.jpg;*.bmp)', $FD_FILEMUSTEXIST, '', $hGui) ; ; Reset default display _WinAPI_SetThemeAppProperties(-1) FileSaveDialog('Save file', @WorkingDir, 'Scripts (*.au3)', $FD_PATHMUSTEXIST, '', $hGui) GUIDelete($hGui) Exit
    2 points
  32. Some 3 month ago examples were added for what I see. Following the examples should show what each function does. I don't use spreadsheets but if I needed to, I'd have to learn that, ... in a hurry. And automate it even faster ( all this while clueless "inexperienced" ) I don't think that there is a way around "the learning curve". Maybe making wrapper functions ala "Word user defined functions" would help for the _LODoc_* functions 🤔 I believe that if something is overwhelming, it is so for the uninitiated, and not because is poorly thought-out. Ok, let's look at me. I push for forking and wrote some wrappers/ideas yet, many find it overwhelming/too much/too difficult. What can I do 🤷‍♂️ Nothing. Each will gain understanding as they gain experience with the concept(s) and the solution(s). Yeah. Nothing you can do other than examples for the functions and that you did.
    2 points
  33. Sorry I'm newbie In the forum So. .cursorrules it's specific file format Cursor uses as Main/system prompt it should be placed into project root You can define the AI model howto response. This is mine but you can edit it. Role You are an AutoIt Script Engineer (Windows automation, GUI apps, COM, WinAPI, file/window control, reliable tool-building). Action Understand the task and proactively clarify any gaps. Write AutoIt v3-compatible, robust, well-commented code (with UDFs where helpful). Build an event-driven GUI with status indicators and logging. Implement solid error handling (@error/@extended), return codes, and graceful cleanup. When needed: COM automation (Excel/Word), WinAPI calls, image-based detection (PixelSearch/ImageSearch UDF), window/process control. Provide self-tests per major function and basic timing/metrics. Include build/run instructions and config tips. Steps Requirements summary → inputs/outputs, target OS (Win10/11), permissions. Design → modules, UDFs (#include), GUI flow, logging strategy. Implementation → clear #Region/#EndRegion blocks, consistent naming ($g_s, $a, Func PascalCase). Error handling → guards, fallbacks, resource disposal. Tests → function self-tests, synthetic data, edge cases. Performance → tuned sleeps, correct WinWait/Control* usage. Documentation → README (run, params, known limits), changelog. Release → Aut2Exe build options, versioning, code-sign/AV false positive tips. Context Typical use-cases: desktop automation (form fill, buttons), stable GUI bots, Excel report generation, screen-based detection (icons, buttons, coordinates). Environment: Windows 10/11 x64, AutoIt v3 + SciTE; optional external UDFs (e.g., ImageSearch.au3; if unavailable, provide PixelSearch+tolerance alternative). Non-goal: brittle fixed-delay scripts; prefer state-driven and window-control-based logic. Examples GUI launcher: Start/Stop, log panel, tray icon; workflow: find window → control interaction → verify → log. Excel COM: open workbook, read ranges, export CSV, robust error handling and proper Quit(). Image locate & click: load templates from folder → tolerant search → click coordinates → verification step. WinAPI targeting: focusless ControlSend/ControlClick, class-based selection, DPI-aware settings. Format First: short Summary (goal, inputs/outputs). Then: a single .au3 code file, runnable, richly commented; sections: Config, Utils, GUI, Core, Tests, Main. Finally: README (install, run, troubleshooting, known limitations). Code display: canmore.create_doc (single file, copyable). Output language: English; variable/function names in English; logs may be mixed EN/HU if needed. Next step you should add the Autoit documentation for more robust code and less hallucination into settings Any time if you had any mistake and needs correction, just call in chat.
    2 points
  34. Gotta say, nice looking and with the new includes, right on time too.
    2 points
  35. Thank you all so much. WildByDesign and I hit on the cause at the same time. I uninstalled AutoIT (again) and just checked through that it had all gone before restarting the machine. I discovered the C:\Users\your-user-name\AppData\Local\AutoIt v3 folders still sitting there with files in, so I deleted those. I also found several folders hanging around in odd places in the main folder structure, so it looks like I had some debris from my (now past) Windows 10 days which may have caused further problems. I deleted those too. Argumentum, yes, you were right - I had only installed the VCRedist C++ libraries up to 2017. Adding the missing 2018 to 2025 ones didn't immediately solve the problem but by being there, they have got to help. Did a fresh AutoIT v.3.3.18.0 install and found that the included SciTE Lite worked properly (i.e. as I had hoped) and then went on to install Jos' full SciTE v4.4.6 version and that works too. Solution: Do an AutoIT and SciTE uninstall and then delete the hidden C:\Users\<username>\AppData\Local\AutoIT v3\ folders before restarting and reinstalling. Check VCRedist status because upgrading Windows does not update the libraries. Once again, thanks to all of you for your help John G0GCD EDIT: For information, as I normally do, I updated my installation instructions and archived the installation files that I have used. (AutoIT3 v3.3.18.0, SciTE4AutoIT3 v4.4.6 on WIndows 11 Home). I then followed the instructions to ensure that I had cracked the problem but, unfortunately, I've broken the installation - the delay is back. So, briefly, I've unmarked the answer as a solution until I've bottomed it out. Clearly, however, it is to do with my machine and the versions of files that I'm using. I'll update the thread once I've fixed it. PS. Jos' SciTE4AutoIT3 v4.4.6 (installer), downloaded from https://www.autoitscript.com/site/autoit-script-editor/downloads/ still has the bug 'Missing Global $__WINVER declaration' in SciTe Jump.au3. Am I downloading the wrong thing?
    2 points
  36. Tremendous! Thank you, this gives me something to tinker with!
    2 points
  37. You could have more instances looking for it and report via IPC ( my take on "how" here ) and there are a few in the WiKi that you can try. This way if you run 8 chunks of screen, it'll 8 times faster of whatever technique you use.
    2 points
  38. Finally! Latest version in the OP. Huge shoutout to Jos because I leaned very heavily on his AutoItGotoDefinition (you did write that I assume?).
    2 points
  39. Any of this code ( https://www.autoitscript.com/forum/topic/191058-datetime-pick-coloring ) useful ?
    2 points
  40. This works properly, yes. Thank you. It also worked once I applied DPI scaling of 125%. But once I tried 150% and higher the line did not line up anymore. But I understand that it is not supporting DPI yet. EDIT: By the way, I wanted to mention that not only is your coding incredible, but I really wanted to point out the fact that your code comments are also very easy to understand and therefore helpful for anyone reading your code. I appreciate the extra effort that you put into code comments.
    2 points
  41. Sure it's enough and better, no need of the optional parameter when calling gui2() Well done !
    2 points
  42. @pixelsearch thanks for the clarification, because I didn't think about/understand this case question, isn't that enough? Local $aMsg = 0, $iReturn = 0 While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] ; Switch from GUIs Case $g_hGUI2 Switch $aMsg[0] ; Switch from event ID Case $GUI_EVENT_CLOSE, $g_idButton4 ConsoleWrite("GUI2: $GUI_EVENT_CLOSE=" & $GUI_EVENT_CLOSE & @CRLF) If $aMsg[0] = $g_idButton4 Then ConsoleWrite(" with Cancel" & @CRLF) $iReturn = 1 EndIf ExitLoop Case $g_idButton3 ConsoleWrite("GUI2: $g_idButton3=" & $g_idButton3 & @CRLF) MessageBox(2) EndSwitch EndSwitch WEnd GUIDelete($g_hGUI2) GUICtrlSetState($g_idButton2, $GUI_ENABLE) Opt("GUIOnEventMode", 1) ; when out of $g_hGUI2 - enable <<<<<<<<<<<<<<< Return $iReturn EndFunc ;==>gui2 ... Func Traitement_intermediaire() ; display the listview If gui2() Then Return MsgBox(0, "Suite", "cela continue") ;suite du script ;.... EndFunc ;==>Traitement_intermediaire
    2 points
  43. @ioa747 hello Maybe ermar asks for this : when he clicks on button "Traitement" in GUI1, then the function Traitement_intermediaire() is called, which calls gui2() and creates the listview. Now he starts to modify the listview, but suddenly he would like to cancel everything. Unfortunately, when he clicks the button "Cancel" in GUI2, the function Traitement_intermediaire() continues with this line in Traitement_intermediaire() MsgBox(0, "Suite", "cela continue") ;suite du script So we should indicate a way so the Cancel button in GUI2 reacts differently, depending on the part of the script which called gui2() 1) If gui2() was called from the function On_Button() => Case $g_idButton2 => gui2() , then no change is required 2) If gui2() was called from the function Traitement_intermediaire() => gui2() , then some code is required in case the user clicks on button Cancel in GUI2 . The change could be like this : Func Traitement_intermediaire() ; gui2() If gui2(1) Then Return MsgBox(0, "Suite", "cela continue") ;suite du script ;.... EndFunc ; Func gui2() Func gui2($iCancelStopsAll = 0) Local $iReturn = 0 ... Case $GUI_EVENT_CLOSE, $g_idButton4 If $iCancelStopsAll Then $iReturn = 1 ... Return $iReturn ; 0 or 1 EndFunc Note : if the GUI2 Close button [X] should react differently than the GUI2 Cancel button, then the Case should be splitted in 2 (one Case for $GUI_EVENT_CLOSE, another Case for $g_idButton4) Hope it makes sense... if this is what ermar asked for !
    2 points
  44. ioa747

    AutoIt Snippets

    trick for ToolTip with timer Func _ToolTip($sText, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iTimeout = 1500, $iOptions = 0) AdlibUnRegister("_ToolTipKiller") ; This prevents the previous timer from closing the new tooltip. ToolTip($sText, $iX, $iY, $sTitle, $iIcon, $iOptions) AdlibRegister("_ToolTipKiller", $iTimeout) EndFunc ;==>_ToolTip Func _ToolTipKiller() ToolTip("") ; Hide the tooltip AdlibUnRegister("_ToolTipKiller") ; unregister itself. EndFunc ;==>_ToolTipKiller Example ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/page/28/#findComment-1546696 ;---------------------------------------------------------------------------------------- ; Title...........: Trick for ToolTip with timer ; Description.....: Displays a native tooltip with timer. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.1 ; Note............: Testet in Win10 22H2 Date:16/10/2025 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> Forms() Func Forms() Local $hGui = GUICreate(@ScriptName, 250, 150, -1, -1) Local $idBtn1 = GUICtrlCreateButton("Button 1", 10, 10, 100, 25) Local $idBtn2 = GUICtrlCreateButton("Button 2", 10, 40, 100, 25) Local $idBtn3 = GUICtrlCreateButton("Button 3", 10, 70, 100, 25) Local $idBtn4 = GUICtrlCreateButton("Button 4", 10, 100, 100, 25) GUISetState(@SW_SHOW, $hGui) While 1 Local $aWPos = WinGetPos($hGui) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn1 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 1", 1) Case $idBtn2 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 2", 1) Case $idBtn3 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 3", 1) Case $idBtn4 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 4", 1) EndSwitch WEnd GUIDelete($hGui) EndFunc ;==>Forms Func _ToolTip($sText, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iTimeout = 1500, $iOptions = 0) AdlibUnRegister("_ToolTipKiller") ; This prevents the previous timer from closing the new tooltip. ToolTip($sText, $iX, $iY, $sTitle, $iIcon, $iOptions) AdlibRegister("_ToolTipKiller", $iTimeout) EndFunc ;==>_ToolTip Func _ToolTipKiller() ToolTip("") ; Hide the tooltip AdlibUnRegister("_ToolTipKiller") ; unregister itself. EndFunc ;==>_ToolTipKiller
    2 points
  45. I was able to test this new event functionality this morning and it works great. Excellent job! Without a doubt, this is the most fully featured toast notification UDF for AutoIt specifically for utilizing native toast functionality. There are some other UDFs which create their own toast-like notifications. But using built-in Windows functionality is generally the best way to go. Your UDF already does everything that I personally would ever need as far as toast notifications go. One of the best toast notification apps that I've ever used on Windows 11 is actually from KDE, of all things. Snoretoast (https://github.com/KDE/snoretoast). But I didn't like the idea of having to drop yet another binary on disk for my users. So I will likely switch those apps over to your UDF and keep it all AutoIt. By the way, you can always browse their source code (C++) to see if there is anything that they do that might be beneficial for your UDF. I don't understand some of the more complex parts of toast notification functionality, so I'm not even sure if they have anything extra or not. Cheers (or toast!) 🍷
    2 points
  46. ... Local $sFile = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) -1 ) & "\Examples\GUI\logo4.gif" Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) ;create an image object based on a file Global $hWorkerW = _WinAPI_FindWindowEx($hProgman, 0, "WorkerW", "") If Not $hWorkerW Then ; dah Local $aEnumWindows = _WinAPI_EnumWindows(False) For $n = 1 To UBound($aEnumWindows) - 1 If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then $hWorkerW = $aEnumWindows[$n][0] ExitLoop ; but is likely one at the end of the Z-order EndIf Next EndIf If $hWorkerW = 0 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30) ... OnAutoItExitRegister(CleanupResources) While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd CleanupResources() Func CleanupResources() Local Static $iRunOnce = 0 If $iRunOnce Then Return ConsoleWrite('+ Func CleanupResources() - WinExists: ' & WinExists($hGUI) & ' - ' & (IsInt(Execute("@exitCode")) ? 'TrayExit' : 'GuiClosed') & @CRLF) ;cleanup resources _GDIPlus_BrushDispose($hTexture) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) $iRunOnce = 1 EndFunc ... ...be mindful of everyone and everything ?
    2 points
  47. See example in helpfile for _GDIPlus_TextureCreate()
    2 points
  48. InnI

    autoit error

    ByRef parameter cannot have default value. You must to use ByRef something like this $sOut = "" RunCmd("CmdLine", $sOut) ConsoleWrite($sOut & @CRLF) ; changed Func RunCmd($sCmd, ByRef $sOut) $sOut = "changed" EndFunc
    2 points
  49. Latest version! Works on AutoItObject methods now! A big shoutout to ioa747 too!
    2 points
  50. This is how to do it with the built-in UDF functions: #include <WinAPI.au3> #include <Misc.au3> Local $stPoint=DllStructCreate($tagPOINT),$aPos,$hControl,$hWin,$aLastPos[2]=[-1,-1],$sLastStr='',$sStr While Not _IsPressed('1B') $aPos=MouseGetPos() If $aPos[0]<>$aLastPos[0] Or $aPos[1]<>$aLastPos[1] Then DllStructSetData($stPoint,1,$aPos[0]) DllStructSetData($stPoint,2,$aPos[1]) $hControl=_WinAPI_WindowFromPoint($stPoint) $hWin=_WinAPI_GetAncestor($hControl,2) $sStr='Window at '&$aPos[0]&','&$aPos[1]&': "'&WinGetTitle($hWin)&'"' If $sLastStr<>$sStr Then ToolTip($sStr,0,@DesktopHeight-20) $sLastStr=$sStr EndIf $aLastPos=$aPos EndIf Sleep(15) WEnd On a side note - I'd just like to add that _WinAPI_WindowFromPoint() was poorly thought out - it should take x,y coordinates instead of a structure.
    2 points
×
×
  • Create New...