
SchneiMi
Members-
Posts
18 -
Joined
-
Last visited
SchneiMi's Achievements

Seeker (1/7)
0
Reputation
-
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
It would be very nice, if someone would test the script, please! Or the even Shorter one in my stackoverflow - post: 48283903/internet-explorer-com-objects-accessed-by-autoit-stop-working-during-runtime When compiled to exe, no error seems to occur. Neither on my Win 10 Laptop, only on the Win 7 64-bit Laptop. A friend of mine tested on his Win7 64-bit and it crashed, too. -
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Hello water, I have designed a test script, according to how I understood your description and Workaround. I have two modes that do the same Thing, open a Website and reading the href prop of some arbitrary link. But in one mode, I Access the property in one chain call, in the other I split the path and always call the next element on the previously created AutoIt variable/pointer. The only Thing I do not recreate every Loop, is the reference to the Webbrowser. But as a result, the program crashes in both modes between roughly 4080 and 4150 Loops (quite reproducibly). Here's the Code. The run takes some time, but I would highly appreciate if someone could tell me if it crashes there, too. I use a Laptop with Windows 10 Enterprise, btw: Screenshot of two runs' Errors (mode "chain" with long com object paths) is attached. The last lines with error message from mode 2 (split com object calls) is as follows: Did I make a mistake? It Looks like I'm at a dead end. Isn't there any way to prevent the reference from breaking? If I don't Exit the Loop, the behaviour still doesn't go back to normal. I am open for any ideas! Thank you Michael -
COM object loses functionality after some calls
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Maybe this helps, it's another example from the same script, here from a function that builds up a Connection to MS Excel and saving some references in AutoIt variables. SciTE Output: I think this is Close to what you asked for, assigning the Sheet object "Mapped" from the Collection to $oSheet. Ok, the next step would have been to save a collection's reference in an extra variable, but it is clear that the Collection object is accessible, returning the correct number of contained Sheets. -
COM object loses functionality after some calls
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
What is the Intention behind this Approach, how would it avoid the Problem? The script runs smoothly for an arbitrary amount of time, when suddenly I cannot Access an object that I could Access just before? In one function call I get the error on getElementsByName of the fireEvent line, another time .value = $sReference line. Does AutoIt choke on calling com objects in a path, like $oIE.document.url...? Water mentioned in a parallel thread that there have been Problems in older versions of AutoIt when accessing com object paths. Last but not least, it would be difficult to implement this Workaround/way in my script for the full path of 100-200 com object calls. And the occurrance of Errors is also not reliable. This morning I've got an error after about 5 tries, now I don't get an error in 50 tries. :-( -
Hello, it is difficult to explain. I have a script that works most of the time. But when I continue to call f.i. Action "search reference", I get Trouble - depending on the error handling Framework. Background: I have created a gui with several Buttons to call individual Actions. "open file", "search reference", "start Transfer" ... When I click "search reference", the function searchReference is called. The function attaches to or creates a new IE browser object, opens a search form, enters some query data and clicks the search button. Here's the beginning of the func Code: Without ObjEvent handler, it either runs through, or after some times a window Pops up "AutoIt v3 Script doesn't work anymore" (translated) => Button "Close program". Exit Code: 3221225477. Or I get an error: Or another time this one: Later I Extended it by lines to check for com Errors and savely return with False: With the Default _IE error handler I get SciTE output: Last line gives the hint where it happened in the Code. It is generated by the checkError-function. Why does it work most of the time, and sometimes Reports one or another or a third different error, although the site is visible and complete in the Background, all the time. The fields are definitely all there and when I enter the Code to Access the dom objects in the IE console, they are always found. :-( BR Michael
-
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Thanks for the notice. Sounds like what I've read in the old script. But it's not the intuitive and expected behaviour, as Eval is supposed to evaluate and return expressions and comparisons, while Excecute is expected to perform Actions/methods and assignments, as it works in Python, CA-Realizer and any other language I know that Supports execute Statements. At least it should be mentioned in the documentation (that it unexpectedly works like Eval for assignments). However, in my case, this Workaround is not useful, then. Because the test for Access to the com object/method works fine, but the Problem Comes from the actual assignment, which throws the fatal autoit error. -
That is part of the Workaround described here https://www.autoitscript.com/forum/topic/191838-stop-fatal-errors-from-crashing-script-run/ I have to assign to a DOM element of a Website that has a script running in the Background and cutting/replacing parts of the dom structure. So I cannot make sure the element exists, before actually trying to assign to it. When by Chance, the targeted DOM element was cut just before I try to Access it, two Errors occur. 1st the com-error for referring to a non existent object or Attribute and 2nd a fatal AutoIt error for assigning to the non existent item. I can catch the com error with an ObjEvent handler. But I cannot stop the AutoIt error from stopping the script run. Running the Actions by Execute will throw the com error and savely return 1 in case of a fatal AutoIt error. That's why I wanted to place all critical com Actions into Execute Statements and evaluate the @error codes. I hope that explains the Approach. However, I am open for better Solutions. It's just my current state of work.
-
Hello, following my previous question, I have moved all potentially instable object interactions into Executes. But it Looks like "="-assignments to object Attributes cannot be done with Execute, only method calls. Using an "$obj = 1" construct, it compares (Eval) instead of sets (Execute) the value. I have tested multiple different combinations, using Execute and Assign, but it seems not to work with object Attributes. :-( Gives following Output: The assign Action using apply (a3) Fails, while assigning it directly, without Assign() works fine. The execute versions compare and do not assign, in both cases. Though, the "Execute" topic in the help file says it executes, not evaluates. I have found a similar, old thread, which explains this behavious but does not give a solution. https://www.autoitscript.com/forum/topic/110228-pass-object-property-as-a-variable/ Is there a way to assign to a com object's Attribute? Or is there anything new to this unexpected behaviour of Execute (at least compared to the help file description and Python's exec). Any help is appreciated, and thank you for all the help so far. Regards, Michael
-
SchneiMi reacted to a post in a topic: Pass object property as a variable
-
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
NOTE: That was an EXAMPLE for an assignment. I know that I can use _IENavigate to change the site. As example, I could as well have used $oIE.document.title = 'new title'. The question Points at how to make an assignment to a com object, not at navigating to another site. Thanks -
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Don't know if I should open a new thread. I have tried to replace the direct calls in my Code by Execute("<Code>"), which works for most cases, but not with assignment to the COM Attribute. Do I do something wrong? How can I call this assinment in a fatal-error-save way, too? BR Michael -
SchneiMi reacted to a post in a topic: Stop fatal errors from crashing script run
-
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Ok. This line does not stop the script. It stops at the assignment. But I have just tried it and YESS, it Looks like this is the solution!!! At least a Workaround! The com error is thrown, but not the AutoIt fatal that stops the execution: Just prints 1. Thanks a lot! :-)))))))) -
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
I use Version 3.3.14.2 Sorry, "Crash" was not the best word in this context. It is an AutoIt error that stops the script run. With info that the metod cannot be used with the obj. Although it was validated just before. In fact, apart from that, also the whole script crashes after running for some time, with just a popup window that the script stopped working and was closed. -
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Thank you farouk. Ok, but how can this help to assure the assignment? Also without Execute, at least These two lines work well. If the element is not available, a com error is throught, that is caught in the second line and the function ist left with False. If the Elements exists, we proceed to the assignment, where the element may just be cut. In General, I would like to avoid eval() and execute(), if possible. But I will use it if it's a working Workaround. -
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
This shall not Sound unpolite: I think I have condensed the non-reproducible error quite well. I don't know what Code I should post and how it would help you. Maybe the just posted example Code can Show what I mean? The Problem there Comes at the assignment of "done" to a non existing DOM element (example function's line 5). It says that the attribute or method of the com object does not exist. How can I stop this error from stopping the run? -
Stop fatal errors from crashing script run
SchneiMi replied to SchneiMi's topic in AutoIt General Help and Support
Hello all, thanks a lot for your quick Responses!! Since weeks, I very deeply read into and worked with the topic and use ObjEvent and custom handlers in many different approaches. As a result, I tried to express my initial question very carefully and to point out that simply catching COM errors with ObjEvent and a registered callback alone will not do the trick. :-( The question is: How to avoid fatal AUTOIT errors from crashing the script run, in an environment that does NOT allow to ensure the COM object will still be available at the time of assignment (because the asynchronous callback may strike just after checking the old DOM element). Is it possible in the newest version, at all? Or is AutoIt the wrong program for the Job? @Somerset: I cannot post the script here, because it contains corporate data. And apart from that, I don't think that real Code (all 1500 lines?) would make much sense, because the Errors occur at very different places and only sometimes (not reproducible). In pseudo/example Code it is something like this Sometimes this code would end with a fatal error in the assignment line of the element (example's line 5), but most times it runs through. Until recently, in example's line 3 I did like But the @error was always 0. I found out that the reason is IsObj, which is an AutoIt function that resets the error macro. So I stepped down to having AutoIt just trying to access the object and I can then catch the COM error from the IE.au3 standard handler. Regards, Michael