Jump to content
Sign in to follow this  

Running Average Using Arrays

Recommended Posts

I am trying to setup a script that opens various applications, keep track of responce time ( $RT ) and send alerts if the time goes too high.

I have all but the alert part done. The applications it opens are listed as lines in a text file. I figured I would count the number of lines into a variable. We will call that variable $LC. Then I could use it set setup two arrays to keep track of the sum of all response times ( Global $SRT[$LC] ) and total number of attempts ( Global $NA[$LC] ).

Then I could do some math like


then an if statement checking if $RT is greater then 1.2*$AVG

but it does not work and the actual code is too long to post.

Any help?

Share this post

Link to post
Share on other sites

Global $SRT[$Size], $NA[$Size]
Dim $i, $Total_Time, $Total_Attempts

; Get values into $SRT and $NA

$Total_Attempts = 0

For $i = 0 to $Size-1
    $Total_Time = $Total_Time + $SRT[$i]
    $Total_Attempts = $Total_Attempts + $NA[$i]

$AVG = $Total_Time / $Total_Attmpts

Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...