Jump to content

error handling


Joon
 Share

Recommended Posts

  • Moderators

Is there way to surpress any error message from AutoIt? Have it just quit without and dialog.

Such as these kind of errors.

Dim $array[2]
$array[3] = 2
Code it correctly?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Just set the script to restart...

If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut')
    Exit
EndIf

Crash'n'Burn silently.

I was being funny... I hope you took it as that, I searched all over... and couldn't find anything but MHz's COM error handling, and low and behold, look who posts a solution :).

Edit:

Now I'm wondering if this was a joke :mellow:? No matter what the situation, an error or not... Mine bites the dust. Have a working example MHz?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Developers

I was being funny... I hope you took it as that, I searched all over... and couldn't find anything but MHz's COM error handling, and low and behold, look who posts a solution :).

Edit:

Now I'm wondering if this was a joke :mellow:? No matter what the situation, an error or not... Mine bites the dust. Have a working example MHz?

Did you compile it and run the EXE ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

Did you compile it and run the EXE ?

LOL...yeah... Went APE **** :) Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

thats....

SHOW ME SOME SCRIPT

8)

you changed it???

Yeah... cuz it looked like I was demanding Jdeb to show me a script... and I was trying to be funny... Soooo I just edited it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Developers

Try this version:

If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut /Dummy')
    Exit
EndIf

Dim $array[2]
$array[3] = 2

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

Try this version:

If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut /Dummy')
    Exit
EndIf

Dim $array[2]
$array[3] = 2
I didn't know if I should try that version!!! ... /Dummy felt like it was pointed at me :)

Yes this one works perfectly!!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Developers

... /Dummy felt like it was pointed at me :)

Sort of .... nah not really ....

Just expected you to solve this yourself ... :mellow:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

Hmm, time for another tasty Cocktail to wet the taste. Oh, SmOke_N, is that some kinda loop ya saying. It needs another edit to make me loop again. :)

This is what I ran ... I ran it both ways... With an error and without
If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut')
    Exit
EndIf

HotKeySet('{END}', 'TestSilentExitOnly')
HotKeySet('{PAUSE}', 'TestSilentExitRestart')
HotKeySet('ESC', 'EXITNOW')

While 1
    Sleep(1000)
WEnd

Func TestSilentExitOnly()
    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 1', $array[2])
EndFunc

Func TestSilentExitRestart()

    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 2', $array[2])
EndFunc

Func EXITNOW()
    Exit
EndFunc

Then With Jdebs /Dummy it works:

If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut /Blah')
    Exit
EndIf

HotKeySet('{END}', 'TestSilentExitOnly')
HotKeySet('{PAUSE}', 'TestSilentExitRestart')
HotKeySet('ESC', 'EXITNOW')

While 1
    Sleep(1000)
WEnd

Func TestSilentExitOnly()
    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 1', $array[2])
EndFunc

Func TestSilentExitRestart()

    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 2', $array[2])
EndFunc

Func EXITNOW()
    Exit
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Goes to show, if you want no errors silently, then you need to toss some errors in, to make it work. Good work, JdeB.

Edit:

Sorry, my example did go stupid with executing...

Edited by MHz
Link to comment
Share on other sites

  • Moderators

Sort of .... nah not really ....

Just expected you to solve this yourself ... :mellow:

I deserve that I guess :):)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

This is what I ran ... I ran it both ways... With an error and without

If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut')
    Exit
EndIf

HotKeySet('{END}', 'TestSilentExitOnly')
HotKeySet('{PAUSE}', 'TestSilentExitRestart')
HotKeySet('ESC', 'EXITNOW')

While 1
    Sleep(1000)
WEnd

Func TestSilentExitOnly()
    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 1', $array[2])
EndFunc

Func TestSilentExitRestart()

    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 2', $array[2])
EndFunc

Func EXITNOW()
    Exit
EndFunc

Then With Jdebs /Dummy it works:

If Not $CMDLINE[0] Then
    Run(@ScriptFullPath & ' /ErrorStdOut /Blah')
    Exit
EndIf

HotKeySet('{END}', 'TestSilentExitOnly')
HotKeySet('{PAUSE}', 'TestSilentExitRestart')
HotKeySet('ESC', 'EXITNOW')

While 1
    Sleep(1000)
WEnd

Func TestSilentExitOnly()
    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 1', $array[2])
EndFunc

Func TestSilentExitRestart()

    Local $array[3]
    $array[2] = 2
    MsgBox(0, 'Testing 2', $array[2])
EndFunc

Func EXITNOW()
    Exit
EndFunc
I'm sure what I am doing wrong but there was no error in your code. If throw in error, it still display error message.

The problem I am facing is that my script runs from the network share. When network connect is lost users will get error message on next step on the script (attached). This is what I want to surpress.

Posted Image

Note: they still have connection to the database just not to the fileshare.

Edited by Joon
Link to comment
Share on other sites

  • Developers

I'm sure what I am doing wrong but there was no error in your code. If throw in error, it still display error message.

The problem I am facing is that my script runs from the network share. When network connect is lost users will get error message on next step on the script (attached). This is what I want to surpress.

Posted Image

Note: they still have connection to the database just not to the fileshare.

For com errors you need to use the COM error handler ...

is explained in the Helpfile ...

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...