Jump to content

Recommended Posts

Posted

Hello,

Below is an example script, what I am looking to do is have a text file with a list of data. When i cycle through that list of data, I would like to summarize that actions that take place. So say for every $x there is either an Error 0 or Error 1. At the end of the script how can summarize how many times Error 0 ran and how many times Error 1 ran.

Thanks,

#Include <File.au3>
Global $read
$logdir = @ScriptDir & "\test.log"
FileOpen($list)
If Not _FileReadToArray($list, $read) Then
   MsgBox(48,"Summary", " Error reading list.")
   Exit
EndIf
For $x = 1 to $read[0]
$commmand = "example.exe /" & $read[$x]
$return = Run ($commmand,@ScriptDir,@SW_HIDE)
If $return = 0 Then
  _FileWriteLog($logdir, "Error 0")
ElseIf $return = 1 Then
  _FileWriteLog($logdir, "Error 1")
Else
Exit
EndIf

Next
Posted

Put a counter inside each, if you only just want the counts of pass/fail.

; put this outside of the loop

$iFail = 0

$iPass = 0

; then inside the loop:

If $return = 0 Then

$iFail =+ 1

_FileWriteLog($logdir, "Error 0")

ElseIf $return = 1 Then

$iPass=+ 1

_FileWriteLog($logdir, "Error 1")

Else

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

hello thanks for you help!

When i did $iPass=+ 1, it was only giving me a 1 at the end of my script. I modified it to $iPass=$iPass+ 1 in the loop and it worked!

I was thinking way above and beyond for how to accomplish this task haha.

Thanks again

Posted

  On 2/16/2012 at 11:32 PM, 'gr1fter said:

hello thanks for you help!

When i did $iPass=+ 1, it was only giving me a 1 at the end of my script. I modified it to $iPass=$iPass+ 1 in the loop and it worked!

I was thinking way above and beyond for how to accomplish this task haha.

Thanks again

It is not like this $iPass=+ 1 but should be like $iPass+= 1.

Posted

IanN1990,

Look at this >> http://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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