LoneWolf_2106 Posted December 1, 2017 Share Posted December 1, 2017 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 More sharing options...
Developers Jos Posted December 1, 2017 Developers Share Posted December 1, 2017 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 More sharing options...
LoneWolf_2106 Posted December 1, 2017 Author Share Posted December 1, 2017 Okay, how can i code that if an element is not accessible a function should be called? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 1, 2017 Developers Share Posted December 1, 2017 Not sure I understand your question, so can you give me an example in AutoIt? 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 More sharing options...
LoneWolf_2106 Posted December 1, 2017 Author Share Posted December 1, 2017 Hi Jos, thanks for your support. If my element $Entry_to_Delete_Indexes_2[0] is not accessible then...... Link to comment Share on other sites More sharing options...
Developers Jos Posted December 1, 2017 Developers Share Posted December 1, 2017 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 More sharing options...
LoneWolf_2106 Posted December 1, 2017 Author Share Posted December 1, 2017 Thanks Jos, it worked :-) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now