Jump to content

Getting an error with arrays...


Skitty
 Share

Recommended Posts

If you need your script to be up and running 24 hrs you could write a second script to check every x seconds if the main script is still running. If not restart it or send an email or do whatever you want ...

the problem is that the script is still runing when the error occurs, showing the message box of the error. i didn't find a way to disable this default message.

Link to comment
Share on other sites

Hi hohenheim,

I'd suggest to do as iamtheky suggests, and just "Exit" if the situation appears:

#include <array.au3>

Dim $aArray[5]
$aArray[0] = 1
$aArray[1] = 2
$aArray[2] = 3
$aArray[3] = 4
$aArray[4] = 5

for $i = 0 to 5

    If $i > ubound ($aArray) - 1 Then
        msgbox (0, '' , "number of array elements exceeded")
        exitloop
    EndIf

    msgbox (0, '' , $aArray[$i])

    Next

But also I'd write a second script like this:

While 1
  $id = Run("yourfirstscript")
  ProcessWaitClose($id)
  ;Put in an optional Sleep:
  ;Sleep(1000)
WEnd

This will restart your first script / exe everytime it is closed.

Edited by Hannes123
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi hohenheim,

I'd suggest to do as iamtheky suggests, and just "Exit" if the situation appears:

But also I'd write a second script like this:

While 1
  $id = Run("yourfirstscript")
  ProcessWaitClose($id)
  ;Put in an optional Sleep:
  ;Sleep(1000)
WEnd

This will restart your first script / exe everytime it is closed.

I already have a "parent" script that launches this annoying one, with the function RunWait, And treat the exit code when the program ends, Adding a third script is too much I think.

Link to comment
Share on other sites

I already have a "parent" script that launches this annoying one, with the function RunWait, And treat the exit code when the program ends, Adding a third script is too much I think.

In that case just use the /ErrorStdOut suggestion from AdmiralAlkex to avoid the msgbox with the first script.

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