begunrom Posted March 13, 2018 Share Posted March 13, 2018 Hi, I encounter the following behavior: I I remove the line with the error handler, I get an error in IE.au3 >"C:\temp\autoIT\autoit-v3\SciTe\..\autoit3.exe" /ErrorStdOut "C:\temp\CyberArk\connectors\bug_sample.au3" RunEIO365--> Title = '' RunEIO365--> Locationurl = 'about:blank' "C:\temp\autoIT\autoit-v3\Include\ie.au3" (1784) : ==> The requested action with this object has failed.: Return SetError($_IESTATUS_Success, 0, $oObject.document) Return SetError($_IESTATUS_Success, 0, $oObject^ ERROR >Exit code: 1 Time: 6.726 If I enable the error handler, I can see the root cause. Apparently I need elevated rights to do this. >"C:\temp\autoIT\autoit-v3\SciTe\..\autoit3.exe" /ErrorStdOut "C:\temp\CyberArk\connectors\bug_sample.au3" RunEIO365--> Title = '' RunEIO365--> Locationurl = 'about:blank' C:\temp\CyberArk\connectors\bug_sample.au3 (1784) : ==> COM Error intercepted ! err.number is: 0x80020009 err.windescription: Exception occurred. err.description is: Access is denied. err.source is: err.helpfile is: C:\Windows\System32\mshtml.hlp err.helpcontext is: 0 err.lastdllerror is: 0 err.scriptline is: 1784 err.retcode is: 0x80070005 As I do not want this program to run with elevated rights, It would be a benefit that this error could be handled by the library, instead of causing the code to fail. Link to comment Share on other sites More sharing options...
BrewManNH Posted March 13, 2018 Share Posted March 13, 2018 Post your code so we can see what you're doing. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
begunrom Posted March 13, 2018 Author Share Posted March 13, 2018 Sorry I forgot to attach the code. expandcollapse popup#include <ie.au3> #include <Timers.au3> ;#RequireAdmin _IEErrorHandlerRegister(_User_ErrFunc) _Example() Func _Example() Local $oIE = _IECreate('https://login.microsoftonline.com/', 0, 1, 0) Local $TARGETWEBSITE="https://login.microsoftonline.com/" Local $i = 1 Local $aIE[1] $aIE[0] = 0 While 1 $oIE = _IEAttach("", "instance", $i) If @error = $_IEStatus_NoMatch Then ExitLoop ReDim $aIE[$i + 1] $aIE[$i] = $oIE $aIE[0] = $i $i += 1 Local $sTitle = _IEPropertyGet ($oIE, "title" ) If (($stitle = "") and (@error = 0)) Then ConsoleWrite("RunEIO365--> Title = '" & $stitle & "'" & @CRLF) Local $sLocationurl = _IEPropertyGet ( $oIE, "locationurl" ) If (((StringInStr($sLocationurl,$TARGETWEBSITE) > 0 ) or ($sLocationurl = "about:blank")) and (@error = 0)) Then ConsoleWrite("RunEIO365--> Locationurl = '" & $sLocationurl & "'" & @CRLF) _IELoadWait_ForAllFrames($oIE,0,3000) If @error = 0 Then Return SetError($_IESTATUS_Success, 0, 1) Else Return SetError(@error, @extended, -1) EndIf ;EndIf ConsoleWrite("RunEIO365--> Exit Loop" & @CRLF) ExitLoop EndIf EndIf WEnd Local $hStarttime = _Timer_Init() _IELoadWait($oIE) ConsoleWrite('> 1 = ' & _Timer_Diff($hStarttime) & @CRLF) _IELoadWait_ForAllFrames($oIE) ConsoleWrite('> 2 = ' & _Timer_Diff($hStarttime) & @CRLF) _IEQuit($oIE) EndFunc ;==>_Example Func _IELoadWait_ForAllFrames(ByRef $oObject, $iDelay = 0, $iTimeout = Default) ConsoleWrite("_IELoadWait_ForAllFrames--> $iDelay = '" & $iDelay & "' $iTimeout = '" & $iTimeout & "'" &@CRLF) _IELoadWait($oObject, $iDelay, $iTimeout) If @error Then Return SetError(@error, @extended, -1) Local $oFrames_coll = _IEFrameGetCollection($oObject) #forceref $oFrames_coll Local $iNumFrames = @extended Local $oFrame = Null For $iFrame_idx = 0 To ($iNumFrames - 1) ConsoleWrite("_IELoadWait_ForAllFrames--> $iFrame_idx = '" & $iFrame_idx & "'" & @CRLF) $oFrame = _IEFrameGetCollection($oObject, $iFrame_idx) _IEDocGetObj($oFrame) If Not @error Then ConsoleWrite("_IELoadWait_ForAllFrames--> Waiting till frame is loaded" & @CRLF) _IELoadWait($oFrame, $iDelay, $iTimeout) ConsoleWrite("_IELoadWait_ForAllFrames--> Frame is loaded" & @CRLF) If @error Then Return SetError(@error, @extended, -1) EndIf Next Return SetError($_IESTATUS_Success, 0, 1) EndFunc ;==>_IELoadWait_ForAllFrames ; Users COM error function. Func _User_ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptFullPath & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_User_ErrFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now