@@ -27,7 +27,7 @@ Func _Example()
2727 $hGUI = GUICreate (" WebView2 .NET Manager - [ Press ESC to cancell the download ]" , 1000 , 800 )
2828
2929 ; Initialize WebView2 Manager and register events
30- Local $oWebV2M = _NetWebView2_CreateManager(" Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0" , " __MyNetWebView2_WebViewEvents__ " , " --mute-audio" )
30+ Local $oWebV2M = _NetWebView2_CreateManager(" Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0" , " " , " --mute-audio" )
3131 $_g_oWeb = $oWebV2M
3232 If @error Then Return SetError (@error , @extended , $oWebV2M )
3333
@@ -73,44 +73,6 @@ EndFunc ;==>_Example
7373; EVENT HANDLERS (CALLBACKS)
7474; =======================================================================================
7575
76- ; Listen for Manager OnDownloadStarting Events
77- Func __MyNetWebView2_WebViewEvents__OnDownloadStarting($sUri , $sDefaultPath )
78- ConsoleWrite (" -> [OnDownloadStarting]:: $sUri: " & $sUri & " , $sDefaultPath: " & $sDefaultPath & @CRLF )
79-
80- ; --- STANDARD MODE (EDGE) ---
81- ; If you do nothing, Edge will download to the $sDefaultPath.
82- ; If you previously set $oWeb.SetDownloadPath("C:\MyFolder"), it will go there.
83-
84- ; --- MANUAL MODE (BYPASS EDGE) ---
85- ; If you want to handle the download yourself with InetGet:
86- ; $oWeb.IsDownloadHandled = True
87- ; InetGet($sUri, @ScriptDir & "\Manual_Download.zip", 1, 1) ; 1 = wait for completion, 1 = force reload
88- ; ConsoleWrite("--> Edge download CANCELLED. AutoIt is handling it via InetGet." & @CRLF)
89-
90- ConsoleWrite (" <- OnDownloadStarting event finished. Standard Edge download proceeds unless IsDownloadHandled=True." & @CRLF )
91- EndFunc ; ==>__MyNetWebView2_WebViewEvents__OnDownloadStarting
92-
93- ; Listen for Manager OnDownloadStateChanged Events
94- Func __MyNetWebView2_WebViewEvents__OnDownloadStateChanged($sState , $sUri , $iTotal_Bytes , $iReceived_Bytes )
95- ConsoleWrite (" ! __MyNetWebView2_WebViewEvents__OnDownloadStateChanged" & @CRLF )
96-
97- Local $iPercent = 0
98- If $iTotal_Bytes > 0 Then $iPercent = Round (($iReceived_Bytes / $iTotal_Bytes ) * 100 )
99-
100- ; Convert to MB for easy-to-read log
101- Local $iReceived_MegaBytes = Round ($iReceived_Bytes / 1024 / 1024 )
102- Local $iTotal_MegaBytes = Round ($iTotal_Bytes / 1024 / 1024 )
103-
104- Switch $sState
105- Case " InProgress"
106- ConsoleWrite (" ++> Downloading: " & $iPercent & " % (" & $iReceived_MegaBytes & " / " & $iTotal_MegaBytes & " _MegaBytes)" & @CRLF )
107- Case " Interrupted"
108- ConsoleWrite (" !!!> DOWNLOAD STOPPED/INTERRUPTED: " & $sUri & @CRLF )
109- Case " Completed"
110- ConsoleWrite (" --> DOWNLOAD FINISHED: " & $sUri & @CRLF )
111- EndSwitch
112- EndFunc ; ==>__MyNetWebView2_WebViewEvents__OnDownloadStateChanged
113-
11476Func _DownloadCancel()
11577 ConsoleWrite (" HotKeyPress: _DownloadCancel" & @CRLF )
11678 $_g_oWeb .CancelDownloads(" https://fosszone.csd.auth.gr/tdf/libreoffice/stable/25.8.4/win/x86_64/LibreOffice_25.8.4_Win_x86-64.msi" )
0 commit comments