No problem. I have since developed the script further where, in its report, it will now distinguish between new problem printers and ones which it has previously notified on. The new file (PrinterPrevious.dat) is just a list of IP addresses.

 Code:
Global $PreviousIP[200]
$x = Open(1, ".\1PrinterOut.txt", 5)
$x = Open(2, ".\PrinterList.dat", 2)
$x = Open(3, ".\PrinterPrevious.dat", 2)
$x = Open(4, ".\2PreviousOut.txt", 5)

$PreviousIP[0] = ReadLine(3)
$PreviousTotal = 0
While @ERROR = 0
  $PreviousTotal = $PreviousTotal + 1
  $PreviousIP[$PreviousTotal] = ReadLine(3)
Loop
$x = Close(3)

Del ".\PrinterPrevious.dat"
$x = Open(3, ".\PrinterPrevious.dat", 5)

$x = WriteLine(1, "The following printers are getting low on toner, please visit and assist:" + @CRLF + @CRLF)
$x = WriteLine(4, @CRLF + "Previously notified printers:" + @CRLF + @CRLF)
Dim $StoreVals[6]
$EmailNeeded = 0
$PrinterIP = ReadLine(2)
While @ERROR = 0

  ; Check we haven't reported this printer previously
  $PreviousReport = 0
  For $x = 0 To $PreviousTotal
    If $PreviousIP[$x] = $PrinterIP
      $PreviousReport = 1
    EndIf
  Next

  $Cmd = 'snmpget.exe -r:' + $PrinterIP + ' -o:.1.3.6.1.2.1.1.1.0 -q -t:20'
  $CmdResult = WshPipe($Cmd)
  $CmdResult = Join($CmdResult[0], @CRLF)
  $PModel = SubStr($CmdResult, Instr($CmdResult, "X"), (Instr($CmdResult, ";") - Instr($CmdResult, "X")))
  $Count = 0
  $Flag = 0
  $FlagPrevious = 0

  ; If the device is online and the device is a Xerox machine
  If Left($CmdResult, 1) <> "%" AND $PModel <> ""
    ; Get the supported values for a printer type
    $aIniVals = Split(ReadProfileString('.\PrinterData.ini', $PModel, ''), Chr(10))
    ; Make sure the device is one of those listed in the INI file otherwise report an error
    If UBound($aIniVals) > 0
      For Each $IniVal in $aIniVals
        If $IniVal
          $Oid = ReadProfileString('.\PrinterData.ini', $PModel, $IniVal)
          $Cmd = 'snmpget.exe -r:' + $PrinterIP + ' -o:' + $Oid + ' -q -t:20'
          $CmdResult = WshPipe($Cmd)
          $CmdResult = Join($CmdResult[0], @CRLF)
          If $IniVal <> "Location"
            $Cmd = 'snmpget.exe -r:' + $PrinterIP + ' -o:' + SUBSTR($Oid, 1, 23) + "8" + SUBSTR($Oid, 25, 4) + ' -q -t:20'
            $CmdResult2 = WshPipe($Cmd)
            $CmdResult2 = Join($CmdResult2[0], @CRLF)
            $CmdResult = CDbl($CmdResult)
            $CmdResult2 = CDbl($CmdResult2)
            $StoreVals[$Count] = ($CmdResult / $CmdResult2) * 100
          Else
            $StoreVals[$Count] = $CmdResult        
          EndIf
        EndIf
      $Count = $Count + 1
      Next
    Else
      $Count = 1
      $StoreVals[$Count] = "WARNING - Printer Model Not Found : Report this to 3rd line"
    EndIf

    $PrinterText = $PrinterIP + " : " + $PModel
    If $Count > 1
      $PrinterText = $PrinterText + " : " + SubStr($StoreVals[0], 1, Len($StoreVals[0]) - 2)
      For $x = 1 to ($Count - 2)
        If $StoreVals[$x] <= 5
          $PrinterText = $PrinterText + " : " + $aIniVals[$x] + " : " + $StoreVals[$x] + "%"
          $Flag = 1
          $EmailNeeded = 1
        EndIf
      Next
    EndIf

    If $Count = 1
      $PrinterText = $PrinterText + $PrinterIP + " : " + $StoreVals[$Count]
      $Flag = 1
      $EmailNeeded = 1
    EndIf      
  EndIf

  If $Count = 0
    $PrinterText = $PrinterIP + " : Device is offline (check IP)"
    $Flag = 1
    $EmailNeeded = 1
  EndIf

  If $Flag = 1 And $PreviousReport = 0
    $x = WriteLine(1, $PrinterText + @CRLF)
    $x = WriteLine(3, $PrinterIP + @CRLF)
  EndIf

  If $Flag = 1 And $PreviousReport = 1
    $x = WriteLine(4, $PrinterText + @CRLF)
    $x = WriteLine(3, $PrinterIP + @CRLF)
  EndIf

  $PrinterIP = ReadLine(2)
Loop

$x = Close(3)
$x = Close(4)
$x = Close(2)
$x = Close(1)

If $EmailNeeded
  Shell "CMD.EXE /C COPY /B C:\Scripts\*.txt C:\Scripts\Message.txt > nul"
  Shell "CMD.EXE /C C:\Scripts\blat.exe Message.txt -to blahblah@example.com -subject " + Chr(34) + "Printers Low In Toner" + Chr(34) + " -q"
EndIf
Del ".\Message.txt"
Del ".\1PrinterOut.txt"
Del ".\2PreviousOut.txt"
Exit


Edited by kelp7 (2015-12-22 10:32 AM)