-
Posts
2,688 -
Joined
-
Last visited
-
Days Won
39
Gianni last won the day on April 26
Gianni had the most liked content!
About Gianni

- Birthday 05/02/1962
Profile Information
-
Location
Italy
Recent Profile Visitors
5,389 profile views
Gianni's Achievements
-
mLipok reacted to a post in a topic:
Native win8+ toast notifications
-
genius257 reacted to a post in a topic:
Native win8+ toast notifications
-
ioa747 reacted to a post in a topic:
Native win8+ toast notifications
-
argumentum reacted to a post in a topic:
Native win8+ toast notifications
-
Gianni reacted to a post in a topic:
Trying to make a form that is constrained inside of another form.
-
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_CLOSE
-
Gianni reacted to a post in a topic:
Native win8+ toast notifications
-
Parsix reacted to a post in a topic:
"OrdoWebView2.ocx" WebView2 made simple
-
Hi @genius257, and thanks for your progress From some tests I'm running, I'd expect the callback function to return the values of the fields in the "toast" in the $data parameter. Using the following script, I see that the parameter ($data) contains a pointer, but what does it point to, and how can I read the data it points to? bye and thanks #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 &= "" $sToast &= " <input id=""answer"" type=""selection"" defaultInput=""wrongDefault"">" $sToast &= " <selection id=""wrong"" content=""Orange""/>" $sToast &= " <selection id=""wrongDefault"" content=""Blueberry""/>" $sToast &= " <selection id=""right"" content=""Banana""/>" $sToast &= " <selection id=""wrong"" content=""Avacado""/>" $sToast &= " <selection id=""wrong"" content=""Cherry""/>" $sToast &= " </input>" $sToast &= "" $sToast &= " <action" $sToast &= " activationType=""background""" $sToast &= " arguments=""snooze""" $sToast &= " content=""snooze""/>" $sToast &= "" $sToast &= " <action" $sToast &= " activationType=""background""" $sToast &= " arguments=""dismiss""" $sToast &= " content=""Dismiss""/>" $sToast &= "" $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 _ ) Return $_Toast_S_OK EndFunc ;==>OnToastActivation Func GUI_CLOSE() Exit EndFunc ;==>GUI_CLOSE
-
Browser behavior is determined by the web page's source (html and javascript). For example, if the target="_blank" attribute is specified in an HTML <A> anchor tag, the link to which it points opens in a new window. Therefore, to change the page's behavior, it would be necessary to modify the page's source. However, it is possible to use a javascript function to intercept clicks on the <A> tag and modify its default behavior, forcing the new page to open in the same window instead of a new one. To do this, you need to inject the javascript function into the web page, for example, using the ".AddScriptToExecuteOnDocumentCreated" method. I modified the example script in the first post, which now also includes the above. I found the JavaScript snippet used on the web and it attempts to prevent clicked links from opening in a new window (it can probably be improved). Instead, they are displayed in the current window. However, some JavaScript functions can still force the page to open in a new window (sorry). As mentioned, for this to work, it must be injected into the created OrdoWebView2 controls, and this is done using the "AddScriptToExecuteOnDocumentCreated" method. See the example in the first post P.S. (since I also modified OrdoWebView2.au3 in the first post, you must use that new file as well). I hope this helps.
-
Gianni reacted to a post in a topic:
Native win8+ toast notifications
-
Gianni reacted to a post in a topic:
Native win8+ toast notifications
-
ioa747 reacted to a post in a topic:
Native win8+ toast notifications
-
Danyfirex reacted to a post in a topic:
Native win8+ toast notifications
-
genius257 reacted to a post in a topic:
Native win8+ toast notifications
-
WildByDesign reacted to a post in a topic:
Native win8+ toast notifications
-
Hi @genius257, Very cool, I'm not familiar with this stuff, but it looks interesting. You've done a great job implementing it in AutoIt! I tried creating some simple test toasts in XML, but not all the tags work correctly at the moment (for example, the <image> tag doesn't display the image if the "src=" parameter is a URL...). Furthermore, it's mandatory to specify the activationType="background" parameter in the initial <toast...> tag... To generate my test toasts in XML, I installed this app (which also has ready-made templates): https://apps.microsoft.com/detail/9nblggh5xsl1 then, to insert the generated XML code into your example listing in AutoIt, I copy the generated code to the clipboard (select the listing and press Ctrl-C), and immediately run this little script (F5 in SciTE), which adapts it and puts it back in the clipboard. I then paste it into the AutoIt listing. Local $sVarName = "$sToast" Local $aStr = StringSplit(ClipGet(), @CRLF, 1) ; get the clipboard content Local $sListing ; = "Func " & $sFuntionName & "()" & @CRLF $sListing &= 'Local ' & $sVarName & ' = ""' & @CRLF For $i = 1 To $aStr[0] $sListing &= $sVarName & ' &= "' & StringReplace($aStr[$i], '"', '""') & '" ' & @CRLF Next ClipPut($sListing) ConsoleWrite($sListing) This is an example of output (which I later modified a bit) to insert into the example script. Local $sToast = "" $sToast &= "<toast activationType=""background"" launch=""action=viewAlarm&alarmId=3"" scenario=""alarm"">" $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 &= "" $sToast &= " <input id=""answer"" type=""selection"" defaultInput=""wrongDefault"">" $sToast &= " <selection id=""wrong"" content=""Orange""/>" $sToast &= " <selection id=""wrongDefault"" content=""Blueberry""/>" $sToast &= " <selection id=""right"" content=""Banana""/>" $sToast &= " <selection id=""wrong"" content=""Avacado""/>" $sToast &= " <selection id=""wrong"" content=""Cherry""/>" $sToast &= " </input>" $sToast &= "" $sToast &= " <action" $sToast &= " activationType=""system""" $sToast &= " arguments=""snooze""" $sToast &= " content=""""/>" $sToast &= "" $sToast &= " <action" $sToast &= " activationType=""background""" $sToast &= " arguments=""dismiss""" $sToast &= " content=""Dismiss""/>" $sToast &= "" $sToast &= " </actions>" $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>' $sToast &= "</toast>" .. I hope you can implement support for events too... Bye and thanks! P.S. There was a notification "emulator" at this link:: Notifications UDF - Desktop notifications 1.2 (updated Mai 1st) - AutoIt Example Scripts - AutoIt Forums
-
Gianni reacted to a post in a topic:
Native win8+ toast notifications
-
Gianni reacted to a post in a topic:
ControlSetText vs ControlSend
-
Gianni reacted to a post in a topic:
WebDriver UDF (W3C compliant version) - 2025/09/01
-
Gianni reacted to a post in a topic:
WinRT - WinUI3
-
Gianni reacted to a post in a topic:
WinRT - WinUI3
-
Gianni reacted to a post in a topic:
WinRT - WinUI3
-
Is there an alternative to ProcessWaitClose()
Gianni replied to sl23's topic in AutoIt General Help and Support
How do you launch that app? -
UEZ reacted to a post in a topic:
WebP v0.5.0 build 2025-08-23 beta
-
This is an UEZ's Example08 companion script If you're interested in generating animations (Example08) and want to use those animation strips found online (search for "animation strips" online) to create animated images, you can use this script to easily extract individual frames from the strip and save each in a separate file so you can import them using UEZ's Example08. In short: Save the image containing the sequence of frames to disk. Use this script to set and adjust (visually) the dimensions; the number of frames; the spacing between frames; and some other offsets. Once you've defined the frames, press the "save frames" button to generate as many files as there are frames. Now you can use UEZ's Example08 to animate the sequence. Example: 1) Suppose you found this image at the following link: 2) Save the image to disk. 3) Let's run this script and load that image from disk. 4) Set the parameters as follows: 5) We'll get this setting. 6) Now click "save frames" and the frames will be saved to disk. That's all. 7) Now you can use UEZ Example 8. This toy was sketched out to give an idea of the concept, but it could certainly be improved and perhaps merged with Example 8 to generate a single script... Have fun! #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <File.au3> _GDIPlus_Startup() ; Choose Image File Local $sPath = FileOpenDialog("Choose Image File", @ScriptDir, "Images (*.gif;*.png;*.jpg;*.bmp)| All (*.*)") If $sPath = '' Then Exit MsgBox(16, "Error", "Sorry, no image was chosen") ; load background image Local $hBackground = _GDIPlus_ImageLoadFromFile($sPath) Local $iWidth = _GDIPlus_ImageGetWidth($hBackground) ; get image width Local $iHeight = _GDIPlus_ImageGetHeight($hBackground) ; get image Height ; Create GUI Local $hWnd = GUICreate("Movie maker", $iWidth, $iHeight, 50, 50) GUISetState(@SW_SHOW, $hWnd) Local $hDC = _WinAPI_GetDC($hWnd) Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) ; === CREATE OVERLAY === ; empty Bitmap ARGB Local $hOverlayBmp = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Local $hOverlayCtx = _GDIPlus_ImageGetGraphicsContext($hOverlayBmp) Local $hBrushTransparent = _GDIPlus_BrushCreateSolid(0x00000000) ; Fills the entire bitmap with a semi-transparent color. Local $OverlayColor = 0xBE00FF00 _GDIPlus_GraphicsSetCompositingMode($hOverlayCtx, 1) ; (1) - Specifies that when a color is rendered, it overwrites the background color. ; Draw background _GDIPlus_GraphicsDrawImage($hGraphics, $hBackground, 0, 0) ; --- Create settings panel --- If $iWidth > @DesktopWidth - 500 Then Local $hGUIsettings = GUICreate("Strip settings", 270, 400, @DesktopWidth - 600, 50) Else Local $hGUIsettings = GUICreate("Strip settings", 270, 400, $iWidth + 70, 50) EndIf ; GUICtrlCreateLabel("Adgiust strip parameters here below", 20, 20, 270, 20) ; GUICtrlCreateLabel("Top margin:", 20, 60, 100, 20) Local $idTM = GUICtrlCreateInput(20, 150, 60, 100, 20) GUICtrlCreateUpdown($idTM) ; GUICtrlCreateLabel("Side margin:", 20, 90, 100, 20) Local $idSM = GUICtrlCreateInput(6, 150, 90, 100, 20) GUICtrlCreateUpdown($idSM) ; GUICtrlCreateLabel("Frame height:", 20, 120, 100, 20) Local $idFH = GUICtrlCreateInput(100, 150, 120, 100, 20) GUICtrlCreateUpdown($idFH) ; GUICtrlCreateLabel("Frame width:", 20, 150, 100, 20) Local $idFW = GUICtrlCreateInput(100, 150, 150, 100, 20) GUICtrlCreateUpdown($idFW) ; GUICtrlCreateLabel("number of frames:", 20, 180, 120, 20) Local $idFN = GUICtrlCreateInput(2, 150, 180, 100, 20) GUICtrlCreateUpdown($idFN) ; GUICtrlCreateLabel("Inter-frame gap:", 20, 210, 100, 20) Local $idIG = GUICtrlCreateInput(10, 150, 210, 100, 20) GUICtrlCreateUpdown($idIG) ; GUICtrlCreateLabel("number of rows:", 20, 240, 100, 20) Local $idRN = GUICtrlCreateInput(1, 150, 240, 100, 20) GUICtrlCreateUpdown($idRN) ; GUICtrlCreateLabel("Inter-row gap:", 20, 270, 100, 20) Local $idRG = GUICtrlCreateInput(10, 150, 270, 100, 20) GUICtrlCreateUpdown($idRG) ; GUICtrlCreateLabel("opacity of the mask:", 20, 300, 100, 20) Local $idMO = GUICtrlCreateInput(190, 150, 300, 100, 20) GUICtrlCreateUpdown($idMO) ; ; === Buttons === Local $btnOK = GUICtrlCreateButton("Save Frames", 20, 330, 110, 30) Local $btnRefresh = GUICtrlCreateButton("Refresh", 140, 330, 110, 30) GUISetState(@SW_SHOW, $hGUIsettings) ControlClick('', '', $btnRefresh) ; === MAIN LOOP === Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $aPathSplit, $iFrame = 0, $hClone While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btnRefresh ContinueCase ; if any parameter changes, update the GUI accordingly Case $idTM, $idSM, $idFH, $idFW, $idFN, $idIG, $idMO, $idRN, $idRG $OverlayColor = Number("0x" & Hex(GUICtrlRead($idMO), 2) & "00FF00") ; add Background _GDIPlus_GraphicsDrawImage($hGraphics, $hBackground, 0, 0) ; add semitransparent layer _GDIPlus_GraphicsClear($hOverlayCtx, $OverlayColor) ; "Punches" some areas (opens holes in the semi-transparent layer). ; To do this, draw rectangles with alpha = 0. For $r = 0 To GUICtrlRead($idRN) - 1 For $f = 0 To GUICtrlRead($idFN) - 1 _GDIPlus_GraphicsFillRect($hOverlayCtx, GUICtrlRead($idSM) + ($f * (GUICtrlRead($idFW) + GUICtrlRead($idIG))), GUICtrlRead($idTM) + ($r * (GUICtrlRead($idFH) + GUICtrlRead($idRG))), GUICtrlRead($idFW), GUICtrlRead($idFH), $hBrushTransparent) Next Next ; place the created overlay (with "holes") on the GUI _GDIPlus_GraphicsDrawImage($hGraphics, $hOverlayBmp, 0, 0) Case $btnOK $aPathSplit = _PathSplit($sPath, $sDrive, $sDir, $sFileName, $sExtension) $iFrame = 0 For $r = 0 To GUICtrlRead($idRN) - 1 For $f = 0 To GUICtrlRead($idFN) - 1 $hClone = _GDIPlus_BitmapCloneArea($hBackground, GUICtrlRead($idSM) + ($f * (GUICtrlRead($idFW) + GUICtrlRead($idIG))), GUICtrlRead($idTM) + ($r * (GUICtrlRead($idFH) + GUICtrlRead($idRG))), GUICtrlRead($idFW), GUICtrlRead($idFH), $GDIP_PXF24RGB) ; Save bitmap to file _GDIPlus_ImageSaveToFile($hClone, $sFileName & "_frame_" & $iFrame & ".bmp") $iFrame += 1 Next Next ; Clean up resource _GDIPlus_ImageDispose($hClone) EndSwitch WEnd ; === CLEANUP === ; Fine disegno overlay _GDIPlus_BrushDispose($hBrushTransparent) _GDIPlus_GraphicsDispose($hOverlayCtx) _GDIPlus_BitmapDispose($hOverlayBmp) _GDIPlus_ImageDispose($hBackground) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_ReleaseDC($hWnd, $hDC) _GDIPlus_Shutdown() GUIDelete($hGUIsettings) GUIDelete($hWnd) Exit
-
[Solved] Sending a Key that is Registered as a Hotkey
Gianni replied to Zohar's topic in AutoIt General Help and Support
my two cents, You could use WinActive() + ControlSend() to send that key to a specific window only if that window is the active one, otherwise stick with the "global" HotKey functionality Global $HotKey = '{F5}' HotKeySet("{ESC}", "Terminate") HotKeySet($HotKey, "MyHotKey") ; Run Notepad for example Run("notepad.exe") ; Wait 10 seconds for the Notepad window to appear. Local $hWnd1 = WinWait("[CLASS:Notepad]", "", 10) While 1 Sleep(100) WEnd Func MyHotKey() ; Exception for HotKey ; Perform following action(s) only if the chosen window is the active window If WinActive($hWnd1) Then ; do this only if Notepad is the active window ; send HotKey to a specific window ControlSend($hWnd1,'','', $HotKey) Return EndIf ; otherwise do standard global action ConsoleWrite($HotKey & " was pessed (outside the notepad)" & @CRLF) EndFunc Func Terminate() ; Close the Notepad window using the handle returned by WinWait. WinClose($hWnd1) ; Now a screen will pop up and ask to save the changes, the classname of the window is called ; "#32770" and simulating the "TAB" key to move to the second button in which the "ENTER" is simulated to not "save the file" WinWaitActive("[CLASS:#32770]") Sleep(500) Send("{TAB}{ENTER}") Exit EndFunc ;==>Terminate -
Running it as is, I get the following error: "Couldn't find WorkerW under Progman." I then replaced your _WinAPI_FindWindowEx() function with asnippet from this piece of code from @argumentum, and it worked fine: Func __WinAPI_FindWindowEx() Local $hWorkerW = 0, $hProgman = _WinAPI_GetShellWindow() ; WinGetHandle("[CLASS:Progman]") ;~ _SendMessage($hProgman, 0x052C) ; <<<<<< force the creation of a WorkerW handle under Progman ; https://stackoverflow.com/questions/56132584/draw-on-windows-10-wallpaper-in-c ; https://stackoverflow.com/questions/34952967/drawing-to-the-desktop-via-injection ; https://github.com/rocksdanister/lively/issues/2074 ; _WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 3000, $SMTO_NORMAL) ; same as _SendMessage() If Not $hWorkerW Then ; dah Local $aEnumWindows = _WinAPI_EnumWindows(False) For $n = 1 To UBound($aEnumWindows) - 1 If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then $hWorkerW = $aEnumWindows[$n][0] ExitLoop ; but is likely one at the end of the Z-order EndIf Next EndIf ; ConsoleWrite("WorkerW = " & $hWorkerW & @CRLF) If Not $hWorkerW Then $hWorkerW = $hProgman Return $hWorkerW EndFunc ;==>__WinAPI_FindWindowEx By the way, very great effect! 👍
-
Move window behind desktop icons
Gianni replied to Parsix's topic in AutoIt General Help and Support
... Fun topic ... 🙂 just for fun, here are some tweaks to @argumentum's script above to simulate dragging the window and see the visual effect of the movement under the icons...nice effect. To make the window follow the mouse, press F9 once; to stop the movement, press F9 again. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <WinAPISysWin.au3> Opt("MustDeclareVars", True) HotKeySet("{ESC}", Terminate) ;;; https://www.autoitscript.com/forum/topic/212981-move-window-behind-desktop-icons/page/2/#findComment-1544435 HotKeySet('{F9}', F9) ; <-- Global $bFlag = False ; <-- Example() Func Example() Local $hWorkerW = 0, $hProgman = _WinAPI_GetShellWindow() ; WinGetHandle("[CLASS:Progman]") ;~ _SendMessage($hProgman, 0x052C) ; <<<<<< force the creation of a WorkerW handle under Progman ; https://stackoverflow.com/questions/56132584/draw-on-windows-10-wallpaper-in-c ; https://stackoverflow.com/questions/34952967/drawing-to-the-desktop-via-injection ; https://github.com/rocksdanister/lively/issues/2074 _WinAPI_SendMessageTimeout($hProgman, 0x052C, 0, 0, 3000, $SMTO_NORMAL) ; same as _SendMessage() If Not $hWorkerW Then ; dah Local $aEnumWindows = _WinAPI_EnumWindows(False) For $n = 1 To UBound($aEnumWindows) - 1 If $aEnumWindows[$n][1] <> "WorkerW" Then ContinueLoop If _WinAPI_GetParent($aEnumWindows[$n][0]) = $hProgman Then $hWorkerW = $aEnumWindows[$n][0] ExitLoop ; but is likely one at the end of the Z-order EndIf Next EndIf ConsoleWrite("WorkerW = " & $hWorkerW & @CRLF) If Not $hWorkerW Then $hWorkerW = $hProgman Local $hGUI = GUICreate("Overlay", 400, 300, 10, 10) ; , $WS_POPUP, $WS_EX_TOOLWINDOW) GUICtrlCreatePic(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Examples\GUI\msoobe.jpg", 0, 0, 400, 300) _WinAPI_SetParent($hGUI, $hWorkerW) _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED)) _WinAPI_SetLayeredWindowAttributes($hGUI, 0, 180) GUISetState(@SW_SHOWNOACTIVATE) While GUIGetMsg() <> $GUI_EVENT_CLOSE If $bFlag Then WinMove($hGUI,'',MouseGetPos(0),MouseGetPos(1)) EndIf WEnd EndFunc ;==>Example Func Terminate() Exit EndFunc ;==>Terminate Func F9() $bFlag = Not $bFlag EndFunc -
Hi @MattyD ... I didn't install it, and "WindowTest.au3" works anyway ... ... I also tried this stuff but it doesn't work ... I get this --> !>01:19:22 AutoIt3.exe ended.rc:-1073741819 Thanks for all this work! 👍
-
Thanks @MattyD for the new "XamlLibs" I've been trying to create a WebView using what you said in your previous post, but I'm also getting the error -2147467259 Unspecified Error (E_FAIL) right after this line of code: Local $pControl = IWebViewFactory4_CreateInstanceWithExecutionMode($pCtrl_Fact, $mWebViewExecutionMode["SameThread"]) Since I'm in the dark on this, ... I can only stay tuned ... 🙂
-
#include "Include\Classes\Windows.UI.Xaml.Controls.Webview.au3" I can't find this file to try
-
Well said! I agree with you... ColorPicker works well (manifest patch needed) and callback function works great! P.S. peeking at ClassExplorer I see that there is a "Windows.UI.Xaml.Controls.IWebView2" what is this for? can you embed a browser with this?!?
-
I applied the patch to the compiled executable file instead of AutoIt3.exe and that worked. Thanks
-
Hi @MattyD I replaced the original autoit3.exe file with the modified version generated by your script (..?! you know things that I obviously don't know) and in this way MediaPlayer.au3 works. Then I tried to compile MediaPlayer.au3 but the generated executable does not work (the autoit3.exe file after compilation is still the modified one). Is there any trick to be able to compile MediaPlayer.au3 into a working executable and then restore the original autoit3.exe file in the AutoIt folder? Bye and thanks