Jump to content

AutoIt Error Handler


Recommended Posts

Hi ive done as you say and it throws up errors all over the script now. can you post an example please?

thanks

Make sure you're not running Au3check first (or just opt to continue despite the errors). They are in there deliberately to throw errors for the handler to catch.

As for mail examples... It's hard without giving away all my email details, but I can tell you that it does work. If not then use shellexecute('mailto:me@something.com'). It's nowhere near as nice though.

Link to post
Share on other sites

Is it possible to get the AU3 error line number from a compiled script?

Compiled scripts already give you that.

MsgBox(

Compile that and run.

---------------------------

AutoIt Error

---------------------------

Line 1 (File "C:\Users\**\**\**\125.exe"):

Error: Error parsing function call.

---------------------------

OK

---------------------------

Link to post
Share on other sites

Hi

i added the folowing variables before the _autoiterror function

$s_SmtpServer = "smtp.mail.yahoo.com"

$s_FromName = ""

$s_FromAddress = ""

$s_ToAddress = ""

$s_Subject = ""

and filled then with the relevent information. When i run it i get the error box pop up but the following errors before i say continue

C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(34,50) : ERROR: syntax error
MsgBox(0,"" ; this is meant to produce an error !
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(37,21) : ERROR: syntax error
    $msg=GUIGetMsg()
~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(38,14) : ERROR: syntax error
Until $msg=-3
~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(41,21) : ERROR: MsgBox() [built-in] called with wrong number of args.
Func _OnAutoItError()
~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(42,68) : ERROR: 'Return' not allowed from global scope.
    If StringInStr($CmdLineRaw,"/AutoIt3ExecuteScript") Then Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(111,87) : ERROR: syntax error
            _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(117,1) : ERROR: syntax error
EndFunc
^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(16,16) : ERROR: _OnAutoItError(): undefined function.
_OnAutoItError()
~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3 - 8 error(s), 0 warning(s)

then once i get the error pop up and click email i get the following error.

C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(34,50) : ERROR: syntax error
MsgBox(0,"" ; this is meant to produce an error !
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(37,21) : ERROR: syntax error
    $msg=GUIGetMsg()
~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(38,14) : ERROR: syntax error
Until $msg=-3
~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(41,21) : ERROR: MsgBox() [built-in] called with wrong number of args.
Func _OnAutoItError()
~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(42,68) : ERROR: 'Return' not allowed from global scope.
    If StringInStr($CmdLineRaw,"/AutoIt3ExecuteScript") Then Return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(111,87) : ERROR: syntax error
            _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(117,1) : ERROR: syntax error
EndFunc
^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3(16,16) : ERROR: _OnAutoItError(): undefined function.
_OnAutoItError()
~~~~~~~~~~~~~~~^
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3 - 8 error(s), 0 warning(s)
!>18:35:48 AU3Check ended.rc:2
>Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Jamie Cowin\Desktop\test\error handler email.au3"    
C:\Users\Jamie Cowin\Desktop\test\error handler email.au3 (111) : ==> Subscript used with non-Array variable.:
_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject [,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])
_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress ^ ERROR
->18:36:00 AutoIT3.exe ended.rc:1
>Exit code: 1    Time: 13.999

Any ideas?

thanks

Drunken Frat-Boy Monkey Garbage

Link to post
Share on other sites

Take out the '[' and ']'s :graduated:

Can you explain please? Im confused. I am not finding any '[' or ']' in the example from the first post.

When I run the above example I and ignore the same errors it gets stuck in an infinit loop running each gui buttons functions one at a time. even when its compiled.

~GD

Edited by GoogleDude
Link to post
Share on other sites

OK I played around with it enough to where I can get it to work. However it DOES show the line number of the AU3 script it does not show the error line details when a compiled script is run.

The below details only shows when the uncompiled scrip is run. When I run a compiled script it does not include the below. :(

MsgBox(0,"")
~~~~~~~~~~~^

A Compiled script gives me the correct line number but does not give the same error details as a uncompiled script. Can that be done? :graduated:

~GD

Edited by GoogleDude
Link to post
Share on other sites

Can you explain please? Im confused. I am not finding any '[' or ']' in the example from the first post.

When I run the above example I and ignore the same errors it gets stuck in an infinit loop running each gui buttons functions one at a time. even when its compiled.

~GD

This is what I saw on the list of errors :( :

C:\Users\Jamie Cowin\Desktop\test\error handler email.au3 (111) : ==> Subscript used with non-Array variable.:
_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject [,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])
_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress ^ ERROR

OK I played around with it enough to where I can get it to work. However it DOES show the line number of the AU3 script it does not show the error line details when a compiled script is run.

The below details only shows when the uncompiled scrip is run. When I run a compiled script it does not include the below. :D

MsgBox(0,"")
~~~~~~~~~~~^

A Compiled script gives me the correct line number but does not give the same error details as a uncompiled script. Can that be done? :graduated:

~GD

Ok, I see the problem. I'll see what I can do. I wrote another version for one of programs (not sure if I released it or not)... I'll dig it up.
Link to post
Share on other sites

Hi sorry

i think i sorted it i was being an idiot i was just putting in _INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject [,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])directly and trying to declare what the variables where when they are already declared in the inet file. Ive sorted it now and typed it properly _INetSmtpMail ( "myemailsmtp","myfrom" and the next 2 or 3 options as well. I get no errors and it tells me the email has sent however its not getting received in my inbox. ive tried yahoo and o2 smtps

any ideas?

cheers

Drunken Frat-Boy Monkey Garbage

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...