Leaderboard
Popular Content
Showing content with the highest reputation on 02/14/2022 in all areas
-
@Doniel Nice going. Glad you could use the pipe solution easily like you did. Cya around.1 point
-
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to Gianni for a topic
ok what @water said, is the right way. ...also, and just for the record... if you don't want to use something like ObjEvent ("AutoIt.Error", ...) there is also another "quick and dirty" workaround to avoid crashes that I've seen used by @genius257 here: https://www.autoitscript.com/forum/topic/185387-value-of-js-variable-in-ie/?do=findComment&comment=1332372 and explained here: https://www.autoitscript.com/forum/topic/185387-value-of-js-variable-in-ie/?do=findComment&comment=1332585 in short you could wrap your "$oIE.document.parentWindow.location.href" (or whatever) in an Execute() statement and check for errors right after the call, that way you can see if something went wrong without a "crash", something like this: $vResult = Execute('$oIE.document.parentWindow.location.href') If @error Then Exit MsgBox(0, 'sorry', '...something went wrong.')1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to mLipok for a topic
it was fixed: https://www.autoitscript.com/trac/autoit/ticket/3167 and is in recent beta: There is workaround, you should split this: $oIE.document.parentWindow.location.href into: Local $oCOMErrorHandler = ObjEvent("AutoIt.Error") Local $oDocument = $oIE.document if @error ..... Local $oWindow = $oDocument.parentWindow if @error ..... Local $oLocation = $oWindow.location if @error ..... Local $sHREF = $oLocation.href if @error .....1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to water for a topic
I think you misunderstood the OPs problem. When IE is closed while the script is still running it will crash the next time it tries to access the IE object.1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to ad777 for a topic
@Letraindusoir object is no longer existing or unusable? Do ; ProcessClose("iexplore.exe") Sleep(100) Until (Not ProcessExists("iexplore.exe")) Sleep(2000) ConsoleWrite(@CRLF & "Obj is Unusable" & @CRLF & @CRLF) For $i = 0 To 20 ;ConsoleWrite("isObj($oIE) = " & IsObj($oIE) & @CRLF) Next1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to water for a topic
The only solution to this problem is to avoid nesting: #include <IE.au3> Global $oIE = _IECreate("http://www.autoitscript.com") Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrorFunc") For $i = 0 To 20 ConsoleWrite("isObj($oIE) = " & IsObj($oIE) & @CRLF) Next Do ProcessClose("iexplore.exe") Sleep(100) Until (Not ProcessExists("iexplore.exe")) Sleep(2000) ConsoleWrite(@CRLF & "ProcessClosed...." & @CRLF & @CRLF) For $i = 0 To 20 ConsoleWrite("isObj($oIE) = " & IsObj($oIE) & @CRLF) Next ; Global $sURL = $oIE.document.parentWindow.location.href ; COM Error handler does not return the error raised by document but by href. Does value does not explain the real problem! Global $oDocument = $oIE.document if @error = 0x800706BA Then Exit MsgBox(0, "Error #1", "RPC-Server is no longer available - means: IE has been closed by user!") Global $sURL = $oDocument.parentWindow.location.href Func _ErrorFunc($oError) ConsoleWrite(@ScriptName & " (" & $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 ;==>_ErrFunc As IE is no longer available, we know that the error occurs after the first operation. If the first operation is successful we can then use nested oprations.1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to Nine for a topic
@waterOn Win7, I get to have error #1 but the error number returned by @error is 1 (I removed the exit). Only second error returns 0x800706BA.1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to water for a topic
This works for me: #include <IE.au3> Global $oIE = _IECreate("http://www.autoitscript.com") Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrorFunc") For $i = 0 To 20 ConsoleWrite("isObj($oIE) = " & IsObj($oIE) & @CRLF) Next Do ProcessClose("iexplore.exe") Sleep(100) Until (Not ProcessExists("iexplore.exe")) Sleep(2000) ConsoleWrite(@CRLF & "ProcessClosed...." & @CRLF & @CRLF) For $i = 0 To 20 ConsoleWrite("isObj($oIE) = " & IsObj($oIE) & @CRLF) Next Global $sURL = $oIE.document.parentWindow.location.href ; COM Error handler does not return the error raised by document but by href. Does value does not explain the real problem! if @error = 0x800706BA Then Exit MsgBox(0, "Error #1", "RPC-Server is no longer available - means: IE has been closed by user!") Global $oDocument = $oIE.document if @error = 0x800706BA Then Exit MsgBox(0, "Error #2", "RPC-Server is no longer available - means: IE has been closed by user!") Func _ErrorFunc($oError) ConsoleWrite(@ScriptName & " (" & $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 ;==>_ErrFunc You will notice that you only get message "Error #2". But you get 2 COM errors written to the console with the same error code. The problem is caused by AutoIt having problems with nested COM operations where more than 1 operation fails. This could cause the crashes you encounter!1 point -
How to judge that the object is no longer existing or unusable?
Letraindusoir reacted to Nine for a topic
I would like to see a script that causes AutoIt to crash because of the use of ObjEvent. I am using it all the time, and never seen a crash caused by it. Really would love to see a replicable script...1 point -
I wrote a function for someone else, replacing text in "Text Boxes" that might help:1 point