Leaderboard
Popular Content
Showing content with the highest reputation since 06/07/2025 in all areas
-
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
-
Sorry for being slow here and understand the issue now... Many ( really many) moons ago I moved all properties files into their own subdirectory, but AutoIt indeed install it into the SciTE root directory since that is also where the light version expects it. Funny this comes up after such a loooong time, but I will have a look to fix this in the SciTE4AutoIt3 installer. Guess all i really need to do is change this in au3.properties: # Import the default au3.keywords.properties file containing AutoIt3 info import properties\au3.keywords # override with the AutoIt3 provided file located in the root. import au3.keywords4 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.8 build 2025-07-04 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.8 build 2025-07-04 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.8 build 2025-07-04 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.8 build 2025-07-04 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.8 build 2025-07-04 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 -
No, you should not add anything to that file as it is overwritten with autoit3 installs. 😉2 points
-
Help File/Documentation Issues. (Discussion Only)
argumentum reacted to mLipok for a topic
added: _WinAPI_ShellGetFileInfo.au3 I can't remember how to complete the _WinAPI_DestroyIcon documentation "as a reference to _WinAPI_ShellGetFileInfo.au3" I hope someone else will complete this soon.1 point -
syncthing --no-browser --no-console
Danyfirex reacted to argumentum for a topic
Entry just to mark the post as solved1 point -
Is it possible to add separator (horizontal line) to ComboBox list?
WildByDesign reacted to IronFine for a topic
You have something like this in mind? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiImageList.au3> Global $mainGUI = GUICreate("Custom Dropdown ListView", 300, 150) Global $btnSelect = GUICtrlCreateButton("Select option", 50, 40, 200, 30) Global $lblSelected = GUICtrlCreateLabel("Selected: None", 50, 90, 200, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btnSelect ShowCustomDropdown() EndSwitch WEnd Func ShowCustomDropdown() Local $childGUI = GUICreate("", 220, 150, WinGetPos($mainGUI)[0] + 50, WinGetPos($mainGUI)[1] + 70, _ $WS_POPUP, $WS_EX_TOOLWINDOW, $mainGUI) Local $dummyBegin = GUICtrlCreateDummy() Local $lv = GUICtrlCreateListView("Option 0", 0, 0, 220, 150, BitOR($LVS_REPORT, $LVS_SINGLESEL)) GUICtrlSendMsg($lv, $LVM_SETCOLUMNWIDTH, 0, 200) Local $items[6] = ["Option 1", "Option 2", "---", "Option 3", "---", "Option 4"] For $i = 0 To UBound($items) - 1 Local $itemID = GUICtrlCreateListViewItem($items[$i], $lv) If $items[$i] = "---" Then GUICtrlSetColor($itemID, 0x888888) GUICtrlSetBkColor($itemID, 0xF0F0F0) EndIf Next Local $dummyEnd = GUICtrlCreateDummy() GUISetState(@SW_SHOW, $childGUI) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE GUIDelete($childGUI) ExitLoop Case $dummyBegin To $dummyEnd If GUICtrlRead($msg) <> "---" Then GUICtrlSetData($lblSelected, "Selected: " & GUICtrlRead($msg)) GUIDelete($childGUI) ExitLoop EndIf EndSwitch WEnd EndFunc ;==>ShowCustomDropdown1 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 -
DwmColorBlurMica
argumentum reacted to WildByDesign for a topic
I just updated the first post with version 1.0.2. I made some changes to the hooking logic so that it hooks earlier during process initialization. This made the overall hooking significantly faster and the occasional flicker with some apps is gone or at least greatly reduced. That may also depend on CPU speed, system load, etc. but overall a really nice improvement. I also made some changes to the border coloring function to make it more efficient and therefore benefit the performance of other areas of the program.1 point -
WinRT Object Libraries
WildByDesign reacted to MattyD for a topic
Apologies for the late reply, I have been awol for a bit. Generally speaking, if the object name starts with windows.* then it'll be built into the OS. So we should have a decent chance of making these ones work. The Microsoft.* objects however are usually external. For these we'll probably need dependencies or a runtime in order to use them. So "Microsoft.UI.Content.DesktopChildSiteBridge" looks to be part of the Windows App SDK (And maybe WinUI3??). There will be associated *.winmd files in the SDK somewhere that contain object definitions. From these we should be able to wrap any object that we'll need in order to change colours etc.. But the tricky bit is how to implement the external objects/controls in the first place. Hope that makes sense. I will eventually get around to attacking this WinUI stuff - It'll just be whenever I have the time and energy to throw at it1 point -
DwmColorBlurMica
WildByDesign reacted to argumentum for a topic
Can not be outdated. These are timeless, as life itself. I would recommend putting everything in a zip file and add a simple password. That has shown to me to be better A/V wise for downloads.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 -
Your modified version works like a champ! No re-download of the AutoItObject UDF was necessary. Thanks!1 point
-
I remember looking at this and there is a comment about it, but your scenario is still going wrong. try current beta lua script. 🙂1 point
-
Introduction JSON (Javascript Object Notation) is a popular data-interchange format and supported by a lot of script languages. On AutoIt, there is already a >JSON UDF written by Gabriel Boehme. It is good but too slow, and not supports unicode and control characters very well. So I write a new one (and of course, fast one as usual). I use a machine code version of JSON parser called "jsmn". jsmn not only supports standard JSON, but also accepts some non-strict JSON string. See below for example. Important Update!! I rename the library from jsmn.au3 to json.au3. All function names are changed, too. Decoding Function Json_Decode($Json) $Json can be a standard or non-standard JSON string. For example, it accepts: { server: example.com port: 80 message: "this looks like a config file" } The most JSON data type will be decoded into corresponding AutoIt variable, including 1D array, string, number, true, false, and null. JSON object will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). AutoIt build-in functions like IsArray, IsBool, etc. can be used to check the returned data type. But for Object and Null, Json_IsObject() and Json_IsNull() should be used. If the input JSON string is invalid, @Error will be set to $JSMN_ERROR_INVAL. And if the input JSON string is not finish (maybe read from stream?), @Error will be set to $JSMN_ERROR_PART. Encoding Function Json_Encode($Data, $Option = 0, $Indent = "\t", $ArraySep = ",\r\n", $ObjectSep = ",\r\n", $ColonSep = ": ") $Data can be a string, number, bool, keyword(default or null), 1D arrry, or "Scripting.Dictionary" COM object. Ptr will be converted to number, Binary will be converted to string in UTF8 encoding. Other unsupported types like 2D array, dllstruct or object will be encoded into null. $Option is bitmask consisting following constant: $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) $JSON_UNESCAPED_UNICODE ; Encode multibyte Unicode characters literally $JSON_UNESCAPED_SLASHES ; Don't escape / $JSON_HEX_TAG ; All < and > are converted to \u003C and \u003E $JSON_HEX_AMP ; All &amp;amp;amp;s are converted to \u0026 $JSON_HEX_APOS ; All ' are converted to \u0027 $JSON_HEX_QUOT ; All " are converted to \u0022 $JSON_PRETTY_PRINT ; Use whitespace in returned data to format it $JSON_STRICT_PRINT ; Make sure returned JSON string is RFC4627 compliant $JSON_UNQUOTED_STRING ; Output unquoted string if possible (conflicting with $JSMN_STRICT_PRINT) Most encoding option have the same means like PHP's json_enocde() function. When $JSON_PRETTY_PRINT is set, output format can be change by other 4 parameters ($Indent, $ArraySep, $ObjectSep, and $ColonSep). Because these 4 output format parameters will be checked inside Jsmn_Encode() function, returned string will be always accepted by Jsmn_Decode(). $JSON_UNQUOTED_STRING can be used to output unquoted string that also accetped by Jsmn_Decode(). $JSON_STRICT_PRINT is used to check output format setting and avoid non-standard JSON output. So this option is conflicting with $JSON_UNQUOTED_STRING. Get and Put Functions Json_Put(ByRef $Var, $Notation, $Data, $CheckExists = False) Json_Get(ByRef $Var, $Notation) These functions helps user to access object or array more easily. Both dot notation and square bracket notation can be supported. Json_Put() by default will create non-exists objects and arrays. For example: Local $Obj Json_Put($Obj, ".foo", "foo") Json_Put($Obj, ".bar[0]", "bar") Json_Put($Obj, ".test[1].foo.bar[2].foo.bar", "Test") Local $Test = Json_Get($Obj, '["test"][1]["foo"]["bar"][2]["foo"]["bar"]') ; "Test" Object Help Functions Json_ObjCreate() Json_ObjPut(ByRef $Object, $Key, $Value) Json_ObjGet(ByRef $Object, $Key) Json_ObjDelete(ByRef $Object, $Key) Json_ObjExists(ByRef $Object, $Key) Json_ObjGetCount(ByRef $Object) Json_ObjGetKeys(ByRef $Object) Json_ObjClear(ByRef $Object) These functions are just warps of "Scripting.Dictionary" COM object. You can use these functions if you are not already familiar with it. == Update 2013/05/19 == * Add Jsmn_Encode() option "$JSMN_UNESCAPED_ASCII". Now the default output of Json_Encode() is exactly the same as PHP's json_encode() function (for example, chr(1) will be encoded into u0001). $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) == Update 2015/01/08 == * Rename the library from jsmn.au3 to json.au3. All function names are changed, too. * Add Json_Put() and Json_Get() * Add Null support * Using BinaryCall.au3 to loading the machine code. == Update 2018/01/13== (Jos) * Add JsonDump() to list all Json Keys and their values to easily figure out what they are. == Update 2018/10/01== (Jos) * Fixed JsonDump() some fields and values were not showing as discussed here - tnx @TheXman . == Update 2018/10/01b== (Jos) * Added Json_ObjGetItems, Tidied source and fixed au3check warnings - tnx @TheXman . == Update 2018/10/28== (Jos) * Added declaration for $value to avoid au3check warning - tnx @DerPensionist == Update 2018/12/16== (Jos) * Added another declaration for $value to avoid au3check warning and updated the version at the top - tnx @maniootek == Update 2018/12/29== (Jos) * Changed Json_ObjGet() and Json_ObjExists() to allow for multilevel object in string. == Update 2019/01/17== (Jos) * Added support for DOT notation in JSON functions. == Update 2019/07/15== (Jos) * Added support for reading keys with a dot inside when using a dot as separator (updated) == Update 2021/11/18== (TheXman) * Update details in below post: == Update 2021/11/20== (TheXman) * Minor RegEx update, no change to the functionality or result._Json(2021.11.20).zip1 point
-
3D Pie Chart
pat4005 reacted to WideBoyDixon for a topic
I've revamped this so that it doesn't "cheat" any more but instead creates a fills paths properly. This should be a bit quicker to draw and the result looks a bit nicer I think. In addition, I've added the capability to display the pie as a 2D donut with a configurable hole size in the middle. The sliders at the bottom can be used to rotate the pie chart and also to change the aspect (but not for a donut). The third slider changes the hole size. #include <GDIPlus.au3> #include <WinAPI.au3> #include <GUISlider.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> ; Let's be strict here Opt("MustDeclareVars", 1) ; Controls the size of the pie and also the depth Global Const $PIE_DIAMETER = 400 Global Const $PIE_MARGIN = $PIE_DIAMETER * 0.025 Global Const $PIE_DEPTH = $PIE_DIAMETER * 0.2 Global Const $PIE_AREA = $PIE_DIAMETER + 2 * $PIE_MARGIN ; Random data for values and colours Global Const $NUM_VALUES = 8 Global $aChartValue[$NUM_VALUES] Global $aChartColour[$NUM_VALUES] For $i = 0 To $NUM_VALUES - 1 $aChartValue[$i] = Random(5, 25, 1) $aChartColour[$i] = (Random(0, 255, 1) * 0x10000) + (Random(0, 255, 1) * 0x100) + Random(0, 255, 1) Next ; The value of PI Global Const $PI = ATan(1) * 4 ; Start GDI+ _GDIPlus_Startup() ; Create the brushes and pens Global $ahBrush[$NUM_VALUES][2], $ahPen[$NUM_VALUES] For $i = 0 To $NUM_VALUES - 1 $ahBrush[$i][0] = _GDIPlus_BrushCreateSolid(BitOR(0xff000000, $aChartColour[$i])) $ahBrush[$i][1] = _GDIPlus_BrushCreateSolid(BitOR(0xff000000, _GetDarkerColour($aChartColour[$i]))) $ahPen[$i] = _GDIPlus_PenCreate(BitOR(0xff000000, _GetDarkerColour(_GetDarkerColour($aChartColour[$i])))) Next ; Create the GUI with sliders to control the aspect, rotation, style and hole size (for donuts) Global $hWnd = GUICreate("Pie Chart", $PIE_AREA, $PIE_AREA + 100, Default, Default) Global $hSlideAspect = _GUICtrlSlider_Create($hWnd, $PIE_MARGIN, $PIE_AREA + 10, $PIE_DIAMETER, 20) _GUICtrlSlider_SetRange($hSlideAspect, 10, 100) _GUICtrlSlider_SetPos($hSlideAspect, 50) Global $hSlideRotation = _GUICtrlSlider_Create($hWnd, $PIE_MARGIN, $PIE_AREA + 40, $PIE_DIAMETER, 20) _GUICtrlSlider_SetRange($hSlideRotation, 0, 360) Global $cStyle = GUICtrlCreateCheckbox("Donut", $PIE_MARGIN, $PIE_AREA + 70, $PIE_DIAMETER / 2 - $PIE_MARGIN, 20) Global $hStyle = GUICtrlGetHandle($cStyle) Global $hHoleSize = _GUICtrlSlider_Create($hWnd, $PIE_MARGIN + $PIE_DIAMETER / 2, $PIE_AREA + 70, $PIE_DIAMETER / 2, 20) _GUICtrlSlider_SetRange($hHoleSize, 2, $PIE_DIAMETER - 4 * $PIE_MARGIN) _GUICtrlSlider_SetPos($hHoleSize, $PIE_DIAMETER / 2) GUISetState() ; Set up GDI+ Global $hDC = _WinAPI_GetDC($hWnd) Global $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($PIE_AREA, $PIE_AREA, $hGraphics) Global $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2) ; Draw the initial pie chart _DrawPie($aChartValue, _GUICtrlSlider_GetPos($hSlideAspect) / 100, _ _GUICtrlSlider_GetPos($hSlideRotation), _ (GUICtrlRead($cStyle) = $GUI_CHECKED), _ _GUICtrlSlider_GetPos($hHoleSize)) ; The sliders will send WM_NOTIFY messages GUIRegisterMsg($WM_NOTIFY, "_OnNotify") ; Wait until the user quits While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd ; Release the resources For $i = 0 To UBound($aChartColour) - 1 _GDIPlus_PenDispose($ahPen[$i]) _GDIPlus_BrushDispose($ahBrush[$i][0]) _GDIPlus_BrushDispose($ahBrush[$i][1]) Next _GDIPlus_GraphicsDispose($hBuffer) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_ReleaseDC($hWnd, $hDC) ; Shut down GDI+ _GDIPlus_Shutdown() ; Done Exit ; Get a darker version of a colour by extracting the RGB components Func _GetDarkerColour($Colour) Local $Red, $Green, $Blue $Red = (BitAND($Colour, 0xff0000) / 0x10000) - 40 $Green = (BitAND($Colour, 0x00ff00) / 0x100) - 40 $Blue = (BitAND($Colour, 0x0000ff)) - 40 If $Red < 0 Then $Red = 0 If $Green < 0 Then $Green = 0 If $Blue < 0 Then $Blue = 0 Return ($Red * 0x10000) + ($Green * 0x100) + $Blue EndFunc ;==>_GetDarkerColour ; Draw the pie chart Func _DrawPie($Percentage, $Aspect, $rotation, $style = 0, $holesize = 100) If $style <> 0 Then $Aspect = 1 Local $nCount, $nTotal = 0, $angleStart, $angleSweep, $X, $Y Local $pieLeft = $PIE_MARGIN, $pieTop = $PIE_AREA / 2 - ($PIE_DIAMETER / 2) * $Aspect Local $pieWidth = $PIE_DIAMETER, $pieHeight = $PIE_DIAMETER * $Aspect, $hPath ; Total up the values For $nCount = 0 To UBound($Percentage) - 1 $nTotal += $Percentage[$nCount] Next ; Set the fractional values For $nCount = 0 To UBound($Percentage) - 1 $Percentage[$nCount] /= $nTotal Next ; Make sure we don't over-rotate $rotation = Mod($rotation, 360) ; Clear the graphics buffer _GDIPlus_GraphicsClear($hBuffer, 0xffc0c0c0) ; Set the initial angles based on the fractional values Local $Angles[UBound($Percentage) + 1] For $nCount = 0 To UBound($Percentage) If $nCount = 0 Then $Angles[$nCount] = $rotation Else $Angles[$nCount] = $Angles[$nCount - 1] + ($Percentage[$nCount - 1] * 360) EndIf Next Switch $style Case 0 ; Adjust the angles based on the aspect For $nCount = 0 To UBound($Percentage) $X = $PIE_DIAMETER * Cos($Angles[$nCount] * $PI / 180) $Y = $PIE_DIAMETER * Sin($Angles[$nCount] * $PI / 180) $Y -= ($PIE_DIAMETER - $pieHeight) * Sin($Angles[$nCount] * $PI / 180) If $X = 0 Then $Angles[$nCount] = 90 + ($Y < 0) * 180 Else $Angles[$nCount] = ATan($Y / $X) * 180 / $PI EndIf If $X < 0 Then $Angles[$nCount] += 180 If $X >= 0 And $Y < 0 Then $Angles[$nCount] += 360 $X = $PIE_DIAMETER * Cos($Angles[$nCount] * $PI / 180) $Y = $pieHeight * Sin($Angles[$nCount] * $PI / 180) Next ; Decide which pieces to draw first and last Local $nStart = -1, $nEnd = -1 For $nCount = 0 To UBound($Percentage) - 1 $angleStart = Mod($Angles[$nCount], 360) $angleSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) If $angleStart <= 270 And ($angleStart + $angleSweep) >= 270 Then $nStart = $nCount EndIf If ($angleStart <= 90 And ($angleStart + $angleSweep) >= 90) _ Or ($angleStart <= 450 And ($angleStart + $angleSweep) >= 450) Then $nEnd = $nCount EndIf If $nEnd >= 0 And $nStart >= 0 Then ExitLoop Next ; Draw the first piece _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nStart, $Angles) ; Draw pieces "to the right" $nCount = Mod($nStart + 1, UBound($Percentage)) While $nCount <> $nEnd _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nCount, $Angles) $nCount = Mod($nCount + 1, UBound($Percentage)) WEnd ; Draw pieces "to the left" $nCount = Mod($nStart + UBound($Percentage) - 1, UBound($Percentage)) While $nCount <> $nEnd _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nCount, $Angles) $nCount = Mod($nCount + UBound($Percentage) - 1, UBound($Percentage)) WEnd ; Draw the last piece _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nEnd, $Angles) Case 1 ; Draw the donut pieces For $nCount = 0 To UBound($Percentage) - 1 $angleStart = Mod($Angles[$nCount], 360) $angleSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) ; Draw the outer arc in a darker colour $hPath = _GDIPlus_GraphicsPathCreate() _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft, $pieTop, $pieWidth, $pieHeight, $angleStart, $angleSweep) _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft + $PIE_MARGIN, $pieTop + $PIE_MARGIN, $pieWidth - $PIE_MARGIN * 2, _ $pieHeight - $PIE_MARGIN * 2, $angleStart + $angleSweep, -$angleSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hBuffer, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hBuffer, $ahPen[$nCount], $hPath) _GDIPlus_GraphicsPathDispose($hPath) ; Draw the inner piece in a lighter colour - leave room for the hole $hPath = _GDIPlus_GraphicsPathCreate() _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft + $PIE_MARGIN, $pieTop + $PIE_MARGIN, $pieWidth - $PIE_MARGIN * 2, _ $pieHeight - $PIE_MARGIN * 2, $angleStart, $angleSweep) _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft + ($PIE_DIAMETER - $holesize) / 2, $pieTop + ($PIE_DIAMETER - $holesize) / 2, _ $holesize, $holesize, $angleStart + $angleSweep, -$angleSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hBuffer, $ahBrush[$nCount][0], $hPath) _GDIPlus_GraphicsDrawPath($hBuffer, $ahPen[$nCount], $hPath) _GDIPlus_GraphicsPathDispose($hPath) Next EndSwitch ; Now draw the bitmap on to the device context of the window _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) EndFunc ;==>_DrawPie Func _OnNotify($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Switch $hWndFrom Case $hSlideAspect, $hSlideRotation, $hStyle, $hHoleSize ; Update the pie chart _DrawPie($aChartValue, _GUICtrlSlider_GetPos($hSlideAspect) / 100, _ _GUICtrlSlider_GetPos($hSlideRotation), _ (GUICtrlRead($cStyle) = $GUI_CHECKED), _ _GUICtrlSlider_GetPos($hHoleSize)) EndSwitch EndFunc ;==>_OnNotify Func _DrawPiePiece($hGraphics, $iX, $iY, $iWidth, $iHeight, $iDepth, $nCount, $Angles) Local $hPath, $cX = $iX + ($iWidth / 2), $cY = $iY + ($iHeight / 2), $fDrawn = False Local $iStart = Mod($Angles[$nCount], 360), $iSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) ; Draw side ConsoleWrite(_Now() & @CRLF) $hPath = _GDIPlus_GraphicsPathCreate() If $iStart < 180 And ($iStart + $iSweep > 180) Then _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iWidth, $iHeight, $iStart, 180 - $iStart) _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iDepth, $iWidth, $iHeight, 180, $iStart - 180) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hGraphics, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hGraphics, $ahPen[$nCount], $hPath) $fDrawn = True EndIf If $iStart + $iSweep > 360 Then _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iWidth, $iHeight, 0, $iStart + $iSweep - 360) _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iDepth, $iWidth, $iHeight, $iStart + $iSweep - 360, 360 - $iStart - $iSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hGraphics, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hGraphics, $ahPen[$nCount], $hPath) $fDrawn = True EndIf If $iStart < 180 And (Not $fDrawn) Then _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iWidth, $iHeight, $iStart, $iSweep) _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iDepth, $iWidth, $iHeight, $iStart + $iSweep, -$iSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hGraphics, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hGraphics, $ahPen[$nCount], $hPath) EndIf _GDIPlus_GraphicsPathDispose($hPath) ; Draw top _GDIPlus_GraphicsFillPie($hGraphics, $iX, $iY, $iWidth, $iHeight, $iStart, $iSweep, $ahBrush[$nCount][0]) _GDIPlus_GraphicsDrawPie($hGraphics, $iX, $iY, $iWidth, $iHeight, $iStart, $iSweep, $ahPen[$nCount]) EndFunc ;==>_DrawPiePiece Func _GDIPlus_GraphicsPathCreate($iFillMode = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $iFillMode, "int*", 0); If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, $aResult[2]) EndFunc ;==>_GDIPlus_GraphicsPathCreate Func _GDIPlus_GraphicsPathAddLine($hGraphicsPath, $iX1, $iY1, $iX2, $iY2) Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathLine", "hwnd", $hGraphicsPath, "float", $iX1, "float", $iY1, _ "float", $iX2, "float", $iY2) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathAddLine Func _GDIPlus_GraphicsPathAddArc($hGraphicsPath, $iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle) Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathArc", "hwnd", $hGraphicsPath, "float", $iX, "float", $iY, _ "float", $iWidth, "float", $iHeight, "float", $iStartAngle, "float", $iSweepAngle) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathAddArc Func _GDIPlus_GraphicsPathAddPie($hGraphicsPath, $iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle) Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathPie", "hwnd", $hGraphicsPath, "float", $iX, "float", $iY, _ "float", $iWidth, "float", $iHeight, "float", $iStartAngle, "float", $iSweepAngle) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathAddPie Func _GDIPlus_GraphicsPathCloseFigure($hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathCloseFigure Func _GDIPlus_GraphicsPathDispose($hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeletePath", "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathDispose Func _GDIPlus_GraphicsDrawPath($hGraphics, $hPen, $hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawPath", "hwnd", $hGraphics, "hwnd", $hPen, "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsDrawPath Func _GDIPlus_GraphicsFillPath($hGraphics, $hBrush, $hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "hwnd", $hGraphics, "hwnd", $hBrush, "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsFillPath1 point