@@ -214,6 +214,8 @@ Func _NetWebView2_Initialize($oWebV2M, $hUserGUI, $s_ProfileDirectory, $i_Left =
214214 Local $iMessage
215215 Do
216216 __NetWebView2_Sleep(10 )
217+ If @error Then Return SetError (@error , @extended , ' ' )
218+
217219 $iMessage = __NetWebView2_LastMessage_KEEPER($oWebV2M )
218220 If $iMessage = $NETWEBVIEW2_MESSAGE__INIT_FAILED _
219221 Or $iMessage = $NETWEBVIEW2_MESSAGE__PROFILE_NOT_READY _
@@ -468,8 +470,9 @@ Func _NetWebView2_LoadWait($oWebV2M, $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE
468470 __NetWebView2_LastMessage_Navigation($oWebV2M , $NETWEBVIEW2_MESSAGE__NONE )
469471
470472 While 1
471- ; Allow AutoIt to "breathe" and process the GUI messages
473+ ; Allow AutoIt to "breathe" and process the GUI messages, also allow user to abort
472474 __NetWebView2_Sleep(10 )
475+ If @error Then Return SetError (@error , @extended , ' ' )
473476
474477 ; RULE 1: If we reached the target status or higher
475478 Local $bWebIsReady = $oWebV2M .IsReady
@@ -721,14 +724,14 @@ EndFunc ;==>_NetWebView2_GetSource
721724; Name ..........: _NetWebView2_NavigateToPDF
722725; Description ...: Navigate to a PDF (local PDF file or online direct URL link to PDF file)
723726; Syntax ........: _NetWebView2_NavigateToPDF($oWebV2M, $s_URL_or_FilePath[, $s_Parameters = ''[, $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE_CHANGED[,
724- ; $sExpectedTitle = ""[, $iTimeOut_ms = 5000[, $iSleep_ms = 1000[, $bFreeze = True]]]]]])
727+ ; $sExpectedTitle = ""[, $iTimeOut_ms = 5000[, $iSleepAfter_ms = 1000[, $bFreeze = True]]]]]])
725728; Parameters ....: $oWebV2M - an object.
726729; $s_URL_or_FilePath - a string value.
727730; $s_Parameters - [optional] a string value. Default is ''.
728731; $iWaitMessage - [optional] an integer value. Default is $NETWEBVIEW2_MESSAGE__TITLE_CHANGED.
729732; $sExpectedTitle - [optional] Expected title to LoadWait for, as StringRegExp() pattern, By Default vaule it will compute the $s_URL_or_FilePath to guess RegExp for the Title
730733; $iTimeOut_ms - [optional] Maximum time to wait in milliseconds. 0 for infinite. Default is 5000ms
731- ; $iSleep_ms - [optional] an integer value. Default is 1000.
734+ ; $iSleepAfter_ms - [optional] an integer value. Default is 1000.
732735; $bFreeze - [optional] a boolean value. Default is True.
733736; Return values .: None
734737; Author ........: mLipok
@@ -738,7 +741,7 @@ EndFunc ;==>_NetWebView2_GetSource
738741; Link ..........:
739742; Example .......: No
740743; ===============================================================================================================================
741- Func _NetWebView2_NavigateToPDF($oWebV2M , $s_URL_or_FilePath , Const $s_Parameters = ' ' , $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , $sExpectedTitle = Default , $iTimeOut_ms = 5000 , Const $iSleep_ms = 1000 , Const $bFreeze = True )
744+ Func _NetWebView2_NavigateToPDF($oWebV2M , $s_URL_or_FilePath , Const $s_Parameters = ' ' , $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , $sExpectedTitle = Default , $iTimeOut_ms = 5000 , Const $iSleepAfter_ms = 1000 , Const $bFreeze = True )
742745 Local Const $s_Prefix = " [_NetWebView2_NavigateToPDF]: URL_or_File:" & $s_URL_or_FilePath ; #TODO suplement
743746
744747 If (Not IsObj ($oWebV2M )) Or ObjName ($oWebV2M , $OBJ_PROGID ) <> ' NetWebView2Lib.WebView2Manager' Then Return SetError (1 , 0 , " ERROR: Invalid Object" )
@@ -771,7 +774,9 @@ Func _NetWebView2_NavigateToPDF($oWebV2M, $s_URL_or_FilePath, Const $s_Parameter
771774 $oWebV2M .LockWebView()
772775 If $bFreeze Then __NetWebView2_freezer($oWebV2M , $idPic )
773776 _NetWebView2_Navigate($oWebV2M , $s_URL_or_FilePath , $iWaitMessage , $sExpectedTitle , $iTimeOut_ms )
774- If Not @error Then __NetWebView2_Sleep($iSleep_ms )
777+ If Not @error Then __NetWebView2_Sleep($iSleepAfter_ms )
778+ If @error Then Return SetError (@error , @extended , ' ' )
779+
775780 __NetWebView2_Log(@ScriptLineNumber , $s_Prefix , 1 )
776781 If $bFreeze And $idPic Then __NetWebView2_freezer($oWebV2M , $idPic )
777782 $oWebV2M .UnLockWebView()
@@ -1118,7 +1123,7 @@ EndFunc ;==>_NetJson_EncodeB64
11181123; ===============================================================================================================================
11191124Func __NetWebView2_Sleep($iPause )
11201125 $_g_bNetWebView2_Sleep ($iPause )
1121- If @error Then Return SetError ($NETWEBVIEW2_MESSAGE__USER_ABORT )
1126+ If @error Then Return SetError ($NETWEBVIEW2_MESSAGE__USER_ABORT , @extended )
11221127EndFunc ; ==>__NetWebView2_Sleep
11231128
11241129; #INTERNAL_USE_ONLY# ===========================================================================================================
@@ -1166,6 +1171,8 @@ Func __NetWebView2_WaitForReadyState($oWebV2M, $hTimer, $iTimeOut_ms = 5000)
11661171 Return SetError (1 , 0 , False )
11671172 EndIf
11681173 __NetWebView2_Sleep(50 )
1174+ If @error Then Return SetError (@error , @extended , ' ' )
1175+
11691176 WEnd
11701177EndFunc ; ==>__NetWebView2_WaitForReadyState
11711178
0 commit comments