Sign in to follow this  
Followers 0
fielmann

Error handling with autoit

6 posts in this topic

Hello autoit-friends ;)

;~~~~~~~~~~~~~~ snip ~~~~~~~~~~~~~~

#include <IE.au3>

while 1=1

$oIE = _IECreate ("http://www.myhomepage.com/")

$sText = _IEBodyReadText ($oIE)

$result = StringInStr($sText, "welcome")

if $result =0 then msgbox(0,"error", "problem",10)

_IEQuit ($oIE)

wend

;~~~~~~~~~~~~~~ snap ~~~~~~~~~~~~~~

The script works, but when I cut my internet connection the script stops with the message:

Title: AutoIt Error

Line 2774 (File "C:\Programme\AutoIt3\Include\IE.au3"):

$o_object.GoBack ()

$o_object.GoBack ()^ ERROR

Error: The requested action with this object has failed.

:)

What can I do that the script is continuing?

How to handle the error?

Any idea is welcome!

Carsten

Share this post


Link to post
Share on other sites



Hello autoit-friends :D

;~~~~~~~~~~~~~~ snip ~~~~~~~~~~~~~~

#include <IE.au3>

while 1=1

$oIE = _IECreate ("http://www.myhomepage.com/")

$sText = _IEBodyReadText ($oIE)

$result = StringInStr($sText, "welcome")

if $result =0 then msgbox(0,"error", "problem",10)

_IEQuit ($oIE)

wend

;~~~~~~~~~~~~~~ snap ~~~~~~~~~~~~~~

The script works, but when I cut my internet connection the script stops with the message:

Title: AutoIt Error

Line 2774 (File "C:\Programme\AutoIt3\Include\IE.au3"):

$o_object.GoBack ()

$o_object.GoBack ()^ ERROR

Error: The requested action with this object has failed.

:)

What can I do that the script is continuing?

How to handle the error?

Any idea is welcome!

Carsten

What version of AutoIt are you running? And what version of the IE.au3 UDF? That code does not line up with the given line number in either IE.au3 version 2.3-1 (comes with AutoIt 3.2.10.0), or 2.4-0 (ships with 3.2.11.1-Beta).

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Meaby make it like this?? :)

#include <IE.au3>
while 1
if ping("http://www.myhomepage.com/",1000)=0 then
msgbox(0,"error", "internet connection lost or serwer is down !",5)
ContinueLoop
else
$oIE = _IECreate ("http://www.myhomepage.com/")
$sText = _IEBodyReadText ($oIE)
if StringInStr($sText, "welcome") = 0 then msgbox(0,"error", "problem",10)
_IEQuit ($oIE)
endif
wend
Edited by Uriziel01

Share this post


Link to post
Share on other sites

What version of AutoIt are you running? And what version of the IE.au3 UDF? That code does not line up with the given line number in either IE.au3 version 2.3-1 (comes with AutoIt 3.2.10.0), or 2.4-0 (ships with 3.2.11.1-Beta).

;)

I'm using Version 3.2.4.9 from (May 25th 2007) :)

Share this post


Link to post
Share on other sites

I'm using Version 3.2.4.9 from (May 25th 2007) :)

I've just updatet my AutoIt to Version 3.2.10.0 :(

The problem appears also in the new version :cheer:

I get back the folowing error-message:

>>>> Window <<<<

Title: AutoIt Error

Class: #32770

Position: 448, 155

Size: 351, 165

Style: 0x94C80347

ExStyle: 0x00010108

Handle: 0x000503A8

>>>> Visible Text <<<<

OK

Line 2780 (File "C:\Programme\AutoIt3\Include\IE.au3"):

$o_object.GoBack ()

$o_object.GoBack ()^ ERROR

Error: The requested action with this object has failed.

:D Any idea how to fix it? ;)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I've just updatet my AutoIt to Version 3.2.10.0 :(

The problem appears also in the new version :cheer:

I get back the folowing error-message:

>>>> Window <<<<

Title: AutoIt Error

Class: #32770

Position: 448, 155

Size: 351, 165

Style: 0x94C80347

ExStyle: 0x00010108

Handle: 0x000503A8

>>>> Visible Text <<<<

OK

Line 2780 (File "C:\Programme\AutoIt3\Include\IE.au3"):

$o_object.GoBack ()

$o_object.GoBack ()^ ERROR

Error: The requested action with this object has failed.

:D Any idea how to fix it? ;)

OK, getting to that line requires a call to _IEAction($oIE, "back"), which I don't see in the code you posted. Find out where you are doing this and check the validity of $oIE (or whatever you named the IE object) at that point in your script.

:)

P.S. There is a normal error that occurs if you try to "back" from the first page in the browser. Run this to see it:

#include <IE.au3>
_IEErrorHandlerRegister()
$oIE = _IECreate("http://www.google.com")
Sleep(1000)
; _IENavigate($oIE, "http://www.openoffice.org")
Sleep(1000)
_IEAction($oIE, "back")

If you uncomment the _IENavigate(), then the error goes away, because there is now a page to go "back" to.

But this still appears to have nothing to do with the code you cited in the OP.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0