macrolooped Posted May 1, 2014 Posted May 1, 2014 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: expandcollapse popup#include <File.au3> #include <Array.au3> #include <Inet.au3> ; ############################################################################## ; ; ; ; ; ############################################################################## ; Global Vars Global $pFlashLog = "D:\FlashTest" Global $s_SmtpServer = "XXXXXXXX" Global $s_FromName = "XXXXXXXX" Global $s_FromAddress = "XXXXXXX" Global $s_ToAddress = "XXXXXXXXXXX" Global $iLineCtrl = 0 Global $iAfterRun0 = 0 ; Generate Versioning List $aFileList0 = _FileListToArray($pFlashLog, "*", 2) ; Now run function against each found version For $i = 1 To UBound($aFileList0) -1 FailedReporter() Next Exit ; ########################################## ; FUNCTIONS ; ########################################## Func FailedReporter() Global $aFileList1 = _FileListToArray($pFlashLog & "\" & $aFileList0[$i] & "\Failed", "*", 1) Global $aCount1 = UBound($aFileList1) If $aCount1 = 0 Then Return EndIf ;_ArrayDisplay($aFileList1) FailedEmailer() EndFunc Func FailedEmailer() ; Convert array count to integer $aCount1 = Int($aCount1) ;+ 2) ; Add number of lines to array for writing to body. Local $s_Subject = "Failed Installation Log" Local $as_Body[$aCount1] For $i = 1 To UBound($aFileList1) If $iAfterRun0 = 1 Then $iLineCtrl = $iLineCtrl + 1 EndIf If $iLineCtrl = 0 AND $iAfterRun0 = 0 Then Global $iAfterRun0 = 1 EndIf ;MsgBox(0,"",$aFileList1[$i]) $as_Body[$iLineCtrl] = $aFileList1[$i] ; doesn't work! Next Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "", -1) EndFunc $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!
macrolooped Posted May 1, 2014 Author Posted May 1, 2014 So close- I figured it out: $sSendString1 = String($aFileList1[0]) $as_Body[$iLineCtrl] = $sSendString1 Can't pass the $i onto the body but you can the starting row number. Woo!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now