Quantcast
Channel: AutoIt v3 - Developer Chat
Viewing all articles
Browse latest Browse all 750

Passing Array to Inet.au3 for Email Log

$
0
0

I have a seemingly simple question that I cannot figure out the answer to. I am using <Inet.au3> to create and send an email log to myself. Everything works dandy but I want to parse an array earlier in my script to attach to the email (no more than a filtered file listing). So here is what I have:

AutoIt         
  1. #include <File.au3>
  2. #include <Array.au3>
  3. #include <Inet.au3>
  4.  
  5. ; ##############################################################################
  6. ;
  7. ;
  8. ;
  9. ;
  10. ; ##############################################################################
  11.  
  12.  
  13. ; Global Vars
  14. Global $pFlashLog = "D:\FlashTest"
  15. Global $s_SmtpServer = "XXXXXXXX"
  16. Global $s_FromName = "XXXXXXXX"
  17. Global $s_FromAddress = "XXXXXXX"
  18. Global $s_ToAddress = "XXXXXXXXXXX"
  19. Global $iLineCtrl = 0
  20. Global $iAfterRun0 = 0
  21.  
  22. ; Generate Versioning List
  23. $aFileList0 = _FileListToArray($pFlashLog, "*", 2)
  24.  
  25. ; Now run function against each found version
  26. For $i = 1 To UBound($aFileList0) -1
  27.     FailedReporter()
  28.  
  29.  
  30. ; ##########################################
  31. ; FUNCTIONS
  32. ; ##########################################
  33.  
  34. Func FailedReporter()
  35.  
  36.     Global $aFileList1 = _FileListToArray($pFlashLog & "\" & $aFileList0[$i] & "\Failed", "*", 1)
  37.  
  38.     Global $aCount1 = UBound($aFileList1)
  39.  
  40.     If $aCount1 = 0 Then
  41.         Return
  42.     EndIf
  43.  
  44.     ;_ArrayDisplay($aFileList1)
  45.  
  46.     FailedEmailer()
  47.  
  48.  
  49.  
  50. Func FailedEmailer()
  51.  
  52.     ; Convert array count to integer
  53.     $aCount1 = Int($aCount1) ;+ 2) ; Add number of lines to array for writing to body.
  54.  
  55.  
  56.     Local $s_Subject = "Failed Installation Log"
  57.     Local $as_Body[$aCount1]
  58.  
  59.     For $i = 1 To UBound($aFileList1)
  60.  
  61.         If $iAfterRun0 = 1 Then
  62.             $iLineCtrl = $iLineCtrl + 1
  63.         EndIf
  64.  
  65.         If $iLineCtrl = 0 AND $iAfterRun0 = 0 Then
  66.             Global $iAfterRun0 = 1
  67.         EndIf
  68.  
  69.         ;MsgBox(0,"",$aFileList1[$i])
  70.  
  71.         $as_Body[$iLineCtrl] = $aFileList1[$i] ; doesn't work!
  72.  
  73.     Next
  74.  
  75.  
  76.     Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "", -1)

 $as_Body[$iLineCtrl] = $aFileList1[$i] is where I am getting stuck. I assume because I cannot pass an array directly to  $as_Body. Any solutions to my challenge?

 

Thanks!


Viewing all articles
Browse latest Browse all 750

Latest Images

Trending Articles



Latest Images