Jump to content

Similar to try/catch


Recommended Posts

Hi,

i need something similar to try/catch, but most likely i am coding wrong, because when the error occurs won't be "managed".

 

My code is:

 

$first_index=$Entry_to_Delete_Indexes_2[0]

If @error Then
    Diagram_for_last_day($aFile_Array_Original, $Day_To_Delete)
EndIf

 

If the assignment gives an error because the array-element is not valid, it should launch a function. This is my goal.

 

But the error comes and the program exits.

How should i write this "exception"?

 

Link to comment
Share on other sites

  • Developers

AutoIt3 doesn't have that option other than to test for @error after you perform a function.

Jos

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

  • Developers

Test that before you use it in case you want to know for sure.

use IsArray() to check whether it is an Array and use UBound() to determine whether the index number is available.

Jos

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...