Leaderboard
Popular Content
Showing content with the highest reputation since 06/08/2025 in Posts
-
Fast array functions concept [feedback wanted]
WildByDesign and 5 others reacted to UEZ for a topic
AutoIt was never really built for speed — it’s an interpreted language, great for scripting and automation, but not exactly a high-performance engine under the hood. So trying to make it handle things like fast array slicing or inserting elements mid-array feels a bit like teaching a car to fly or haul 30 tons. Sure, maybe you could pull it off with enough creativity (and duct tape), but if you want to fly, you take a plane. If you want to haul heavy stuff, get a truck. Same with programming — sometimes it's better to just pick a faster compiled language for the job. That said, I love seeing people push the boundaries of what AutoIt can do. Using FASM, COM, and clever hacks to get more out of it is impressive, and if it helps you learn or build something cool — go for it! Just don’t forget the core strengths of AutoIt: simplicity, ease of use, and rapid development. Sometimes it’s okay to let the car be a car. 😊6 points -
Another AutoIt extension for Visual Studio Code
seadoggie01 and 4 others reacted to genius257 for a topic
1.8.5 released! This contains fix for the issue caused by UDF documentation headers with an empty newline in their content, found by @seadoggie01 I also found and fixed a related issue, where the capture regex did not capture the text after the empty newline for the tool-tip content.5 points -
Another AutoIt extension for Visual Studio Code
seadoggie01 and 4 others reacted to genius257 for a topic
Working towards the 1.9.0 release was taking too long, so I'm releasing 1.8.4 in the meantime Notable changes: ignoreInternalInIncludes setting would also ignore declarations in current file. Fixed so only internal declarations in included files are ignored. When resolving included files, the same file could be loaded from disk multiple times. This will improve performance, when opening au3 files.5 points -
I found this on my drive: #include <GUIComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <BorderConstants.au3> #include <WinAPI.au3> Global Const $ODT_MENU = 1 Global Const $ODT_LISTBOX = 2 Global Const $ODT_COMBOBOX = 3 Global Const $ODT_BUTTON = 4 Global Const $ODT_STATIC = 5 Global Const $ODT_HEADER = 100 Global Const $ODT_TAB = 101 Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 1 Global Const $ODA_SELECT = 2 Global Const $ODA_FOCUS = 4 Global Const $ODS_SELECTED = 1 Global Const $ODS_GRAYED = 2 Global Const $ODS_DISABLED = 4 Global Const $ODS_CHECKED = 8 Global Const $ODS_FOCUS = 16 Global Const $ODS_DEFAULT = 32 Global Const $ODS_HOTLIGHT = 64 Global Const $ODS_INACTIVE = 128 Global Const $ODS_NOACCEL = 256 Global Const $ODS_NOFOCUSRECT = 512 Global Const $ODS_COMBOBOXEDIT = 4096 Global Const $clrWindowText = _WinAPI_GetSysColor($COLOR_WINDOWTEXT) Global Const $clrHighlightText = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT) Global Const $clrHighlight = _WinAPI_GetSysColor($COLOR_HIGHLIGHT) Global Const $clrWindow = _WinAPI_GetSysColor($COLOR_WINDOW) Global Const $tagDRAWITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemAction;' & _ 'uint itemState;' & _ 'hwnd hwndItem;' & _ 'hwnd hDC;' & _ $tagRECT & _ ';ulong_ptr itemData;' Global Const $tagMEASUREITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemWidth;' & _ 'uint itemHeight;' & _ 'ulong_ptr itemData;' Global $iItemWidth, $iItemHeight Global $hGUI Global $ComboBox Global $hBrushNorm = _WinAPI_CreateSolidBrush($clrWindow) Global $hBrushSel = _WinAPI_CreateSolidBrush($clrHighlight) GUIRegisterMsg($WM_MEASUREITEM, '_WM_MEASUREITEM') GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM') ;GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND') $hGUI = GUICreate('Test', 220, 300) $ComboBox = GUICtrlCreateCombo('', 10, 10, 200, 300, BitOR($WS_CHILD, $CBS_OWNERDRAWVARIABLE, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST)) GUICtrlSetData($ComboBox, "Medabi|V!co®|joelson0007-|JScript|Belini|Jonatas-|AutoIt v3|www.autoitbrasil.com-|www.autoitscript.com", "Medabi") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBrushSel) _WinAPI_DeleteObject($hBrushNorm) GUIDelete() Func _WM_MEASUREITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $stMeasureItem = DllStructCreate($tagMEASUREITEMSTRUCT, $ilParam) If DllStructGetData($stMeasureItem, 1) = $ODT_COMBOBOX Then Local $iCtlType, $iCtlID, $iItemID Local $ComboBoxBox Local $tSize Local $sText $iCtlType = DllStructGetData($stMeasureItem, 'CtlType') $iCtlID = DllStructGetData($stMeasureItem, 'CtlID') $iItemID = DllStructGetData($stMeasureItem, 'itemID') $iItemWidth = DllStructGetData($stMeasureItem, 'itemWidth') $iItemHeight = DllStructSetData($stMeasureItem, "itemHeight", DllStructGetData($stMeasureItem, 'itemHeight') + 4) ;$iItemHeight = DllStructGetData($stMeasureItem, 'itemHeight') $ComboBoxBox = GUICtrlGetHandle($iCtlID) EndIf $stMeasureItem = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_MEASUREITEM Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam) Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState Local $clrForeground, $clrBackground Local $hWndItem, $hDC, $hOldPen, $hOldBrush Local $tRect Local $sText Local $iLeft, $iTop, $iRight, $iBottom $iCtlType = DllStructGetData($tDIS, 'CtlType') $iCtlID = DllStructGetData($tDIS, 'CtlID') $iItemID = DllStructGetData($tDIS, 'itemID') $iItemAction = DllStructGetData($tDIS, 'itemAction') $iItemState = DllStructGetData($tDIS, 'itemState') $hWndItem = DllStructGetData($tDIS, 'hwndItem') $hDC = DllStructGetData($tDIS, 'hDC') $tRect = DllStructCreate($tagRECT) If $iCtlType = $ODT_COMBOBOX And $iCtlID = $ComboBox Then Switch $iItemAction Case $ODA_DRAWENTIRE For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i + 7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) Local $iTop = DllStructGetData($tRect, 2), $iBottom = DllStructGetData($tRect, 4) DllStructSetData($tRect, 2, $iTop + 2) DllStructSetData($tRect, 4, $iBottom - 1) If BitAND($iItemState, $ODS_SELECTED) Then $clrForeground = _WinAPI_SetTextColor($hDC, $clrHighlightText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrHighlight) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushSel) Else $clrForeground = _WinAPI_SetTextColor($hDC, $clrWindowText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushNorm) EndIf DllStructSetData($tRect, 2, $iTop) DllStructSetData($tRect, 4, $iBottom) If $sText <> "" Then If StringInStr($sText, "-", 0, -1) Then ; Draw a "line" for a separator item If Not BitAND($iItemState, $ODS_COMBOBOXEDIT) Then DllStructSetData($tRect, 2, $iTop + ($iItemHeight)) _WinAPI_DrawEdge($hDC, DllStructGetPtr($tRect), $EDGE_ETCHED, $BF_TOP) EndIf $sText = StringTrimRight($sText, 1) EndIf DllStructSetData($tRect, 2, $iTop + 4) _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) EndIf _WinAPI_SetBkMode($hDC, $TRANSPARENT) Case $ODA_SELECT, $ODA_FOCUS For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i + 7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) Local $iTop = DllStructGetData($tRect, 2), $iBottom = DllStructGetData($tRect, 4) DllStructSetData($tRect, 2, $iTop + 2) DllStructSetData($tRect, 4, $iBottom - 1) If BitAND($iItemState, $ODS_SELECTED) Then $clrForeground = _WinAPI_SetTextColor($hDC, $clrHighlightText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrHighlight) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushSel) Else $clrForeground = _WinAPI_SetTextColor($hDC, $clrWindowText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushNorm) EndIf DllStructSetData($tRect, 2, $iTop) DllStructSetData($tRect, 4, $iBottom) If $sText <> "" Then If StringInStr($sText, "-", 0, -1) Then ; Draw a "line" for a separator item If Not BitAND($iItemState, $ODS_COMBOBOXEDIT) Then DllStructSetData($tRect, 2, $iTop + ($iItemHeight)) _WinAPI_DrawEdge($hDC, DllStructGetPtr($tRect), $EDGE_ETCHED, $BF_TOP) EndIf $sText = StringTrimRight($sText, 1) EndIf DllStructSetData($tRect, 2, $iTop + 4) _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) EndIf _WinAPI_SetBkMode($hDC, $TRANSPARENT) EndSwitch EndIf $tRect = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_DRAWITEM Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($ComboBox) Then $hWndCombo = GUICtrlGetHandle($ComboBox) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $ComboBox, $hWndCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed _DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box _DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible _DebugPrint("$CBN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text _DebugPrint("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request _DebugPrint("$CBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus _DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box _DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; Select Item ;_GUICtrlComboBox_SetCurSel($ComboBox, _GUICtrlComboBox_GetCurSel($ComboBox)) ; no return value Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box _DebugPrint("$CBN_SELENDCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list _DebugPrint("$CBN_SELENDOK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus _DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint It's buried somewhere in this forum...4 points
-
Uploaded a fix for that issue to Beta Tidy v 25.205.1420.64 points
-
why no array pointer
pixelsearch and 2 others reacted to UEZ for a topic
Something like that: ;coded by UEZ #include <WinAPIDiag.au3> #include <Memory.au3> Global $iElements = 2^5 ConsoleWrite("Number of entries: " & $iElements & @CRLF) Global $tArray = DllStructCreate("uint a[" & $iElements & "]") Global $pArray = DllStructGetPtr($tArray) For $i = 1 To $iElements $tArray.a(($i)) = $i Next Global $iPos = Int($iElements * 0.667) ConsoleWrite("Insert to position " & $iPos & @CRLF) InsertValue(123456789, $iPos, $tArray, $pArray, "uint") _WinAPI_DisplayStruct($tArray, "uint a[" & $iElements + 1 & "]") Func InsertValue($value, $iPos, ByRef $tArray, ByRef $pArray, $type) If Not IsDllStruct($tArray) Then Return SetError(1, 0, 0) Local $iUB, $iBytes Switch $type Case "wchar", "short", "ushort", "word" $iBytes = 2 $iUB = DllStructGetSize($tArray) / $iBytes Case "float", "int", "long", "bool", "uint", "ulong" $iBytes = 4 $iUB = DllStructGetSize($tArray) / $iBytes Case "int64", "uint64", "double" $iBytes = 8 $iUB = DllStructGetSize($tArray) / $iBytes Case Else Return SetError(2, 0, 0) EndSwitch If $iPos < 1 Or $iPos > $iUB Then SetError(3, 0, 0) $iUB += 1 Local $tArray_new = DllStructCreate($type & " a[" & $iUB & "]") $pArray = DllStructGetPtr($tArray_new) _MemMoveMemory(DllStructGetPtr($tArray), $pArray, ($iPos - 1) * $iBytes) $tArray_new.a(($iPos)) = $value _MemMoveMemory(DllStructGetPtr($tArray) + ($iPos - 1) * $iBytes, $pArray + $iPos * $iBytes , ($iUB - $iPos) * $iBytes) $tArray = $tArray_new Return 1 EndFunc3 points -
WinRT - WinUI3
argumentum and 2 others reacted to MattyD for a topic
Hi all - This is an offshoot of the WinRT Project. I'm posting my progress here while I'm bumbling around with WinUI3 - just so the main project doesn't get too cluttered. If I get things working I'll merge the two projects back together. That's the plan anyway! ATM all I have is a blank Window (thrilling I know!), but if you wish to try it out you'll need to: download and extract the example (obviously!) WindowTest.zip Go here and download the latest Redistributable package of the Windows App SDK. Currently this is 1.7.3 (look in the table for the link.). Once you've extracted that, go to the MSIX > win10-x64 folder yes, you can probably the x86 libraries - but I haven't tested them... be sure to alter the "#AutoIt3Wrapper_UseX64" directive in WindowTest.au3 if you plan to go down that path. Extract the contents of Microsoft.WindowsAppRuntime.1.7.msix. (7-Zip works fine) I also installed the msix (this is a runtime afterall!) - I'm not sure if this step is strictly necessary for now. Maybe someone could check? Grab all the .dll files and put then in the same folder as "WindowTest.au3" If you plan to make use of the Class Explorer script, grab all the .winmd files and put them in the same folder as "ClassExplorer v2.3.1.au3" I also found AppxManifest.xml is handy for mapping objects to physical dll files. And with that I'm calling it a day Cheers, Matt3 points -
DwmColorBlurMica
Parsix and 2 others reacted to WildByDesign for a topic
I promised myself that I was not going to make another GUI because the attention to detail drives me a little crazy. 🙃 But here we are. This was especially complicated because I wanted to make a GUI that was 100% receptive to the features that DwmColorBlurMica represents. It had to have transparent controls to show the underlying backdrop material (Mica, Acrylic, Blur, etc.) through the controls. This meant making custom ComboBox because AutoIt ComboBox are not normally transparent. Anyway, I think I am around 50% complete with the GUI. Below is a W.I.P. screenshot of where I am at right now: It works better than I expected. There are color pickers too. I will probably get rid of the menubar. I will likely add a custom transparent statusbar to show all of the Global settings to compare to the per-app settings. Lots of things to consider still. I hate making GUIs.3 points -
WebP v0.3.9 build 2025-07-07 beta
SOLVE-SMART and 2 others reacted to UEZ for a topic
Updated to WebP v0.3.7 build 2025-07-03 beta You can now create WebP anim files from WebP image files and you can extract frames from a WebP anim file to WebP image file format. Supported GDIPlus image formats: "bmp", "gif", "jpg", "tif", "png"3 points -
WebP v0.3.9 build 2025-07-07 beta
pixelsearch and 2 others reacted to UEZ for a topic
Updated to: WebP v0.3.5 build 2025-06-27 beta You can now create WebP animated files. Examples8 encodes GDI+ supported image files to an animation. Example9 captures the desktop screen to an WebP anim file.3 points -
You can simply try this code: It uses GDI+ to draw a red circle with centered text, creates a 32-bit ARGB icon, and sets it as a taskbar overlay using ITaskbarList3::SetOverlayIcon. It updates the icon every second. You can easily adjust it to fit your own needs. Let me know if it works for you! #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIIcons.au3> Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " Line: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) EndFunc ; Define ITaskbarList3 COM interface Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" Global Const $sIID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}" Global Const $tagITaskbarList3 = _ "HrInit hresult();" & _ "AddTab hresult(hwnd);" & _ "DeleteTab hresult(hwnd);" & _ "ActivateTab hresult(hwnd);" & _ "SetActiveAlt hresult(hwnd);" & _ "MarkFullscreenWindow hresult(hwnd;boolean);" & _ "SetProgressValue hresult(hwnd;uint64;uint64);" & _ "SetProgressState hresult(hwnd;int);" & _ "RegisterTab hresult(hwnd;hwnd);" & _ "UnregisterTab hresult(hwnd);" & _ "SetTabOrder hresult(hwnd;hwnd);" & _ "SetTabActive hresult(hwnd;hwnd;dword);" & _ "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarSetImageList hresult(hwnd;ptr);" & _ "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _ "SetThumbnailTooltip hresult(hwnd;wstr);" & _ "SetThumbnailClip hresult(hwnd;ptr);" ; Global variables Global $hGraphic, $hTextBrush, $hFormat, $hFamily, $hFont, $hBackgroundBrush, $hPen Global $oList, $hWnd Global $iWidth = 32, $iHeight = 32, $iFontSize = 12 Global $iCounter = 0 Main() Func Main() _GDIPlus_Startup() $hWnd = GUICreate("Taskbar Overlay Icon Test", 400, 300) Local $label = GUICtrlCreateLabel("Starting...", 10, 10, 380, 100) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hTextBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize) $hBackgroundBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000) $hPen = _GDIPlus_PenCreate(0xFF000000, 2) $oList = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList3, $tagITaskbarList3) If Not IsObj($oList) Then MsgBox(16, "Error", "Failed to initialize ITaskbarList3.") Exit EndIf $oList.HrInit() If @error Then MsgBox(16, "Error", "HrInit failed: " & @error) Exit EndIf GUICtrlSetData($label, "$oList.AddTab") $oList.AddTab($hWnd) If @error Then MsgBox(16, "Error", "Failed to add taskbar tab: " & @error) Exit EndIf _UpdateOverlayIcon($iCounter) GUICtrlSetData($label, "Overlay icon initialized with counter: " & $iCounter) Local $hTimer = TimerInit() While 1 If TimerDiff($hTimer) > 1000 Then $iCounter += 1 If $iCounter > 99 Then $iCounter = 99 _UpdateOverlayIcon($iCounter) GUICtrlSetData($label, "Counter: " & $iCounter) $hTimer = TimerInit() EndIf If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop Sleep(10) WEnd GUICtrlSetData($label, "Removing overlay icon and tab") _Taskbar_SetOverlayIcon($oList, $hWnd, Null, "") $oList.DeleteTab($hWnd) $oList = 0 _GDIPlus_FontDispose($hFont) _GDIPlus_PenDispose($hPen) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hTextBrush) _GDIPlus_BrushDispose($hBackgroundBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc Func _UpdateOverlayIcon($iCount) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $GDIP_PXF32ARGB) Local $hGraphicBitmap = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphicBitmap, 2) _GDIPlus_GraphicsClear($hGraphicBitmap, 0x00000000) _GDIPlus_GraphicsFillEllipse($hGraphicBitmap, 0, 0, $iWidth - 2, $iHeight - 2, $hBackgroundBrush) _GDIPlus_GraphicsDrawEllipse($hGraphicBitmap, 0, 0, $iWidth - 2, $iHeight - 2, $hPen) Local $tLayout = _GDIPlus_RectFCreate(2, 2, $iWidth - 4, $iHeight - 8) DrawStringCentered($hGraphicBitmap, $iCount, $hFont, $tLayout, $hFormat, $hTextBrush) Local $hIcon = _GDIPlus_HICONCreateFromBitmap($hBitmap) If @error Then MsgBox(16, "Error", "Failed to create HICON: " & @error) Exit EndIf _Taskbar_SetOverlayIcon($oList, $hWnd, $hIcon, "Counter: " & $iCount) _WinAPI_DestroyIcon($hIcon) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphicBitmap) EndFunc Func DrawStringCentered($hGraphic, $iIndex, $hFont, $tLayout, $hFormat, $hTextBrush) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $iIndex, $hFont, $tLayout, $hFormat) Local $tIndex = $aInfo[0] $tIndex.X = $tLayout.X + (($tLayout.Width - $tIndex.Width) / 2) $tIndex.Y = $tLayout.Y + (($tLayout.Height - _GDIPlus_FontGetHeight($hFont, $hGraphic)) / 2) _GDIPlus_GraphicsDrawStringEx($hGraphic, $iIndex, $hFont, $tIndex, $hFormat, $hTextBrush) EndFunc Func _Taskbar_SetOverlayIcon(ByRef $oTB, $hWnd, $hIcon, $sAltText = "") Local $vRet = $oTB.SetOverlayIcon($hWnd, $hIcon, $sAltText) If @error Then Return SetError(@error, @extended, False) If $vRet = 0 Then Return True Return SetError($vRet, 0, False) EndFunc3 points
-
Make active transparent icon on image background
argumentum and 2 others reacted to UEZ for a topic
I have thought again and this is simpler and the better solution. #NoTrayIcon ;#RequireAdmin #include <WinAPISys.au3> #include <GDIPlus.au3> #include <WinAPIShellEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> Example() Func Example() Local $hGUI, $hGraphic, $hIcon, $hBitmap, $iX = 768, $iY = 525 $hGUI = GUICreate("GDI+", $iX, $iY) _GDIPlus_Startup() ; Create GUI Global $idPic = GUICtrlCreatePic("", 0, 0, $iX, $iY) Global $sFileName = @ScriptDir& "\MAIN.png" $hImage = _GDIPlus_ImageLoadFromFile($sFileName) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) $hBGImage = _GDIPlus_BitmapCreateFromScan0($iX, $iY) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBGImage) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) $btnx = 250 $btny = 150 ;_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 221, 48, 48) $hBitmap = _GDIPlus_BitmapCreateFromHICON32($hIcon) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, $btnx, $btny) $shBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBGImage) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, 0x0172, 0, $shBitmap)) ; STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0 GUICtrlSetState($idPic, $gui_disable) GUICtrlSetState(-1, $GUI_ONTOP) GUICtrlSetCursor(-1, 0) $hIcon = GUICtrlCreateIcon(@SystemDir & '\shell32.dll', -1, $btnx, $btny, 48, 48, BitOR($SS_NOTIFY, $SS_BLACKRECT)) GUISetState() ; Loop until user exits Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hIcon ConsoleWrite("Icon clicked" & @CRLF) EndSwitch Until False ; Clean up resources _WinAPI_DestroyIcon($hIcon) _WinAPI_DeleteObject($shBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_BitmapDispose($hBGImage) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example3 points -
The Experimental Autoit RPGenerator (IRC MOPRG Project) Python - Autoit - mIRC
argumentum and 2 others reacted to coderusa for a topic
Hey guys. Sorry for the lapse in updates. Been pecking away little by little at some RPG stuff, slow progress but still progress. Situation with my daughter is nearing it's foreseeable end, she'll be home in a couple weeks and once she gets settled in and the final motions are filed things will ease up greatly and I'll be able to focus more on RPG stuff and programming stuff in general. I've been jotting things down and working on some little things lately as I've been very busy in life lately, but its been for a good cause and worth the effort! Do not worry, I've not stopped or forgotten about RPGenerator! Just been slow moving as I've had to move this project down my priority list more than I anticipated.3 points -
Here the version to choose the drive letter: ;Coded by UEZ build 2025-06-11 beta #RequireAdmin #include <WinAPIHObj.au3> #include <WinAPIFiles.au3> Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT = '{EC984AEC-A0F9-47E9-901F-71415A66345B}' Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_UNKNOWN = '{00000000-0000-0000-0000-000000000000}' ;VIRTUAL_STORAGE_TYPE -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Enum $VIRTUAL_STORAGE_TYPE_DEVICE_UNKNOWN = 0, $VIRTUAL_STORAGE_TYPE_DEVICE_ISO, $VIRTUAL_STORAGE_TYPE_DEVICE_VHD, $VIRTUAL_STORAGE_TYPE_DEVICE_VHDX ;VIRTUAL_DISK_ACCESS_MASK -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-virtual_disk_access_mask-r1 Global Enum $VIRTUAL_DISK_ACCESS_NONE = 0, $VIRTUAL_DISK_ACCESS_ATTACH_RO = 0x00010000, $VIRTUAL_DISK_ACCESS_ATTACH_RW = 0x00020000, $VIRTUAL_DISK_ACCESS_DETACH = 0x00040000, _ $VIRTUAL_DISK_ACCESS_GET_INFO = 0x00080000, $VIRTUAL_DISK_ACCESS_CREATE = 0x00100000, $VIRTUAL_DISK_ACCESS_METAOPS = 0x00200000, $VIRTUAL_DISK_ACCESS_READ = 0x000D0000, _ $VIRTUAL_DISK_ACCESS_ALL = 0x003F0000, $VIRTUAL_DISK_ACCESS_WRITABLE = 0x00320000 ;OPEN_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_flag Global Enum $OPEN_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS = 0x00000001, $OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE = 0x00000002, $OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE = 0x00000004, _ $OPEN_VIRTUAL_DISK_FLAG_CACHED_IO = 0x00000008, $OPEN_VIRTUAL_DISK_FLAG_CUSTOM_DIFF_CHAIN = 0x00000010, $OPEN_VIRTUAL_DISK_FLAG_PARENT_CACHED_IO = 0x00000020, $OPEN_VIRTUAL_DISK_FLAG_VHDSET_FILE_ONLY = 0x00000040, _ $OPEN_VIRTUAL_DISK_FLAG_IGNORE_RELATIVE_PARENT_LOCATOR = 0x00000080, $OPEN_VIRTUAL_DISK_FLAG_NO_WRITE_HARDENING = 0x00000100, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_COMPRESSED_VOLUMES, _ $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_SPARSE_FILES_ANY_FS, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_ENCRYPTED_FILES ;ATTACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-attach_virtual_disk_flag Global Enum $ATTACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY = 0x00000001, $ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER = 0x00000002, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME = 0x00000004, _ $ATTACH_VIRTUAL_DISK_FLAG_NO_LOCAL_HOST = 0x00000008, $ATTACH_VIRTUAL_DISK_FLAG_NO_SECURITY_DESCRIPTOR = 0x00000010, $ATTACH_VIRTUAL_DISK_FLAG_BYPASS_DEFAULT_ENCRYPTION_POLICY = 0x00000020, _ $ATTACH_VIRTUAL_DISK_FLAG_NON_PNP, $ATTACH_VIRTUAL_DISK_FLAG_RESTRICTED_RANGE, $ATTACH_VIRTUAL_DISK_FLAG_SINGLE_PARTITION, $ATTACH_VIRTUAL_DISK_FLAG_REGISTER_VOLUME, $ATTACH_VIRTUAL_DISK_FLAG_AT_BOOT ;OPEN_VIRTUAL_DISK_VERSION -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_version Global Enum $OPEN_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, $OPEN_VIRTUAL_DISK_VERSION_1, $OPEN_VIRTUAL_DISK_VERSION_2, $OPEN_VIRTUAL_DISK_VERSION_3 Global Enum $DETACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000 ;DETACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-detach_virtual_disk_flag Global Const $tagOPEN_VIRTUAL_DISK_PARAMETERS = "dword Version;dword RWDepth" ;"ulong Data1;ushort Data2;ushort Data3;ubyte Data4[8]" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Const $tagVIRTUAL_STORAGE_TYPE = "ulong DeviceId;byte VendorId[16]" ;https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-security_descriptor Global Const $tagSECURITY_DESCRIPTOR = "byte Revision;byte Sbz1;ushort Control;ptr Owner;ptr Group;ptr Sacl;ptr Dacl;" ;https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-overlapped ;Global Const $tagOVERLAPPED = "ptr Internal;ptr InternalHigh;dword Offset;dword OffsetHigh;ptr hEvent" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-attach_virtual_disk_parameters Global Const $tagATTACH_VIRTUAL_DISK_PARAMETERS = "dword Version;" & _ ; ATTACH_VIRTUAL_DISK_VERSION enum "uint Reserved;" & _ ; Nur bei Version1 "uint64 RestrictedOffset;" & _ ; Nur bei Version2 "uint64 RestrictedLength;" ; Nur bei Version2 ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-openvirtualdisk Func _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, $sPath, $VIRTUAL_DISK_ACCESS_MASK = 0, $OPEN_VIRTUAL_DISK_FLAG = 0, $tOPEN_VIRTUAL_DISK_PARAMETERS = 0) If Not FileExists($sPath) Then SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "OpenVirtualDisk", "struct*", $tVIRTUAL_STORAGE_TYPE, "wstr", $sPath, "ulong", $VIRTUAL_DISK_ACCESS_MASK, "ulong", $OPEN_VIRTUAL_DISK_FLAG, "struct*", $tOPEN_VIRTUAL_DISK_PARAMETERS, "handle*", 0) If @error Then Return SetError(2, 0, 0) Return $aReturn[6] EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-attachvirtualdisk Func _WinAPI_AttachVirtualDisk($hVD, $tSECURITY_DESCRIPTOR, $ATTACH_VIRTUAL_DISK_FLAG, $ProviderSpecificFlags, $tATTACH_VIRTUAL_DISK_PARAMETERS = Null, $tOVERLAPPED = Null) If Not $hVD Then Return SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "AttachVirtualDisk", "handle", $hVD, "struct*", $tSECURITY_DESCRIPTOR, "ulong", $ATTACH_VIRTUAL_DISK_FLAG, "ulong", $ProviderSpecificFlags, "struct*", $tATTACH_VIRTUAL_DISK_PARAMETERS, "struct*", $tOVERLAPPED) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-detachvirtualdisk Func _WinAPI_DetachVirtualDisk($hVD, $iFlags = $DETACH_VIRTUAL_DISK_FLAG_NONE, $ProviderSpecificFlags = 0) Local $aCall = DllCall("VirtDisk.dll", "dword", "DetachVirtualDisk", "handle", $hVD, "long", $iFlags, "ulong", $ProviderSpecificFlags) If @error Then Return SetError(1, 0, 0) If $aCall[0] <> 0 Then Return SetError(2, $aCall[0], 0) Return 1 EndFunc ;https://learn.microsoft.com/de-de/windows/win32/api/virtdisk/nf-virtdisk-getvirtualdiskphysicalpath Func _WinAPI_GetVirtualDiskPhysicalPath($hVD) If Not $hVD Then Return SetError(1, 0, 0) Local $tPhysicalDrive = DllStructCreate("wchar physicalDrive[260]") Local $aReturn = DllCall("VirtDisk.dll", "dword", "GetVirtualDiskPhysicalPath", "handle", $hVD, "ulong*", DllStructGetSize($tPhysicalDrive), "struct*", $tPhysicalDrive) If @error Then Return SetError(2, 0, 0) Return $tPhysicalDrive.physicalDrive EndFunc Global $sISOFile = FileOpenDialog("Select an ISO file to mount", "", "ISO (*.iso)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST)) If @error Then Exit Global $tVIRTUAL_STORAGE_TYPE = DllStructCreate($tagVIRTUAL_STORAGE_TYPE) $tVIRTUAL_STORAGE_TYPE.DeviceId = $VIRTUAL_STORAGE_TYPE_DEVICE_ISO $tVIRTUAL_STORAGE_TYPE.VendorId = Binary("0xEC984AECA0F947E9901F71415A66345B") ;$VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT Global $tOPEN_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagOPEN_VIRTUAL_DISK_PARAMETERS) $tOPEN_VIRTUAL_DISK_PARAMETERS.Version = $OPEN_VIRTUAL_DISK_VERSION_1 $tOPEN_VIRTUAL_DISK_PARAMETERS.RWDepth = 0 Global $tATTACH_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagATTACH_VIRTUAL_DISK_PARAMETERS) $tATTACH_VIRTUAL_DISK_PARAMETERS.Version = $OPEN_VIRTUAL_DISK_VERSION_1 Global $sDrvLetter = "z:\" Global $hMountISO = _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, _ $sISOFile, _ BitOR($VIRTUAL_DISK_ACCESS_READ, $VIRTUAL_DISK_ACCESS_ATTACH_RO, $VIRTUAL_DISK_ACCESS_GET_INFO), _ $OPEN_VIRTUAL_DISK_FLAG_NONE, _ $tOPEN_VIRTUAL_DISK_PARAMETERS) If Not $hMountISO Then Exit MsgBox($MB_ICONERROR, "ERROR", "Something went wrong opening ISO!") If _WinAPI_AttachVirtualDisk($hMountISO, _ 0, _ BitOR($ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, $ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER), _ 0, _ $tATTACH_VIRTUAL_DISK_PARAMETERS) Then Global $sPhysicalDrive = _WinAPI_GetVirtualDiskPhysicalPath($hMountISO) If StringRight($sPhysicalDrive, 1) <> "\" Then $sPhysicalDrive &= "\" Global $sVolumeNameGUID = _WinAPI_GetVolumeNameForVolumeMountPoint($sPhysicalDrive) If StringRight($sVolumeNameGUID, 1) <> "\" Then $sVolumeNameGUID &= "\" _WinAPI_SetVolumeMountPoint($sDrvLetter, $sVolumeNameGUID) MsgBox(0, "TEST ISO Mounting", "ISO mounted to drive letter " & $sDrvLetter & " - checkout Windows Explorer") Else MsgBox($MB_ICONERROR, "ERROR", "Something went wrong attaching ISO!") EndIf If $hMountISO Then _WinAPI_DeleteVolumeMountPoint($sDrvLetter) _WinAPI_DetachVirtualDisk($hMountISO) _WinAPI_CloseHandle($hMountISO) EndIf Check out variable $sDrvLetter3 points
-
WebP v0.3.9 build 2025-07-07 beta
pixelsearch and one other reacted to UEZ for a topic
Hi @pixelsearch thank again for your feedback. Regarding 1) my bad. The example 08 doesn't contain a check if creation fails - it just proceeds. Easy to fix: Global $sFile = @ScriptDir & "\TestAnim.webp" Global $iResult = WebP_CreateWebPCreateAnim($aFrames, $sFile) If $iResult < 1 Or @error Then ConsoleWrite($iResult & " / " & @error & @CRLF) _GDIPlus_Shutdown() Exit MsgBox($MB_ICONERROR, "Error", "Something went wrong creating the animation!") EndIf 2) to be honest - I'm too lazy to create a GUI with all parameters. I'm not sure if all the parameters are required or will ever be needed, but I'm happy to include this as Example08.1.au3. It would only make sense if the value range per parameter was listed in the GUI. The ranges should be described in the UDF header.2 points -
WebP v0.3.9 build 2025-07-07 beta
pixelsearch and one other reacted to UEZ for a topic
Updated to v0.3.8 build 2025-07-04 beta added loop count parameter for the 3 animation functions. Default = 0 which is endless. added WebP_GetImagesDiffFromFile() which can compare two WebP files which same dimension2 points -
Is it possible to add separator (horizontal line) to ComboBox list?
argumentum and one other reacted to WildByDesign for a topic
There are some great responses and creative ideas here. Thank you all so much. I apologize for my delay in responding. I hope that I don’t seem rude for the delay. I had moved forward with other parts of the GUI while my mind (and ideas) was fresh. Later today I am going to return to this important part of my GUI and I will try the various ideas. Once I get a chance to try them, I will respond here to each of your ideas. As always, I am grateful for your time and your help.2 points -
Using Melba23 post here as a guide (Thanks for the enlightenment) I managed to get this far A Autocomplete selector for existing tags #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <WinAPI.au3> #include <GuiListBox.au3> ; Global Variables Global $g_hMainGUI Global $g_idEditInputTags Global $g_idListboxSuggestions Global $g_hListboxSuggestionsHWND Global $g_aAvailableTags Global $g_iCurrentSuggestionIndex = -1 ; Dummy control IDs for accelerators (Listbox Navigation Key) Global $g_idAccelUp, $g_idAccelDown, $g_idAccelEnter, $g_idAccelEscape ; Load all unique tags from database $g_aAvailableTags = _GetAllUniqueTags() If @error Then MsgBox(16, "Error", "Failed to load unique tags from database.") _CreateGUI() ; Create Main GUI Exit ;--------------------------------------------------------------------------------------- Func _GetAllUniqueTags() ; This function should retrieve your actual unique tags from a database or file. ; For demonstration, it reads words from a text file. Local $sString = StringLower(FileRead("C:\Program Files (x86)\AutoIt3\SciTE\SciTE Jump\License.txt")) ; matches sequences of letters that are at least 4 characters long Local $aWords = StringRegExp($sString, '[a-zA-Z]{4,}', 3) $aWords = _ArrayUnique($aWords) ; This removes the count element from the array returned by StringRegExp with flag 3. If UBound($aWords) > 0 Then _ArrayDelete($aWords, 0) _ArraySort($aWords) Return $aWords EndFunc ;==>_GetAllUniqueTags ;--------------------------------------------------------------------------------------- Func _CreateGUI() $g_hMainGUI = GUICreate("Main GUI", 700, 300) GUICtrlCreateLabel("Title:", 10, 20, 50, 20) Local $idTitle = GUICtrlCreateInput("", 70, 20, 600, 25) GUICtrlCreateLabel("Tags:", 10, 60, 50, 20) $g_idEditInputTags = GUICtrlCreateInput("", 70, 60, 600, 25, $ES_AUTOVSCROLL) GUICtrlSetLimit($g_idEditInputTags, 250) Local $aPos = ControlGetPos($g_hMainGUI, "", $g_idEditInputTags) If @error Then Exit MsgBox(16, "Error", "Failed to get position of Tags input control. Exiting.") ; Suggestions Listbox $g_idListboxSuggestions = GUICtrlCreateList("", $aPos[0], $aPos[1] + $aPos[3], $aPos[2], 150, BitOR($LBS_NOTIFY, $WS_VSCROLL, $WS_BORDER, $WS_TABSTOP)) GUICtrlSetState($g_idListboxSuggestions, $GUI_HIDE) $g_hListboxSuggestionsHWND = GUICtrlGetHandle($g_idListboxSuggestions) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND_Handler") GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL_Handler") $g_idAccelUp = GUICtrlCreateDummy() $g_idAccelDown = GUICtrlCreateDummy() $g_idAccelEnter = GUICtrlCreateDummy() $g_idAccelEscape = GUICtrlCreateDummy() Local $AccelKeys[4][2] = [ _ ["{UP}", $g_idAccelUp], _ ["{DOWN}", $g_idAccelDown], _ ["{ENTER}", $g_idAccelEnter], _ ["{ESCAPE}", $g_idAccelEscape] _ ] GUISetAccelerators($AccelKeys) Local $idExit = GUICtrlCreateButton("Exit", 300, 250, 100, 30) GUISetState(@SW_SHOW) Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE, $idExit ExitLoop Case $g_idAccelUp _ListboxNavigationKey($g_idAccelUp) Case $g_idAccelDown _ListboxNavigationKey($g_idAccelDown) Case $g_idAccelEnter _ListboxNavigationKey($g_idAccelEnter) Case $g_idAccelEscape _ListboxNavigationKey($g_idAccelEscape) EndSwitch WEnd GUIDelete($g_hMainGUI) EndFunc ;==>_CreateGUI ;--------------------------------------------------------------------------------------- Func _ApplySelectedTag($sSelectedTag) If $sSelectedTag = "" Then Return Local $sCurrentTags = GUICtrlRead($g_idEditInputTags) If @error Then Return Local $iLastCommaPos = StringInStr($sCurrentTags, ",", 0, -1) ; Find the last comma Local $sPrefixToKeep = "" If $iLastCommaPos > 0 Then $sPrefixToKeep = StringLeft($sCurrentTags, $iLastCommaPos) $sPrefixToKeep = StringStripWS($sPrefixToKeep, $STR_STRIPTRAILING) & " " EndIf Local $sNewTags = $sPrefixToKeep & $sSelectedTag & ", " GUICtrlSetData($g_idEditInputTags, $sNewTags) If @error Then Return _HideSuggestions() GUICtrlSetState($g_idEditInputTags, $GUI_FOCUS) If @error Then Return _WinAPI_PostMessage(GUICtrlGetHandle($g_idEditInputTags), $EM_SETSEL, StringLen($sNewTags), StringLen($sNewTags)) $g_iCurrentSuggestionIndex = -1 EndFunc ;==>_ApplySelectedTag ;--------------------------------------------------------------------------------------- Func _ShowSuggestions($sCurrentInput) Local $sTrimmedInput = StringStripWS($sCurrentInput, $STR_STRIPLEADING + $STR_STRIPTRAILING) If $sTrimmedInput = "" Then Return _HideSuggestions() Local $aInputParts = StringSplit($sTrimmedInput, ",", $STR_NOCOUNT) Local $sLastPart = "" If UBound($aInputParts) > 0 Then $sLastPart = StringStripWS($aInputParts[UBound($aInputParts) - 1], $STR_STRIPLEADING + $STR_STRIPTRAILING) Else $sLastPart = $sTrimmedInput EndIf If $sLastPart = "" Then Return _HideSuggestions() Local $aFilteredSuggestions[0] Local $iCount = 0 Local $iLenLastPart = StringLen($sLastPart) For $sTag In $g_aAvailableTags If $sTag <> "" And StringLen($sTag) >= $iLenLastPart And StringLeft($sTag, $iLenLastPart) = $sLastPart Then _ArrayAdd($aFilteredSuggestions, $sTag) $iCount += 1 EndIf Next If $iCount > 0 Then GUICtrlSendMsg($g_idListboxSuggestions, $LB_RESETCONTENT, 0, 0) For $sSuggestion In $aFilteredSuggestions If $sSuggestion <> "" Then GUICtrlSendMsg($g_idListboxSuggestions, $LB_ADDSTRING, 0, $sSuggestion) EndIf Next GUICtrlSetState($g_idListboxSuggestions, $GUI_SHOW) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, 0, 0) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, 0, 0) $g_iCurrentSuggestionIndex = 0 Else _HideSuggestions() EndIf EndFunc ;==>_ShowSuggestions ;--------------------------------------------------------------------------------------- Func _HideSuggestions() GUICtrlSetState($g_idListboxSuggestions, $GUI_HIDE) GUICtrlSendMsg($g_idListboxSuggestions, $LB_RESETCONTENT, 0, 0) $g_iCurrentSuggestionIndex = -1 EndFunc ;==>_HideSuggestions ;--------------------------------------------------------------------------------------- Func _ListboxNavigationKey($idKey) If Not BitAND(GUICtrlGetState($g_idListboxSuggestions), $GUI_SHOW) Then Return Local $iCount = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCOUNT, 0, 0) If $iCount = 0 Then Return Switch $idKey Case $g_idAccelUp If $g_iCurrentSuggestionIndex <= 0 Then $g_iCurrentSuggestionIndex = $iCount - 1 Else $g_iCurrentSuggestionIndex -= 1 EndIf GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, $g_iCurrentSuggestionIndex, 0) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, $g_iCurrentSuggestionIndex, 0) Case $g_idAccelDown If $g_iCurrentSuggestionIndex >= $iCount - 1 Then $g_iCurrentSuggestionIndex = 0 Else $g_iCurrentSuggestionIndex += 1 EndIf GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, $g_iCurrentSuggestionIndex, 0) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, $g_iCurrentSuggestionIndex, 0) Case $g_idAccelEnter Local $iIndex = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) If $iIndex <> $LB_ERR Then Local $sSelectedTag = _GUICtrlListBox_GetText($g_idListboxSuggestions, $iIndex) If $sSelectedTag <> "" Then _ApplySelectedTag($sSelectedTag) EndIf Else _HideSuggestions() EndIf $g_iCurrentSuggestionIndex = -1 Case $g_idAccelEscape _HideSuggestions() $g_iCurrentSuggestionIndex = -1 EndSwitch EndFunc ;==>_ListboxNavigationKey ;--------------------------------------------------------------------------------------- Func _WM_COMMAND_Handler($hWnd, $iMsg, $wParam, $lParam) Local $iControlID = _WinAPI_LoWord($wParam) Local $iNotificationCode = _WinAPI_HiWord($wParam) Switch $iMsg Case $WM_COMMAND Switch $iControlID Case $g_idEditInputTags Switch $iNotificationCode Case $EN_CHANGE Local $sCurrentInput = GUICtrlRead($g_idEditInputTags) _ShowSuggestions($sCurrentInput) Case $EN_KILLFOCUS Sleep(50) Local $hFocusedWindow = _WinAPI_GetFocus() Local $hListboxSuggestionsHandle = GUICtrlGetHandle($g_idListboxSuggestions) Local $hEditInputTagsHandle = GUICtrlGetHandle($g_idEditInputTags) If $hFocusedWindow <> $hListboxSuggestionsHandle And $hFocusedWindow <> $hEditInputTagsHandle Then _HideSuggestions() Local $sCurrentTags = GUICtrlRead($g_idEditInputTags) If StringRight($sCurrentTags, 2) = ", " Then GUICtrlSetData($g_idEditInputTags, StringTrimRight($sCurrentTags, 2)) ElseIf StringRight($sCurrentTags, 1) = "," Then GUICtrlSetData($g_idEditInputTags, StringTrimRight($sCurrentTags, 1)) EndIf EndIf EndSwitch Case $g_idListboxSuggestions Switch $iNotificationCode Case $LBN_SELCHANGE Local $iIndex = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) If $iIndex <> $LB_ERR Then Local $sSelectedTag = _GUICtrlListBox_GetText($g_idListboxSuggestions, $iIndex) If $sSelectedTag <> "" Then _ApplySelectedTag($sSelectedTag) EndIf EndIf Case $LBN_DBLCLK Local $iIndex = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) If $iIndex <> $LB_ERR Then Local $sSelectedTag = _GUICtrlListBox_GetText($g_idListboxSuggestions, $iIndex) If $sSelectedTag <> "" Then _ApplySelectedTag($sSelectedTag) EndIf EndIf EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND_Handler ;--------------------------------------------------------------------------------------- Func _WM_MOUSEWHEEL_Handler($hWnd, $iMsg, $wParam, $lParam) ; Using GUIGetCursorInfo to find the control under the mouse Local $aCursorInfo = GUIGetCursorInfo($g_hMainGUI) ; Check if the mouse is over the suggestions ListBox and if the ListBox is visible If Not @error And IsArray($aCursorInfo) And UBound($aCursorInfo) >= 5 And $aCursorInfo[4] = $g_idListboxSuggestions And BitAND(GUICtrlGetState($g_idListboxSuggestions), $GUI_SHOW) Then Local $iDelta = _WinAPI_HiWord($wParam) ; How much the wheel turned (120 for a "click" up, -120 for a "click" down) Local $iNumLinesToScroll = 1 ; We scroll one line at a time with the wheel Local $iCurrentSelection = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) Local $iTotalItems = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCOUNT, 0, 0) If $iTotalItems <= 0 Then Return 1 ; No items, nothing to scroll or select If $iDelta > 0 Then ; Scroll Up (wheel up) If $iCurrentSelection > 0 Then $g_iCurrentSuggestionIndex = $iCurrentSelection - $iNumLinesToScroll If $g_iCurrentSuggestionIndex < 0 Then $g_iCurrentSuggestionIndex = 0 Else $g_iCurrentSuggestionIndex = 0 ; Already at the top EndIf Else ; Scroll Down (wheel down) If $iCurrentSelection < $iTotalItems - 1 Then $g_iCurrentSuggestionIndex = $iCurrentSelection + $iNumLinesToScroll If $g_iCurrentSuggestionIndex >= $iTotalItems Then $g_iCurrentSuggestionIndex = $iTotalItems - 1 Else $g_iCurrentSuggestionIndex = $iTotalItems - 1 ; Already at the bottom EndIf EndIf ; We define the new option GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, $g_iCurrentSuggestionIndex, 0) ; Also, make the selected element visible (if it isn't already) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, $g_iCurrentSuggestionIndex, 0) Return 1 ; Message has been handled EndIf Return $GUI_RUNDEFMSG ; Let AutoIt handle the message for other controls EndFunc ;==>_WM_MOUSEWHEEL_Handler Please, every comment is appreciated! leave your comments and experiences here! Thank you very much2 points
-
Is it possible to add separator (horizontal line) to ComboBox list?
WildByDesign and one other reacted to ioa747 for a topic
following the instructions of argumentum I got this far #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $g_idListView Global $g_bListViewVisible = False Global $g_InputCombo _MainGUI() Func _MainGUI() Local $hGUI = GUICreate("fake combo", 364, 250) Local $iX = 65, $iY = 30, $iW = 150, $iH = 21 ; fake combo $g_InputCombo = GUICtrlCreateInput("", $iX, $iY, $iW, $iH) Local $idBtnCombo = GUICtrlCreateButton("🔻", $iX + $iW, $iY - 1, $iH + 2, $iH + 2) ; ListView $g_idListView = GUICtrlCreateListView("", $iX, $iY + $iH, $iW + $iH, 180, BitOR($LVS_NOCOLUMNHEADER, $LVS_REPORT), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TRACKSELECT)) GUICtrlSetState($g_idListView, $GUI_HIDE) ; hidden ; Add columns _GUICtrlListView_AddColumn($g_idListView, "", $iW) ; Enable group view _GUICtrlListView_EnableGroupView($g_idListView) ; Group 1 _GUICtrlListView_InsertGroup($g_idListView, -1, 1, "Fruits") _GUICtrlListView_AddItem($g_idListView, "Apple") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 1) _GUICtrlListView_AddItem($g_idListView, "Banana") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 1) ; Group 2 _GUICtrlListView_InsertGroup($g_idListView, -1, 2, "Vegetables") _GUICtrlListView_AddItem($g_idListView, "Carrot") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 2) _GUICtrlListView_AddItem($g_idListView, "Spinach") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 2) ; Group 3 _GUICtrlListView_InsertGroup($g_idListView, -1, 3, "Dairy") _GUICtrlListView_AddItem($g_idListView, "Milk") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 3) ; Register the message handler GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idBtnCombo ; Toggle ListView visibility If Not $g_bListViewVisible Then GUICtrlSetState($g_idListView, $GUI_SHOW + $GUI_FOCUS) $g_bListViewVisible = True Else GUICtrlSetState($g_idListView, $GUI_HIDE) $g_bListViewVisible = False EndIf EndSwitch WEnd EndFunc ;==>_MainGUI ;--------------------------------------------------------------------------------------- Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndListView = GUICtrlGetHandle($g_idListView) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK Local $iIndex = _GUICtrlListView_GetSelectionMark($g_idListView) ; Get the index of the last selected item ; Ensure a valid item was selected If $iIndex <> -1 Then Local $sItemText = _GUICtrlListView_GetItemText($g_idListView, $iIndex, 0) If $sItemText <> "" Then GUICtrlSetData($g_InputCombo, $sItemText) GUICtrlSetState($g_idListView, $GUI_HIDE) GUICtrlSetState($g_InputCombo, $GUI_FOCUS) $g_bListViewVisible = False EndIf EndIf Return 0 Case $NM_DBLCLK Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ;--------------------------------------------------------------------------------------- Edit: Normally it would require handling $WM_KILLFOCUS and keyboard navigation, but the code would grow. Just the central idea2 points -
Hello everyone, I'm pleased to share a UDF I developed to work with IWICImagingFactory from the Windows Imaging Component (WIC), focused exclusively on reading and writing image metadata. 🔍 Why this UDF? IWICImagingFactory is a powerful API but can also be particularly confusing when working with metadata. Its layers of abstraction, data formats, and interface complexity can easily distract you from your goals without a clear structure. 🧩 Key Features: 🔄 Read and write metadata using WIC interfaces (IWICMetadataQueryReader, IWICMetadataQueryWriter) 💾 Supports common formats (JPEG, PNG, TIFF, etc.) 🧠 Built using an object-oriented model via AutoItObject to encapsulate complexity and avoid side effects ⚠️ Full support for PROPVARIANT and VARIANT types, essential for COM interaction 🔗 Handles the WIC metadata query language (e.g., /app1/ifd/exif:{ushort=36867} for Date Taken) 📜 Works with WIC-compliant hierarchical metadata queries 🧠 Prerequisites / Recommended Knowledge Solid understanding of COM programming in AutoIt Familiarity with PROPVARIANT/VARIANT (types, conversion, init/cleanup) Knowledge of WIC metadata schema and hierarchy Comfortable with object-oriented programming in AutoIt (using AutoItObject) 🧪 Why use an object-oriented approach? IWICImagingFactory is as flexible as it is tricky. Exploring it directly can lead to unexpected behaviors or technical detours. The object-oriented approach helps contain this complexity, structure features properly, and avoid common pitfalls when dealing with raw COM interfaces. 📁 What’s Included in the UDF A main object WICImageMeta (or similar) that encapsulates the image, reader/writer, and associated interfaces Straightforward methods like .ReadMeta($sPath), .WriteMeta($sPath, $vValue, $sType), .Save($sDest), etc. Automatic resource management (Release, Cleanup) Examples for reading/writing EXIF, XMP, and other metadata 📷 Quick Usage Example #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <Array.au3> #include "IWICImagingMetadata.au3" ; This is your custom UDF for WIC metadata ; Path to a test image (replace with your own file path) Local $sFilename = @DesktopDir & "\screenshot.png" ; === 1. Create the WIC Imaging Factory === ; This is the entry point for all WIC operations Local $oFactory = _WIC_ImagingFactory() If Not IsObj($oFactory) Then MsgBox(0, "Error", "Failed to create WIC Imaging Factory") Exit EndIf ; === 2. Create a decoder from the image file === ; This will analyze the image format and prepare for frame extraction Local $oDecoder = $oFactory.createDecoderFromFileName($sFilename) If Not IsObj($oDecoder) Then MsgBox(0, "Error", "Failed to create image decoder: @error=" & @error) $oFactory = 0 Exit EndIf ; === 3. Get the first frame of the image === ; Most still images have a single frame; this retrieves it from the decoder Local $oFrame = $oFactory.createBitmapFrameDecode($oDecoder) If Not IsObj($oFrame) Then MsgBox($MB_ICONERROR, "Error", "Failed to retrieve image frame: @error=" & @error) $oDecoder = 0 $oFactory = 0 Exit EndIf ; === 4. Get a metadata query reader from the frame === ; This reader allows you to query metadata values using WIC metadata paths Local $oQueryReader = $oFactory.getMetadataQueryReader($oFrame) If Not IsObj($oQueryReader) Then MsgBox(0, "Error", "Failed to get metadata query reader: @error=" & @error) $oFrame = 0 $oDecoder = 0 $oFactory = 0 Exit EndIf ; === 5. Enumerate available metadata names === ; This step is crucial to explore what metadata is actually present. ; It returns an array of metadata query paths that can be used. Local $aNames = $oFactory.enumerateMetaDataNames($oQueryReader) If @error Then ConsoleWrite("Error: Failed to enumerate metadata names: @error=" & @error & @CRLF) Else ConsoleWrite("Available metadata names: " & _ArrayToString($aNames, "|") & @CRLF) EndIf ; === 6. Read a specific metadata value === ; In this case, we're trying to read a textual field: "Creation Time" in a PNG tEXt chunk Local $sQuery = "/tEXt/{str=Creation Time}" Local $vData = $oFactory.queryMetadataByName($oQueryReader, $sQuery) If Not @error Then ConsoleWrite("Metadata read: " & $sQuery & " = " & $vData & @CRLF) Else ConsoleWrite("Error: Failed to read " & $sQuery & " : @error=" & @error & @CRLF) EndIf ; === NOTE === ; If your query selects a metadata **block**, then `vData` may be another IWICMetadataQueryReader object. ; In that case, you must call `queryMetadataByName` again, passing this sub-reader to reach nested values. 💬 Conclusion If you've worked with image metadata using WIC before, you know it's a technical challenge. This UDF aims to simplify the process while preserving full control for those who need fine-grained access. Feel free to try it out, give feedback, or suggest improvements. Enjoy digging into the hidden data of your images! 📸 IWICImagingMetadata.au32 points
-
WebP v0.3.9 build 2025-07-07 beta
pixelsearch and one other reacted to UEZ for a topic
Updated to WebP v0.3.6 build 2025-07-02 beta -> you can convert now GIF animated files to WebP animated files (see Example10.au3 on my 1Drv).2 points -
One way to launch other tools while a compiled program is running would be to use a tool like this: Scite Plusbar2 points
-
Understand the request, but this is how the internals work in SciTE to be able to capture the output generated by the Script. These are things I won't be trying to change unless it is changed in the Core version supported by Neil.2 points
-
Yes, I forgot to removed these lines for the other functions but I need to add the code also for the other function with callbacks. Currently only function "WebP_CreateWebPCreateAnimFromScreenCapture" in the dll is implemented (example 9) for callback but it should be easy to add also for the other functions. I think tomorrow I will add it to the other functions, too.2 points
-
How to pin a script to the taskbar or start menu
UEZ and one other reacted to argumentum for a topic
vs. If you would like to pin the script to the taskbar ( or the start menu ), it can be done with a link. This script is an example and demonstration. The way that I go about it, is to have the script and icon with the same name. The easiest way to test this is if the post had it all in a ZIP file so, there: Example AutoIt v3 Script_v2.zip Also, it's easier to find in task manager given that you can see your icon.2 points -
GimageX updates
argumentum and one other reacted to Jon for a topic
I've updated GImageX with the latest version of the ADK. (Dec 2024 version). Don't think the ADK version was the OP's issue. But updated it anyway.2 points -
I dont see $btny used anywhere, $btnx appears to be used for both X and Y positions.2 points
-
Need help converting percentage to hex
WildByDesign and one other reacted to UEZ for a topic
I misunderstood the value but it's easy, too: Local $iIntensity = '80' ;% of the alpha channel Local $iTintColor = '0x0078D4' $iIntensity = Int($iIntensity) * 255 / 100 Local $iColor = BitOR(BitShift($iIntensity > 255 ? 255 : $iIntensity < 0 ? 0: $iIntensity, -24), Int($iTintColor)) ConsoleWrite(Hex($iColor, 8) & @CRLF) _WinAPI_DwmEnableBlurBehindWindow10($hGUI, True, $iColor)2 points -
Need help converting percentage to hex
ioa747 and one other reacted to argumentum for a topic
If all this is for coloring, there is code for all that in https://www.autoitscript.com/forum/files/file/489-my-fine-tuned-high-contrast-theme/ If is for Hex, do give the user 255% because, why not. It'd simplify your code, enlighten the user, and gives fine control ( other wise you'd have to calculate "value * 2.55" each step ) for those that are very picky with colors. I look at it as from zero to Maximum Effort !2 points -
_Msg($iUI, $sText, $sTitle = @ScriptName, $iTimeout = 3, $iOption = 0) Displays a message using different UI elements based on the specified $iUI parameter. ; https://www.autoitscript.com/forum/topic/212945-_msg/ #include <MsgBoxConstants.au3> #include <TrayConstants.au3> #include <AutoItConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name...........: _Msg ; Description....: Displays a message using different UI elements based on the specified $iUI parameter. ; Syntax.........: _Msg($iUI, $sText, $sTitle = @ScriptName, $iTimeout = 3, $iOption = 0) ; Parameters.....: $iUI - Specifies the UI element to use: ; 0 - Return - nothing ; 1 - ConsoleWrite ; 2 - MsgBox ; 3 - ToolTip ; 4 - TrayTip ; $sText - The message text to be displayed. ; $sTitle - [optional] The title of the UI element. (Default is @ScriptName) ; $iTimeout - [optional] Timeout in seconds for displaying the message. (Default is 3) ; $iOption - [optional] Options for MsgBox, ToolTip, and TrayTip. (Default is 0) ; Return values .: Success: No specific return value, function exits after display. ; Failure: None ; Example .......: _Msg(1, "Hello, this is a test message.", @ScriptName, 5) ; =============================================================================================================================== Func _Msg($iUI, $sText, $sTitle = Default, $iTimeout = 3, $iOption = 0) If $sTitle = Default Then $sTitle = @ScriptName Switch $iUI Case 0 ; ### 0 Return - Does nothing, just exits the function. Return Case 1 ; ### 1 ConsoleWrite ConsoleWrite($sTitle & ": " & $sText & @CRLF) Case 2 ; ### 2 MsgBox MsgBox($iOption, $sTitle, $sText, $iTimeout) Case 3 ; ### 3 ToolTip ToolTip($sText, Default, Default, $sTitle, $iOption) Sleep($iTimeout * 1000) ; ToolTip doesn't have built-in timeout, so we use Sleep ToolTip("") ; Clear the tooltip after the timeout Case 4 ; ### 4 TrayTip TrayTip($sTitle, $sText, $iTimeout, $iOption) Sleep($iTimeout * 1000) ; give time to display it Case Else ; ### Else case - Does nothing, just exits the function. Return EndSwitch EndFunc ;==>_Msg ; Example Usage of _Msg Function ; ### ConsoleWrite ############################################### ; ConsoleWrite Example _Msg(1, "This message appears in the AutoIt console.", "Console Output") ; ConsoleWrite Example - Information-sign icon consisting of an 'i' in a circle _Msg(1, "This is an informational message.", "> Info") ; ConsoleWrite Example - Stop-sign icon _Msg(1, "This is a error message.", "! Error") ; ConsoleWrite Example - Question-mark icon _Msg(1, "This is a question message.", "+ Question") ; ConsoleWrite Example - Exclamation-point icon _Msg(1, "This is a warning message.", "- Warning") ; ### MsgBox ############################################### ; MsgBox Example - Information-sign icon consisting of an 'i' in a circle _Msg(2, "This is an informational message box.", "Info", 3, $MB_ICONINFORMATION) ; MsgBox Example - Stop-sign icon _Msg(2, "This is a error message box.", "Error", 3, $MB_ICONERROR) ; MsgBox Example - Question-mark icon _Msg(2, "This is a question message box.", "Question", 3, $MB_ICONQUESTION) ; MsgBox Example - Exclamation-point icon _Msg(2, "This is a warning message box.", "Warning", 3, $MB_ICONWARNING) ; ### ToolTip ############################################### ; ToolTip Example - no icon _Msg(3, "This is a question ToolTip.", "noicon", 3, $TIP_NOICON) ; ToolTip Example - Information-sign icon consisting of an 'i' in a circle _Msg(3, "This is an informational ToolTip.", "Info", 3, $TIP_INFOICON) ; ToolTip Example - error icon _Msg(3, "This is a error ToolTip.", "Error", 3, $TIP_ERRORICON) ; ToolTip Example - Warning icon _Msg(3, "This is a warning ToolTip.", "Warning", 3, $TIP_WARNINGICON) ; ### TrayTip ############################################### ; TrayTip Example - no icon _Msg(4, "This is a question TrayTip.", "noicon", 3, $TIP_ICONNONE) ; TrayTip Example - Information-sign icon consisting of an 'i' in a circle _Msg(4, "This is an informational TrayTip.", "Info", 3, $TIP_ICONASTERISK) ; TrayTip Example - error icon _Msg(4, "This is a error TrayTip.", "Error", 3, $TIP_ICONHAND) ; TrayTip Example - Warning icon _Msg(4, "This is a warning TrayTip.", "Warning", 3, $TIP_ICONEXCLAMATION) ; ################################################## ; Return Example (does nothing visible) _Msg(0, "This message will not be displayed.", "No Output") ; MsgBox Example $iTimeout = 0 _Msg(2, "All message examples have been executed.", "Examples Finished", 0)2 points
-
Another AutoIt extension for Visual Studio Code
genius257 and one other reacted to seadoggie01 for a topic
Would it instead be possible to have some sort of state such that you enable or disable the possibility of having ".Property" as valid? It seems like nested rules would be much more difficult/annoying to implement. Then again, I know very little of parsers having only ever made ~1/2 to 3/4 of one myself After skimming your parser: I might look up PegJS later tonight, but I don't think that my idea will work there. This. Is. Fantastic! 1.8.5 does fix my issue, thank you!2 points -
Another AutoIt extension for Visual Studio Code
seadoggie01 and one other reacted to genius257 for a topic
Hi @seadoggie01! Thanks for the heads up! This is due to the incomplete parser. Currently With...EndWith blocks are not supported. Anything inside the block will fail, since i haven't added any rules to it yet. The reason is that EVERY rule needs to be copied with the small change, that ".property" is a valid syntax within that or child code blocks. It is low priority, since With...EndWith is rarely seen used, but will be supported in the future at some point (depending on how urgent it is). That's an interesting bug! From quick testing, the issue seems to be caused by the empty line in the remarks: ; Remarks .......: Use like: _Acro_DocBookmarkProperties($oBookmark) to get an array of values ; ; Default means values won't be changed. My guess is some of my code is stuck in an infinite loop... I will look into it and fix it soon, since it can deadlock the extension. "Legacy" documentation blocks was implemented quick, since I'm trying to move towards the more cross language familiar docBlock syntax, but that still does not mean the code should fail this spectacularly😅 >Developer: Reload Window Should be your solution. It's not great, but faster than restarting the entire application 😉 Thank you for the kind words and the bug reporting! 😄 Edit: found the line causing problems with the function documentation: https://github.com/genius257/vscode-autoit/blob/0f1bb89f8af77ee7a005d1d5a9da429e5f344700/server/src/autoit/docBlock/DocBlockFactory.ts#L84 It's my regular expression to test if the content matches the UDF documentation format. It causes catastrophic backtracking, never getting past that regex check. Prevention in JS seems to time a new worker, child-process or a regex library, from a quick google search... I don't want to do any of that currently, so I've updated the regex, so it no longer has issues with your example, and if my test parses, I will push the change, and hope this issue does not come back 😜2 points -
Another AutoIt extension for Visual Studio Code
genius257 and one other reacted to seadoggie01 for a topic
I think I have two bugs to report. I'm currently using VS Code 1.101.0 and v1.8.4 of your extension. The extension gives an error about the With syntax found in Excel.au3 in _Excel_BookNew. The error is: Syntax error: Expected "_", [\t ], or end of line but "I" found. The extension will silently stop displaying suggestions and won't load any function documentation if you reference a file that contains function documentation that is incorrectly formatted. In my case, I was referencing my Acro.au3 file which has a split Syntax line and an empty remarks line. It requires both to stop functioning, but I haven't been able to figure out exactly what the conditions are. It looks like this: I don't always follow the "proper" documentation (due to laziness about learning it), but I don't think the extension should crash because of it It'd be fantastic if it reported an error, great if it displayed just the information it understood, and perfectly acceptable if it displayed nothing and waited for me to update the documentation to something valid (hahahahaha!) Also, if anyone knows how to quickly restart extensions, I'd love to know. I spent a while testing by deleting some code, closing, and then reopening VS Code to find this bug. The "Extensions: Refresh" does nothing in the case of this not-quite-an-error. Disabling and enabling the extension via the menu is slow, but works -- as I found out later. As always, thank you so much for your work on this extension!2 points -
Hey, could you try this code and let me know if it works for you? Here's the optimized version. Thanks!" #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <WinAPIIcons.au3> #include <WinAPIShellEx.au3> ; Constants for SetBalloonInfo ;Global Const $NIIF_NONE = 0x00000000, $NIIF_USER = 0x00000004, $NIIF_NOSOUND = 0x00000010, $NIIF_RESPECT_QUIET_TIME = 0x00000080 ; Function to create and display the notification Func CreateSystemNotification($sTitle, $sMessage, $iTimeout = 2000, $iIconIndex = 13, $sSound = "") Local $hIcon = 0, $oNotif = 0, $bSuccess = False Local Const $sCLSID_IUserNotification = "{0010890E-8789-413C-ADBC-48F5B511B3AF}" Local Const $sIID_IUserNotification = "{BA9711BA-5893-4787-A7E1-41277151550B}" Local Const $tagIUserNotification = "SetBalloonInfo long(wstr;wstr;dword);" & _ "SetBalloonRetry long(dword;dword;uint);" & _ "SetIconInfo long(ptr;wstr);" & _ "Show long(ptr;dword);" & _ "PlaySound long(wstr);" ; Create COM instance $oNotif = ObjCreateInterface($sCLSID_IUserNotification, $sIID_IUserNotification, $tagIUserNotification) If Not IsObj($oNotif) Then ConsoleWrite("Error: Failed to create COM object." & @CRLF) Return False EndIf ; Load icon Local $dwFlags = $NIIF_USER If Not IsInt($iIconIndex) Or $iIconIndex < 0 Then $iIconIndex = 13 ; Default icon Else Local $iTotal = _WinAPI_ExtractIconEx(@SystemDir & '\shell32.dll', -1, 0, 0, 0) If $iIconIndex >= $iTotal Then $iIconIndex = 13 ; Fallback to default if index is out of range EndIf EndIf $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', $iIconIndex, 32, 32) If Not $hIcon Then ConsoleWrite("Error: Failed to load icon. Switching to NIIF_NONE." & @CRLF) $dwFlags = $NIIF_NONE EndIf ; Configure notification If $sSound Then $oNotif.PlaySound($sSound) $oNotif.SetBalloonInfo($sTitle, $sMessage, BitOR($NIIF_RESPECT_QUIET_TIME, $dwFlags)) $oNotif.SetBalloonRetry(0, 0, 0) $oNotif.SetIconInfo($hIcon, $sTitle) $oNotif.Show(0, $iTimeout) $bSuccess = True ; Mark success if we reach this point ; Cleanup If $hIcon Then _WinAPI_DestroyIcon($hIcon) $oNotif = 0 ; AutoIt handles COM cleanup automatically Return $bSuccess EndFunc ;==>CreateSystemNotification ; Example usage If CreateSystemNotification("Notification Title", "This is an AutoIt message", 2000) Then ConsoleWrite("Notification displayed successfully." & @CRLF) Else ConsoleWrite("Failed to display notification." & @CRLF) EndIf2 points
-
How to write in two boxes and limit text in Edit
Keketoco00 and one other reacted to ioa747 for a topic
different approach #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WinAPIDlg.au3> _Main() Func _Main() Local $hGUI = GUICreate("Example", 250, 100) GUICtrlCreateLabel("Type name here (max 12 chars)", 20, 20) Local $idEditName = GUICtrlCreateEdit("", 20, 40, 160, 20, $ES_AUTOHSCROLL) GUICtrlSetLimit($idEditName, 12) Local $idEditResult = GUICtrlCreateEdit("", 20, 65, 160, 20, $ES_READONLY, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch ; Check if the active control is $idEditName If _WinAPI_GetDlgCtrlID(ControlGetHandle($hGUI, "", ControlGetFocus($hGUI))) = $idEditName Then Local $sValue = _InputLimiter($idEditName) If $sValue <> "" Then GUICtrlSetData($idEditResult, $sValue) EndIf WEnd EndFunc Func _InputLimiter($iCtrlInput, $iMaxBaseLength = 12, $sSuffix = "-PC") Local Static $sLastValue Local $sCurrentValue = GUICtrlRead($iCtrlInput) If $sCurrentValue <> $sLastValue Then $sLastValue = $sCurrentValue Return StringLeft($sCurrentValue, $iMaxBaseLength) & $sSuffix EndIf Return "" EndFunc Edit: variant with more advanced limiter Func _InputLimiter($iCtrlInput, $iMaxBaseLength = 12, $sSuffix = "-PC") Local Static $sLastValue Local $sCurrentValue = GUICtrlRead($iCtrlInput) Local $sFilteredValue = StringRegExpReplace($sCurrentValue, "[^a-zA-Z0-9]", "") If $sFilteredValue <> $sCurrentValue Then GUICtrlSetData($iCtrlInput, $sFilteredValue) Return "" EndIf If $sFilteredValue <> $sLastValue Then $sLastValue = $sFilteredValue ; Update static ConsoleWrite("$sCurrentValue=" & $sCurrentValue & @CRLF) ; For debugging Return StringLeft($sFilteredValue, $iMaxBaseLength) & $sSuffix EndIf Return "" EndFunc2 points -
So AutoIt does not have a good (fast) solution for things like: taking part of an array as a new array adding element(s) at the start or middle of the array In general array manipulation requires a loop, not a fast solution in AutoIt. I'm thinking using IDispatch to handle variable transfer between normal variables and the raw variant pointers. And fasm to do the array manipulation, importing the OleAut32 functions for variant manipulation. I expect this solution to be fast, and only require AutoIt and a fasm DLL, to work. My biggest issue currently is my lack of experience with ASM. I could try to throw something together, but would prefer help from someone, who actually knows what they are doing Any feedback on this idea is appreciated2 points
-
DwmColorBlurMica
water and one other reacted to WildByDesign for a topic
2 points -
How can I mount an iso image with autoit?
Keketoco00 and one other reacted to UEZ for a topic
Try this: ;Coded by UEZ build 2025-06-13 beta ;Mount ISO and let system assign drive letter. Sometimes drive letter is not assigned for unknown reason to me. ^^ #AutoIt3Wrapper_UseX64=y #include <WinAPIHObj.au3> #include <WinAPIFiles.au3> Global Const $MAX_PATH = 260 Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT = '{EC984AEC-A0F9-47E9-901F-71415A66345B}' Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_UNKNOWN = '{00000000-0000-0000-0000-000000000000}' ;VIRTUAL_STORAGE_TYPE -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Enum $VIRTUAL_STORAGE_TYPE_DEVICE_UNKNOWN = 0, $VIRTUAL_STORAGE_TYPE_DEVICE_ISO, $VIRTUAL_STORAGE_TYPE_DEVICE_VHD, $VIRTUAL_STORAGE_TYPE_DEVICE_VHDX ;VIRTUAL_DISK_ACCESS_MASK -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-virtual_disk_access_mask-r1 Global Enum $VIRTUAL_DISK_ACCESS_NONE = 0, $VIRTUAL_DISK_ACCESS_ATTACH_RO = 0x00010000, $VIRTUAL_DISK_ACCESS_ATTACH_RW = 0x00020000, $VIRTUAL_DISK_ACCESS_DETACH = 0x00040000, _ $VIRTUAL_DISK_ACCESS_GET_INFO = 0x00080000, $VIRTUAL_DISK_ACCESS_CREATE = 0x00100000, $VIRTUAL_DISK_ACCESS_METAOPS = 0x00200000, $VIRTUAL_DISK_ACCESS_READ = 0x000D0000, _ $VIRTUAL_DISK_ACCESS_ALL = 0x003F0000, $VIRTUAL_DISK_ACCESS_WRITABLE = 0x00320000 ;OPEN_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_flag Global Enum $OPEN_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS = 0x00000001, $OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE = 0x00000002, $OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE = 0x00000004, _ $OPEN_VIRTUAL_DISK_FLAG_CACHED_IO = 0x00000008, $OPEN_VIRTUAL_DISK_FLAG_CUSTOM_DIFF_CHAIN = 0x00000010, $OPEN_VIRTUAL_DISK_FLAG_PARENT_CACHED_IO = 0x00000020, $OPEN_VIRTUAL_DISK_FLAG_VHDSET_FILE_ONLY = 0x00000040, _ $OPEN_VIRTUAL_DISK_FLAG_IGNORE_RELATIVE_PARENT_LOCATOR = 0x00000080, $OPEN_VIRTUAL_DISK_FLAG_NO_WRITE_HARDENING = 0x00000100, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_COMPRESSED_VOLUMES, _ $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_SPARSE_FILES_ANY_FS, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_ENCRYPTED_FILES ;ATTACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-attach_virtual_disk_flag Global Enum $ATTACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY = 0x00000001, $ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER = 0x00000002, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME = 0x00000004, _ $ATTACH_VIRTUAL_DISK_FLAG_NO_LOCAL_HOST = 0x00000008, $ATTACH_VIRTUAL_DISK_FLAG_NO_SECURITY_DESCRIPTOR = 0x00000010, $ATTACH_VIRTUAL_DISK_FLAG_BYPASS_DEFAULT_ENCRYPTION_POLICY = 0x00000020, _ $ATTACH_VIRTUAL_DISK_FLAG_NON_PNP, $ATTACH_VIRTUAL_DISK_FLAG_RESTRICTED_RANGE, $ATTACH_VIRTUAL_DISK_FLAG_SINGLE_PARTITION, $ATTACH_VIRTUAL_DISK_FLAG_REGISTER_VOLUME, $ATTACH_VIRTUAL_DISK_FLAG_AT_BOOT ;OPEN_VIRTUAL_DISK_VERSION -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_version Global Enum $OPEN_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, $OPEN_VIRTUAL_DISK_VERSION_1, $OPEN_VIRTUAL_DISK_VERSION_2, $OPEN_VIRTUAL_DISK_VERSION_3 Global Enum $DETACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000 ;ATTACH_VIRTUAL_DISK_VERSION -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-attach_virtual_disk_version Global Enum $ATTACH_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, $ATTACH_VIRTUAL_DISK_VERSION_1 = 1, $ATTACH_VIRTUAL_DISK_VERSION_2 Global Enum $GET_VIRTUAL_DISK_INFO_UNSPECIFIED = 0, $GET_VIRTUAL_DISK_INFO_SIZE, $GET_VIRTUAL_DISK_INFO_IDENTIFIER, $GET_VIRTUAL_DISK_INFO_PARENT_LOCATION, $GET_VIRTUAL_DISK_INFO_PARENT_IDENTIFIER, _ $GET_VIRTUAL_DISK_INFO_PARENT_TIMESTAMP, $GET_VIRTUAL_DISK_INFO_VIRTUAL_STORAGE_TYPE, $GET_VIRTUAL_DISK_INFO_PROVIDER_SUBTYPE, $GET_VIRTUAL_DISK_INFO_IS_4K_ALIGNED, $GET_VIRTUAL_DISK_INFO_PHYSICAL_DISK, _ $GET_VIRTUAL_DISK_INFO_VHD_PHYSICAL_SECTOR_SIZE, $GET_VIRTUAL_DISK_INFO_SMALLEST_SAFE_VIRTUAL_SIZE, $GET_VIRTUAL_DISK_INFO_FRAGMENTATION, $GET_VIRTUAL_DISK_INFO_IS_LOADED, _ $GET_VIRTUAL_DISK_INFO_VIRTUAL_DISK_ID, $GET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE ;DETACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-detach_virtual_disk_flag Global Const $tagOPEN_VIRTUAL_DISK_PARAMETERS = "dword Version;dword RWDepth" ;"ulong Data1;ushort Data2;ushort Data3;ubyte Data4[8]" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Const $tagVIRTUAL_STORAGE_TYPE = "ulong DeviceId;byte VendorId[16]" ;https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-security_descriptor Global Const $tagSECURITY_DESCRIPTOR = "byte Revision;byte Sbz1;ushort Control;ptr Owner;ptr Group;ptr Sacl;ptr Dacl;" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-attach_virtual_disk_parameters Global Const $tagATTACH_VIRTUAL_DISK_PARAMETERS = "dword Version;" & _ ; ATTACH_VIRTUAL_DISK_VERSION enum "ulong Reserved;" & _ ; Nur bei Version1 "uint64 RestrictedOffset;" & _ ; Nur bei Version2 "uint64 RestrictedLength;" ; Nur bei Version2 Global Const $tagGET_VIRTUAL_DISK_INFO_SIZE = "dword Version;" & _ "uint64 VirtualSize;" & _ "uint64 PhysicalSize;" & _ "dword BlockSize;" & _ "dword SectorSize;" Global Const $tagGET_VIRTUAL_DISK_INFO_IDENTIFIER = "dword Version;byte Identifier[16];" ; GUID = 16 Bytes Global Const $tagGET_VIRTUAL_DISK_INFO_PARENT_LOCATION = "dword Version;bool ParentResolved;wchar ParentLocationBuffer[" & $MAX_PATH & "]" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-openvirtualdisk Func _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, $sPath, $VIRTUAL_DISK_ACCESS_MASK = 0, $OPEN_VIRTUAL_DISK_FLAG = 0, $tOPEN_VIRTUAL_DISK_PARAMETERS = 0) If Not FileExists($sPath) Then SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "OpenVirtualDisk", "struct*", $tVIRTUAL_STORAGE_TYPE, "wstr", $sPath, "ulong", $VIRTUAL_DISK_ACCESS_MASK, "ulong", $OPEN_VIRTUAL_DISK_FLAG, "struct*", $tOPEN_VIRTUAL_DISK_PARAMETERS, "handle*", 0) If @error Then Return SetError(2, 0, 0) Return $aReturn[6] EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-attachvirtualdisk Func _WinAPI_AttachVirtualDisk($hVD, $tSECURITY_DESCRIPTOR, $ATTACH_VIRTUAL_DISK_FLAG, $ProviderSpecificFlags, $tATTACH_VIRTUAL_DISK_PARAMETERS = Null, $tOVERLAPPED = Null) If Not $hVD Then Return SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "AttachVirtualDisk", "handle", $hVD, "struct*", $tSECURITY_DESCRIPTOR, "ulong", $ATTACH_VIRTUAL_DISK_FLAG, "ulong", $ProviderSpecificFlags, "struct*", $tATTACH_VIRTUAL_DISK_PARAMETERS, "struct*", $tOVERLAPPED) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-detachvirtualdisk Func _WinAPI_DetachVirtualDisk($hVD, $iFlags = $DETACH_VIRTUAL_DISK_FLAG_NONE, $ProviderSpecificFlags = 0) Local $aCall = DllCall("VirtDisk.dll", "dword", "DetachVirtualDisk", "handle", $hVD, "long", $iFlags, "ulong", $ProviderSpecificFlags) If @error Then Return SetError(1, 0, 0) If $aCall[0] <> 0 Then Return SetError(2, $aCall[0], 0) Return 1 EndFunc ;https://learn.microsoft.com/de-de/windows/win32/api/virtdisk/nf-virtdisk-getvirtualdiskphysicalpath Func _WinAPI_GetVirtualDiskPhysicalPath($hVD) If Not $hVD Then Return SetError(1, 0, 0) Local $tPhysicalDrive = DllStructCreate("wchar physicalDrive[" & $MAX_PATH & "]") Local $aReturn = DllCall("VirtDisk.dll", "dword", "GetVirtualDiskPhysicalPath", "handle", $hVD, "ulong*", DllStructGetSize($tPhysicalDrive), "struct*", $tPhysicalDrive) If @error Then Return SetError(2, 0, 0) Return $tPhysicalDrive.physicalDrive EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumepathnamesforvolumenamew Func _WinAPI_GetMountPointFromVolumeGUID($sGUID) Local $tBuffer = DllStructCreate("wchar path[" & $MAX_PATH & "]") Local $aRet = DllCall("kernel32.dll", "bool", "GetVolumePathNamesForVolumeNameW", "wstr", $sGUID, "struct*", $tBuffer, "dword", $MAX_PATH, "dword*", 0) If @error Or Not $aRet[0] Then Return SetError(1, 0, "") Return $tBuffer.path EndFunc Global $sISOFile = FileOpenDialog("Select an ISO file to mount", "", "ISO (*.iso)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST)) If @error Then Exit Global $tVIRTUAL_STORAGE_TYPE = DllStructCreate($tagVIRTUAL_STORAGE_TYPE) $tVIRTUAL_STORAGE_TYPE.DeviceId = $VIRTUAL_STORAGE_TYPE_DEVICE_ISO $tVIRTUAL_STORAGE_TYPE.VendorId = Binary("0xEC984AECA0F947E9901F71415A66345B") ;$VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT Global $tOPEN_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagOPEN_VIRTUAL_DISK_PARAMETERS) $tOPEN_VIRTUAL_DISK_PARAMETERS.Version = $OPEN_VIRTUAL_DISK_VERSION_1 $tOPEN_VIRTUAL_DISK_PARAMETERS.RWDepth = 0 Global $tATTACH_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagATTACH_VIRTUAL_DISK_PARAMETERS) $tATTACH_VIRTUAL_DISK_PARAMETERS.Version = $ATTACH_VIRTUAL_DISK_VERSION_1 Global $hMountISO = _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, _ $sISOFile, _ BitOR($VIRTUAL_DISK_ACCESS_READ, $VIRTUAL_DISK_ACCESS_ATTACH_RO), _ $OPEN_VIRTUAL_DISK_FLAG_NONE, _ $tOPEN_VIRTUAL_DISK_PARAMETERS) If Not $hMountISO Then Exit MsgBox($MB_ICONERROR, "ERROR", "Something went wrong opening ISO!") If _WinAPI_AttachVirtualDisk($hMountISO, _ 0, _ BitOR($ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, $ATTACH_VIRTUAL_DISK_FLAG_NO_SECURITY_DESCRIPTOR, $ATTACH_VIRTUAL_DISK_FLAG_REGISTER_VOLUME), _ 0, _ 0) Then Global $sPhysicalDrive = _WinAPI_GetVirtualDiskPhysicalPath($hMountISO) If StringRight($sPhysicalDrive, 1) <> "\" Then $sPhysicalDrive &= "\" Global $sVolumeNameGUID = _WinAPI_GetVolumeNameForVolumeMountPoint($sPhysicalDrive) If StringRight($sVolumeNameGUID, 1) <> "\" Then $sVolumeNameGUID &= "\" Global $sDrvLetter = _WinAPI_GetMountPointFromVolumeGUID($sVolumeNameGUID) MsgBox(0, "TEST ISO Mounting", "ISO mounted " & ($sDrvLetter = "" ? "but no drive letter was assigned!" : "to " & $sDrvLetter)) Else MsgBox($MB_ICONERROR, "ERROR", "Something went wrong attaching ISO!") EndIf If $hMountISO Then _WinAPI_DetachVirtualDisk($hMountISO) _WinAPI_CloseHandle($hMountISO) EndIf For some unknown reason to me, sometimes drive letter is not automatically assigned by the system although ISO is mounted. Can be checked by opening "Disk Management" -> diskmgmt.msc2 points -
Is it possible to add separator (horizontal line) to ComboBox list?
WildByDesign reacted to argumentum for a topic
Story time: I love my parents but I needed to move out and I told a woman I loved her, she told me she loved me to. My parents whom I loved used to do my laundry and in her case, it was the same. We divorced because we did not find in each other the love we got from our parents. If we were to share more we would have realized that we were looking for an attendant, ..some one to cook and clean after ourselves 🤪 The more you share, ex: I want this towards solving this, brings about context PS: the story is fictional, mostly1 point -
open url in default browser and wait till page loaded - (Moved)
Hayseed reacted to argumentum for a topic
hmm, maybe Send a Ctrl+A ( to select all text ), then Ctrl+C ( to copy the selected text ) and if "allow for www.bridgewebs.com. If you do not" is in the text, it could be said that the page loaded. Otherwise you'd have to learn how to work with a webdriver.1 point -
Spotty RunAs behavior after 22h2 / Best way to test win credentials?
argumentum reacted to rudi for a topic
Try this one: Func IsValidCredential($sUsername, $sPassword, $sDomain) Local $LOGON32_LOGON_NETWORK = 3 Local $LOGON32_PROVIDER_DEFAULT = 0 Local $aRet = DllCall("advapi32.dll", "bool", "LogonUserW", _ "wstr", $sUsername, _ "wstr", $sDomain, _ "wstr", $sPassword, _ "dword", $LOGON32_LOGON_NETWORK, _ "dword", $LOGON32_PROVIDER_DEFAULT, _ "ptr*", 0) If @error Then ConsoleWrite("DLL call error: " & @error & @CRLF) Return False EndIf If $aRet[0] Then ; Optional: close handle DllCall("kernel32.dll", "bool", "CloseHandle", "ptr", $aRet[6]) Return True Else Return False EndIf EndFunc $user=InputBox("username","username") $dom=InputBox("domain","domain") $pwd=InputBox("password","password","","*") If IsValidCredential($user, $pwd, $dom) Then MsgBox(64, "OK", "credentials accepted") Else MsgBox(16, "Failure", "credentials rejected") EndIf1 point -
DwmColorBlurMica
argumentum reacted to WildByDesign for a topic
Microsoft insists that the false positive is removed from the compiled binary and is no longer detected by Windows Defender. VirusTotal shows it. But apparently Windows Defender itself does not detect it and we're good to go. First post has been updated with version 1.0.3. This version is mostly a bug-fix release with a fix for Windows Terminal losing border color after being minimized. And a regression where border colors, if not set in custom rules, were not properly falling back to the global set value. That was a weird bug that took me forever to understand how/why it was happening but finally fixed it. I also made some changes that made the overall performance even better. Several functions were made to be more efficient. Less loops. I also made a special function Func _ColorBorderOnly($hWnd, $sClassName, $sName) to handle the border coloring in the Foreground Case only. Prior to that, the border stuff was going through the main coloring function and therefore a lot of extra stuff that was not necessary in the Foreground Case. So this also made things much more efficient.1 point -
I haven't touched AutoIt in over a year, so I'm a bit rusty. Here is an attempt to incorporate the Get/Set property into @trancexx ObjectFromTag code, similar to the AutoItObject UDF. Example 1: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example1() Func __Example1() ConsoleWrite("> __Example4() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("__MyInterface_", '', $t_TestObj, 'int Ln;char Msg[30];') __SetProperty($o_TestObj, "Ln", 555) __SetProperty($o_TestObj, "Msg", 'Is it working.') ConsoleWrite("+>>> Ln : " & __GetProperty($o_TestObj, "Ln") & @CRLF) ConsoleWrite("+>>> Msg : " & __GetProperty($o_TestObj, "Msg") & @CRLF) If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func __MyInterface_QueryInterface($pSelf, $pRIID, $pObj) Return __QueryInterface($pSelf, $pRIID, $pObj) EndFunc Func __MyInterface_AddRef($pSelf) Return __AddRef($pSelf) EndFunc Func __MyInterface_Release($pSelf) Return __Release($pSelf) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 2: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example2() Func __Example2() ConsoleWrite("> __Example2() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("__MyInterface_", 'Open hresult();Close hresult();', $t_TestObj, 'handle WinHnd;', False) If Not IsObj($o_TestObj) Then Return $o_TestObj.Open() MsgBox(0, '', 'Clicked to closed Notepad....') $o_TestObj.Close() If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) EndFunc Func __MyInterface_Open($pSelf) Run("notepad.exe") WinWait("[CLASS:Notepad]", "", 10) Local $hWnd = WinGetHandle("[CLASS:Notepad]") __SetProperty($pSelf, "WinHnd", $hWnd) Return 0 EndFunc Func __MyInterface_Close($pSelf) WinClose(__GetProperty($pSelf, "WinHnd")) Return 0 EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 3: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example3() Func __Example3() ConsoleWrite("> __Example3() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("__MyInterface_", 'MsgBox hresult();', $t_TestObj, 'char Title[10];char Text[30];int Flag;', False) If Not IsObj($o_TestObj) Then Return __SetProperty($o_TestObj, "Title", "Something") __SetProperty($o_TestObj, "Text", 'Is it working.') __SetProperty($o_TestObj, "Flag", 64 + 262144) $o_TestObj.MsgBox() If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func __MyInterface_MsgBox($pSelf) MsgBox(__GetProperty($pSelf, "Flag"), __GetProperty($pSelf, "Title"), __GetProperty($pSelf, "Text")) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 4: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example3() Func __Example3() ConsoleWrite("> __Example3() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("", 'DisplayBook str();', $t_TestObj, 'char book[50];char author[15];int year;', False) If Not IsObj($o_TestObj) Then Return __SetProperty($o_TestObj, "book", "Harry Potter and the Sorcerer's Stone") __SetProperty($o_TestObj, "author", 'J. K. Rowling') __SetProperty($o_TestObj, "year", 1997) MsgBox(0, 'Book', $o_TestObj.DisplayBook) If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func DisplayBook($pSelf) Local $sString = 'The novel ' & __GetProperty($pSelf, "book") & ' ,' & _ ' written by author ' & __GetProperty($pSelf, "author") & _ ' and published in ' & __GetProperty($pSelf, "year") & '.' Local Static $tString = DllStructCreate(StringFormat("char str[%d]", StringLen($sString) + 1)) ;+1 to null terminate! $tString.str = $sString Return DllStructGetPtr($tString) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 5: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example3() Func __Example3() ConsoleWrite("> __Example3() " & @CRLF) Local $t_BookObj, $t_AuthorObj Local $o_BookObj = __ObjectFromTag("", 'BookList hresult(bstr;bstr);', $t_BookObj, 'char book[50];int year;', False) Local $o_AuthorObj = __ObjectFromTag("", 'DisplayBook str(bstr);', $t_AuthorObj, 'char author[15];ptr oBook;', False) __SetProperty($o_AuthorObj, "oBook", $o_BookObj()) $o_BookObj.BookList("Harry Potter and the Sorcerer's Stone", 1997) MsgBox(0, 'Book', $o_AuthorObj.DisplayBook('J. K. Rowling')) If IsObj($o_AuthorObj) Then $o_AuthorObj = 0 If IsObj($o_BookObj) Then $o_BookObj = 0 __DeleteObjectFromTag($t_AuthorObj) __DeleteObjectFromTag($t_BookObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func BookList($pSelf, $pStrA, $pStrB) __SetProperty($pSelf, "book", __Bstr_ToString($pStrA)) __SetProperty($pSelf, "year", __Bstr_ToString($pStrB)) EndFunc Func DisplayBook($pSelf, $pStrA) __SetProperty($pSelf, "author", __Bstr_ToString($pStrA)) Local $pBookList = __GetProperty($pSelf, "oBook") Local $sString = 'The novel ' & __GetProperty($pBookList, "book") & ' ,' & _ ' written by author ' & __GetProperty($pSelf, "author") & _ ' and published in ' & __GetProperty($pBookList, "year") & '.' Local Static $tString = DllStructCreate(StringFormat("char str[%d]", StringLen($sString) + 1)) ;+1 to null terminate! $tString.str = $sString Return DllStructGetPtr($tString) EndFunc Func __Bstr_ToString($pString) Local $o_Data = DllStructGetData(DllStructCreate("wchar[" & _ DllStructGetData(DllStructCreate("dword", $pString - 4), 1) / 2 & "]", $pString), 1) Return $o_Data EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc for more about objectfromtag you can follow this thread created by @LarsJ https://www.autoitscript.com/forum/topic/205154-using-objcreateinterface-and-objectfromtag-functions/ and do check out code posted by @trancexx @ProgAndy @monoceres @wolf9228 @LarsJ @Danyfirex and @Bilgus. on this topic. Note: You can also register this object, created using __ObjectFromTag, within the Running Object Table (ROT). ObjFromTag_v1c.au31 point
-
Open all files starting with "0" in subfolder?
pixelsearch reacted to argumentum for a topic
It all makes little sense or whatever. ..you're missing the path, hence, nothing. In any case, why would anyone would like to run/shellExecute a bunch of files ?1 point -
IUserNotification
WildByDesign reacted to Numeric1 for a topic
Hello everyone, While exploring different ways to create a lightweight and flexible notification system, I realized that the IUserNotification interface is one of the least resource-hungry, especially if you're looking to implement a discreet and low-impact reminder system. I'm sharing here a small demonstration of this approach. The code below displays a customizable system notification with a title, message, icon, and optional system sound. It’s flexible and dynamic, and can easily be adapted for uses like reminders, subtle alerts, and more. 🔧 It uses: the COM object IUserNotification system icons extracted from shell32.dll a custom interface via AutoItObject 📌 This is just another way to do it — not necessarily better, but a useful option if you want to avoid heavy UDFs or external libraries for a simple need. #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include "AutoItObject.au3" #include <WinAPIIcons.au3> #include <WinAPIShellEx.au3> ; Initialization _AutoItObject_Startup() #cs ; Constants for SetBalloonInfo Global Const $NIIF_NONE = 0x00000000 Global Const $NIIF_INFO = 0x00000001 Global Const $NIIF_WARNING = 0x00000002 Global Const $NIIF_ERROR = 0x00000003 Global Const $NIIF_USER = 0x00000004 Global Const $NIIF_NOSOUND = 0x00000010 Global Const $NIIF_RESPECT_QUIET_TIME = 0x00000080 #ce ; COM structure and interfaces Global Const $tagIUserNotification = _ "QueryInterface long(ptr;ptr*);" & _ "AddRef ulong();" & _ "Release ulong();" & _ "SetBalloonInfo long(wstr;wstr;dword);" & _ "SetBalloonRetry long(dword;dword;uint);" & _ "SetIconInfo long(ptr;wstr);" & _ "Show long(ptr;dword);" & _ "PlaySound long(wstr);" ; Function to create and display the notification Func CreateSystemNotification($sTitle, $sMessage, $iTimeout = 2000, $iIconIndex = Default, $sSound = "") Local $hIcon = 0, $pUserNotif = 0, $oNotif = 0 ; Create COM instance Local $CLSID_IUserNotification = _AutoItObject_CLSIDFromString("{0010890E-8789-413C-ADBC-48F5B511B3AF}") Local $IID_IUserNotification = _AutoItObject_CLSIDFromString("{BA9711BA-5893-4787-A7E1-41277151550B}") _AutoItObject_CoCreateInstance(DllStructGetPtr($CLSID_IUserNotification), 0, 1, DllStructGetPtr($IID_IUserNotification), $pUserNotif) If Not $pUserNotif Then ConsoleWrite("Error: Failed to create COM instance." & @CRLF) Return False EndIf ; Create wrapper object $oNotif = _AutoItObject_WrapperCreate($pUserNotif, $tagIUserNotification) If Not IsObj($oNotif) Then ConsoleWrite("Error: Failed to create wrapper object." & @CRLF) Return False EndIf ; Load icon Local $dwFlags = $NIIF_USER Local $iTotal = _WinAPI_ExtractIconEx(@SystemDir & '\shell32.dll', -1, 0, 0, 0) If $iIconIndex = Default Or Not IsInt($iIconIndex) Or $iIconIndex < 0 Or $iIconIndex >= $iTotal Then $iIconIndex = 13 ; Default icon ;ConsoleWrite("Warning: Invalid icon index. Using default icon (index 64)." & @CRLF) EndIf $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', $iIconIndex, 32, 32) If Not $hIcon Then ConsoleWrite("Error: Failed to load icon. Switching to NIIF_NONE." & @CRLF) $dwFlags = $NIIF_NONE EndIf ; Configure notification If $sSound <> "" Then $oNotif.PlaySound($sSound) EndIf $oNotif.SetBalloonInfo($sTitle, $sMessage, BitOR($NIIF_RESPECT_QUIET_TIME, $dwFlags)) $oNotif.SetBalloonRetry(0, 0, 0) ; No retries $oNotif.SetIconInfo($hIcon, $sTitle) $oNotif.Show(0, $iTimeout) ; Resource cleanup If $hIcon Then _WinAPI_DestroyIcon($hIcon) If IsObj($oNotif) Then $oNotif.Release() $oNotif = 0 $pUserNotif = 0 Return True EndFunc ;==>CreateSystemNotification ; Example usage If CreateSystemNotification("Notification Title", "This is an AutoIt message", 2000, Default, "") Then ConsoleWrite("Notification displayed successfully." & @CRLF) Else ConsoleWrite("Failed to display notification." & @CRLF) EndIf1 point -
DwmColorBlurMica
argumentum reacted to WildByDesign for a topic
Wow, that really expands the possibilities for sure. I had no idea that was even possible.1 point -
The Full separate SciTE4AutoIt3 should work fine when setup for python correctly. Adding those to the python.properties and adding the actual python.api should be enough, but with the proper syntax: api.$(file.patterns.py)=$(SciteDefaultHome)\api\python.api ps: This isn't really a SciTE support forum! 😉1 point
-
Telegram Bot UDF
argumentum reacted to pat4005 for a topic
The fix is looking like this for me: ;@PRIVATE CHAT MESSAGE ; The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user (from bot's API manual). If (Json_Get($Json, '[result][0][my_chat_member][chat][type]') = 'private') Then Local $msgData[10] = [ _ Json_Get($Json, '[result][0][update_id]'), _ Json_Get($Json, '[result][0][my_chat_member][message_id]'), _ Json_Get($Json, '[result][0][my_chat_member][from][id]'), _ Json_Get($Json, '[result][0][my_chat_member][from][username]'), _ Json_Get($Json, '[result][0][my_chat_member][from][first_name]') _ ] $sUserBlockStatus = (Json_Get($Json, '[result][0][my_chat_member][new_chat_member][status]')) $msgData[6] = $sUserBlockStatus ;[6] = Member (bot) status in a private chat $msgData[7] = Json_Get($Json, '[result][0][my_chat_member][new_chat_member][user][id]') ;[7] = Member ID $msgData[8] = Json_Get($Json, '[result][0][my_chat_member][new_chat_member][user][username]') ;[8] = Member Username $msgData[9] = Json_Get($Json, '[result][0][my_chat_member][new_chat_member][user][first_name]') ;[9] = Member Firstname Return $msgData ; New message has appeared in a private chat ElseIf (Json_Get($Json, '[result][0][message][chat][type]') = 'private') Then ...1 point -
1 point
-
Script to detect active internet connection (Working Now)
hudsonhock reacted to BrewManNH for a topic
Try this version, there's no recursion involved and it doesn't hammer the autoitscript.com site every second. #include <MsgBoxConstants.au3> #include <INet.au3> Global $dData While 1 $dData = _GetIP() If $dData <> -1 Then ; internet connection is working MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "YAY!!!", "Internet Connection Back!") EndIf Sleep(301000) ; sleep for 5 minutes (and one second) WEnd1 point