Leaderboard
Popular Content
Showing content with the highest reputation on 10/23/2025 in Posts
-
Hi @genius257 Your input data reader works great! I added several inputs and buttons for a quick, rough test, and the values entered into the "toast" are returned to the callback and parsed correctly by your function. It appears that a notification toast doesn't allow more than 5 inputs; each selector input can't contain more than 5 options, and buttons can't exceed 5. Text inputs allow about 2,000 characters. But these limitations are due to the inherent features of Microsoft notification toasts, not your code. ... these toasts are funny... Bye and thanks again! cheers #include "./src/toast.au3" #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <InetConstants.au3> #include <WinApiReg.au3> #include <WinApiIcons.au3> #include <GDIPlus.au3> #include <WinAPIConv.au3> If Not FileExists(@TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Then _GDIPlus_Startup() $thIcons = DllStructCreate("HWND") $x = _WinAPI_ExtractIconEx(@AutoItExe, 0, 0, $thIcons, 1) ConsoleWrite($x & @CRLF) $hBitmap = _GDIPlus_BitmapCreateFromHICON(DllStructGetData($thIcons, 1)) _GDIPlus_ImageSaveToFileEx($hBitmap, @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png", _GDIPlus_EncodersGetCLSID("PNG")) _GDIPlus_BitmapDispose($hBitmap) ConsoleWrite(@error & @CRLF) _GDIPlus_Shutdown() _WinAPI_DestroyIcon(DllStructGetData($thIcons, 1)) EndIf Global Const $sAppName = @ScriptName Global $tCLSID = _Toast_CoCreateGuid() Global $sGUID = _WinAPI_StringFromGUID($tCLSID) ConsoleWrite("app CLSID: " & $sGUID & @CRLF) _Toast_Initialize($sAppName, $tCLSID, OnToastActivation, "AutoIt Toast Example", @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Opt("GuiOnEventMode", 1) Global $hWnd = GUICreate("Toast example", 700, 320) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE") Global $hButton01 = GUICtrlCreateButton("From template", 10, 10, 200, 120) GUICtrlSetOnEvent(-1, "ToastFromTemplateExample") Global $hButton02 = GUICtrlCreateButton("From XML string", 10, 140, 200, 120) GUICtrlSetOnEvent(-1, "ToastFromXmlString") Global $hRich = _GUICtrlRichEdit_Create($hWnd, "", 220, 10, 470, 300) GUISetState() While 1 Sleep(10) WEnd Func ToastFromTemplateExample() Local $oXml = _Toast_CreateToastTemplateXmlDocument() Local $pToast = _Toast_CreateToastNotificationFromXmlObject($oXml) _Toast_Show($pToast) EndFunc ;==>ToastFromTemplateExample Func DownloadImage() If FileExists(@TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg") Then Return _GUICtrlRichEdit_AppendText($hRich, "Trying to download avatar image from gravatar..." & @CRLF) Local $iBytes = InetGet("https://gravatar.com/avatar/e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778", @TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg", $INET_FORCEBYPASS) Local $error = @error If @error <> 0 Then _GUICtrlRichEdit_AppendText($hRich, "Failed to download image" & @CRLF) Return EndIf _GUICtrlRichEdit_AppendText($hRich, "Done! " & $iBytes & " bytes downloaded" & @CRLF) EndFunc ;==>DownloadImage Func ToastFromXmlString() DownloadImage() ; https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml Local $sToast = "" $sToast &= "<toast activationType=""foreground"" launch=""action=viewAlarm&alarmId=3"" scenario=""alarm"">" ; action=mainContent;alarmId=3 $sToast &= "" $sToast &= " <visual>" $sToast &= " <binding template=""ToastGeneric"">" $sToast &= " <text>Time to wake up!</text>" $sToast &= " <text>To prove you're awake, select which of the following fruits is yellow...</text>" $sToast &= ' <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>' $sToast &= " </binding>" $sToast &= " </visual>" $sToast &= "" $sToast &= " <actions>" $sToast &= "<!-- #1 First input-->" $sToast &= " <input id=""Options"" type=""selection"" defaultInput=""Selection1"">" $sToast &= " <selection id=""Selection1"" content=""Option 1/5""/>" $sToast &= " <selection id=""Selection2"" content=""Option 2/5""/>" $sToast &= " <selection id=""Selection3"" content=""Option 3/5""/>" $sToast &= " <selection id=""Selection4"" content=""Option 4/5""/>" $sToast &= " <selection id=""Selection5"" content=""Option 5/5""/>" ; $sToast &= " <selection id=""Selection6"" content=""Option 6/6""/>" ; No more than 5 options allowed $sToast &= " </input>" $sToast &= "<!-- #2 Second input-->" $sToast &= " <input id=""Poem"" type=""text"" placeHolderContent=""Please write a poem"" />" $sToast &= "<!-- #3 Third input-->" $sToast &= " <input id=""Season"" type=""selection"" defaultInput=""Autumn"">" $sToast &= " <selection id=""Spring"" content=""Spring""/>" $sToast &= " <selection id=""Summer"" content=""Summer""/>" $sToast &= " <selection id=""Autumn"" content=""Autumn""/>" $sToast &= " <selection id=""Winter"" content=""Winter""/>" $sToast &= " </input>" $sToast &= "<!-- #4 Fourth input-->" $sToast &= " <input id=""Mood"" type=""selection"" defaultInput=""Love"">" $sToast &= " <selection id=""Happy"" content=""I'm Happy 😀""/>" $sToast &= " <selection id=""Sad"" content=""I'm Sad 😢""/>" $sToast &= " <selection id=""Love"" content=""I'm in love ❤️""/>" $sToast &= " <selection id=""Angry"" content=""I'm mad at the whole world 🖕""/>" $sToast &= " </input>" $sToast &= "<!-- #5 Fifth input-->" $sToast &= " <input id=""Gender"" type=""selection"" defaultInput=""Female"">" $sToast &= " <selection id=""Male"" content=""I'm a man""/>" $sToast &= " <selection id=""Female"" content=""I'm a woman""/>" $sToast &= " </input>" #cs ; --- No more than 5 inputs allowed and no more than 5 entry --- $sToast &= "<!-- #6 Sixth input-->" $sToast &= " <input id=""WeekDay"" type=""selection"" defaultInput=""Wednesday"">" $sToast &= " <selection id=""Monday"" content=""Monday""/>" $sToast &= " <selection id=""Tuesday"" content=""5 Sincronizza contatti""/>" $sToast &= " <selection id=""Wednesday"" content=""Wednesday""/>" $sToast &= " <selection id=""Thursday"" content=""Thursday""/>" $sToast &= " <selection id=""Friday"" content=""Friday""/>" $sToast &= " <selection id=""Saturday"" content=""Saturday""/>" $sToast &= " <selection id=""Sunday"" content=""Sunday""/>" $sToast &= " </input>" #ce ; --- No more than 5 inputs allowed and no more than 5 entry --- $sToast &= "" $sToast &= " <!-- Button 1 -->" $sToast &= " <action content=""Yes, I agree""" $sToast &= " arguments=""action=Agree""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 2 -->" $sToast &= " <action content=""No, I disagree""" $sToast &= " arguments=""action=Disagree""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 3 -->" $sToast &= " <action content=""Save data""" $sToast &= " arguments=""action=Save""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 4 -->" $sToast &= " <action content=""Open settings""" $sToast &= " arguments=""action=Open""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 5 -->" $sToast &= " <action content=""Dismiss""" $sToast &= " arguments=""action=Dismiss""" $sToast &= " activationType=""background""/>" #cs ; --- No more than 5 buttons allowed --- $sToast &= " <!-- Button 6 -->" $sToast &= " <action content=""Snooze""" $sToast &= " arguments=""action=Snooze""" $sToast &= " activationType=""background""/>" #ce ; --- No more than 5 buttons allowed --- $sToast &= " </actions>" $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>' $sToast &= "</toast>" ;#ce Local $pToast = _Toast_CreateToastNotificationFromXmlString($sToast) If @error <> 0 Then _GUICtrlRichEdit_AppendText($hRich, _WinAPI_GetErrorMessage(@error)) Return EndIf _Toast_Show($pToast) _GUICtrlRichEdit_AppendText($hRich, $pToast & @TAB & "VarGetType: " & VarGetType($pToast) & @CRLF) EndFunc ;==>ToastFromXmlString ; https://learn.microsoft.com/en-us/windows/win32/api/notificationactivationcallback/nf-notificationactivationcallback-inotificationactivationcallback-activate Func OnToastActivation($pSelf, $appUserModelId, $invokedArgs, $data, $count) _GUICtrlRichEdit_AppendText($hRich, _ "Toast activated!" & @CRLF _ & " " & "appUserModelId: " & $appUserModelId & @TAB & "VarGetType: " & VarGetType($appUserModelId) & @CRLF _ & " " & "invokedArgs: " & $invokedArgs & @TAB & "VarGetType: " & VarGetType($invokedArgs) & @CRLF _ & " " & "$data: " & $data & @TAB & "VarGetType: " & VarGetType($data) & @TAB & DllStructGetData($data, 1) & @CRLF _ ; ??? also _WinAPI_GetString ... no good as well & " " & "$count: " & $count & @TAB & "VarGetType: " & VarGetType($count) & @CRLF _ ) _GUICtrlRichEdit_AppendText($hRich, @CRLF & "-----------------------------" & @CRLF) Local $pData = $data For $i = 1 To $count $tData = DllStructCreate('PTR Key;PTR Value;', $pData) $key = _WinAPI_GetString($tData.Key) $value = _WinAPI_GetString($tData.Value) ; ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value)) _GUICtrlRichEdit_AppendText($hRich, StringFormat('"%s"="%s"\n', $key, $value)) $pData += DllStructGetSize($tData) Next Return $_Toast_S_OK EndFunc ;==>OnToastActivation Func GUI_CLOSE() Exit EndFunc ;==>GUI_CLOSE4 points
-
Trying to make a form that is constrained inside of another form.
ioa747 and 2 others reacted to jaberwacky for a topic
Progress! ... Click the form button beside of the cursor button (more than once if you want to). Now the windows are clipped to the left too! #include-once Opt("WinTitleMatchMode", 4) ; advanced Opt("MouseCoordMode" , 2) #include <WindowsStylesConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> Global $formList[], $formCount = 0 Global Const $main_width = 815 Global Const $main_height = 860 Global Const $main_left = (@DesktopWidth / 2) - ($main_width / 2) Global Const $main_top = (@DesktopHeight / 2) - ($main_height / 2) Global Const $guiCanvas = GuiCreate("GUI Canvas", $main_width, $main_height, $main_left, $main_top) Global Const $canvas = GuiCreate('', ($main_width - 105), ($main_height - 35), 95, 5, $WS_CHILD, $WS_EX_OVERLAPPEDWINDOW, $guiCanvas) GUISetFont(10, -1, -1, "Segoe UI", $guiCanvas) #region ; menu items Global Const $menu_file = GUICtrlCreateMenu ("File") Global Const $menu_save_definition = GUICtrlCreateMenuitem("Save", $menu_file) ; Roy add-on Global Const $menu_load_definition = GUICtrlCreateMenuitem("Load", $menu_file) ; Roy add-on GUICtrlCreateMenuitem('' , $menu_file) ; Roy add-on Global Const $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_file) Global Const $menu_edit = GUICtrlCreateMenu ("Edit") Global Const $menu_vals = GUICtrlCreateMenuitem("Vals" , $menu_edit) ; added by: TheSaint Global Const $menu_wipe = GUICtrlCreateMenuitem("Clear all controls", $menu_edit) Global Const $menu_about = GUICtrlCreateMenuitem("About" , $menu_edit) ; added by: TheSaint GUICtrlSetState($menu_wipe, $GUI_DISABLE) Global Const $menu_settings = GUICtrlCreateMenu ("Settings") Global Const $menu_show_grid = GUICtrlCreateMenuItem("Show grid" , $menu_settings) Global Const $menu_grid_snap = GUICtrlCreateMenuItem("Snap to grid" , $menu_settings) Global Const $menu_paste_pos = GUICtrlCreateMenuItem("Paste at mouse position" , $menu_settings) Global Const $menu_show_ctrl = GUICtrlCreateMenuItem("Show control when moving", $menu_settings) Global Const $menu_show_hidden = GUICtrlCreateMenuItem("Show hidden controls" , $menu_settings) GUICtrlSetState($menu_show_grid , $GUI_CHECKED ) GUICtrlSetState($menu_grid_snap , $GUI_CHECKED ) GUICtrlSetState($menu_paste_pos , $GUI_CHECKED ) GUICtrlSetState($menu_show_ctrl , $GUI_CHECKED ) GUICtrlSetState($menu_show_hidden, $GUI_UNCHECKED) #endregion ; menu items #region ; toolbar Global Const $default_cursor = CreateToolButton("Cursor" , 5, 5) Global Const $toolForm = CreateToolButton("Form" , 45, 5) Global Const $toolGroup = CreateToolButton("Group" , 5, 45) Global Const $toolButton = CreateToolButton("Button" , 45, 45) Global Const $toolCheckbox = CreateToolButton("Checkbox" , 5, 85) Global Const $toolRadio = CreateToolButton("Radio" , 45, 85) Global Const $toolEdit = CreateToolButton("Edit" , 5, 125) Global Const $toolInput = CreateToolButton("Input" , 45, 125) Global Const $toolLabel = CreateToolButton("Label" , 5, 165) Global Const $toolUpDown = CreateToolButton("UpDown" , 45, 165) Global Const $toolList = CreateToolButton("List" , 5, 205) Global Const $toolCombo = CreateToolButton("Combo" , 45, 205) Global Const $toolDate = CreateToolButton("Date" , 5, 245) Global Const $toolTreeview = CreateToolButton("Treeview" , 45, 245) Global Const $toolProgress = CreateToolButton("Progress" , 5, 285) Global Const $toolAvi = CreateToolButton("Avi" , 45, 285) Global Const $toolIcon = CreateToolButton("Icon" , 5, 325) Global Const $toolPic = CreateToolButton("Pic" , 45, 325) Global Const $toolSlider = CreateToolButton("Slider" , 5, 365) Global Const $toolMenu = CreateToolButton("Menu" , 45, 365) Global Const $toolContextMenu = CreateToolButton("Context Menu", 5, 405) Global Const $toolTab = CreateToolButton("Tab" , 45, 405) #endregion ; toolbar main() Func main() GUISetState(@SW_SHOWNORMAL, $guiCanvas) GUISetState(@SW_SHOWNORMAL, $canvas) Local $msg Do $msg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $msg[1] Case $guiCanvas Switch $msg[0] Case $toolForm CreateForm() Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch Until False EndFunc Func CreateForm() GUISwitch($canvas) $formCount += 1 Local Const $form = GuiCreate("Form " & $formCount, 400, 600, 5, 5, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $canvas) $formList["Form" & $formCount] = $form GUISetState(@SW_SHOWNORMAL, $form) GUISwitch($guiCanvas) Return $form EndFunc Func CreateToolButton(Const $name, Const $left, Const $top) Local Const $tool = GUICtrlCreateRadio($name, $left, $top, 40, 40, BitOR($BS_PUSHLIKE, $BS_ICON)) GUICtrlSetImage($tool, @ScriptDir & "\resources\Icons\" & $name & ".ico") GUICtrlSetTip($tool, $name) Return $tool EndFunc3 points -
MediaPlayerElement - WinRT Xaml Island
WildByDesign reacted to MattyD for a topic
nice Its a bit off-topic - but I don't think we can do a "proper" full screen player via XAML islands. (It can obviously be simulated though) from: https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands/xaml-islands If i have time over the weekend I'll try the WinUI3 version. We'll see if it that fares any better...1 point -
Trying to make a form that is constrained inside of another form.
ioa747 reacted to jaberwacky for a topic
Tremendous! Thank you, this gives me something to tinker with!1 point -
MediaPlayerElement - WinRT Xaml Island
MattyD reacted to WildByDesign for a topic
And with that, thanks to @MattyD and @UEZ for the WorkerW code, we have GPU accelerated desktop wallpaper videos. On line 24, you just have to add a path to an MP4 video or any video that MediaPlayerElement supports. CPU usage is lower than all of the animated GIF scripts in the forum, even while stretching the video when necessary. Example and live wallpaper video file have been moved to: AutoIt Live Wallpaper1 point -
MediaPlayerElement - WinRT Xaml Island
MattyD reacted to WildByDesign for a topic
Since my line of work is in the computer security world, I am not a big fan of patching binaries and invalidating digital signatures. But I am a big fan of the work that you do for the AutoIt community, Matty. And I am curious about this project as well. Therefore, I wanted to provide an alternative way to do this without invalidating the digital signatures of the binaries. You need to drop the two manifest files into your AutoIt directory alongside the matching binaries. Pre-Win10, this would have been enough. However, in Win10/Win11 they made it so that you could not use manifest files within %WINDIR%, %PROGRAMFILES% or %PROGRAMFILES(X86)% directories and subdirectories. To allow, run the following from an elevated command prompt: REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 1 /f There is no need to reboot after this change. To disallow, run the following from an elevated command prompt: REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 0 /f Cheers! AutoIt3.exe.manifest AutoIt3_x64.exe.manifest1 point