Script seems to work fine when I run the au3. If I comple to exe it goes crazy. Before I added the wait, it would take down my system from memory usage.
Help?
Here is a sample of the INI
[Comments]
;Wait - How long between PING tests the script will pause (in Milliseconds)
;Computer - Name or IP of computer to ping
;SMTP_Server - Outgoing SMTP
;From_Address - Name email message will appear from (does not have to exist)
;To_Address - Who to send email to
;Subject - Subject of Email
;Line1 = First line of email body
;Line2 = Second line of email body (No more lines may be added)
[Settings]
Wait = 10000
Computer = 127.0.0.1
SMTP_Server = Server@mail.com
From_Name = Alert
From_Address = From@mail.com
To_Address = To@mail.com
Subject = My Test Email
Line1 = Testing the use of an INI file in an email
Line2 = Server is not pingable and may be down.
Help?
[ autoit ]
#include <inet.au3> Global $wait = IniRead ("Config.ini", "Settings", "wait", "notfound") Global $Computer = IniRead ("Config.ini", "Settings", "Computer", "notfound") Global $s_SmtpServer = IniRead ("Config.ini", "Settings", "SMTP_Server", "notfound") Global $s_FromName = IniRead ("Config.ini", "Settings", "From_Name", "notfound") Global $s_FromAddress = IniRead ("Config.ini", "Settings", "From_Address", "notfound") Global $s_ToAddress = IniRead ("Config.ini", "Settings", "To_Address", "notfound") Global $s_Subject = IniRead ("Config.ini", "Settings", "Subject", "notfound") Global $as_Body[2] Sleep($wait) If RunWait("ping.exe -n 1 " & $Computer, "", @SW_HIDE) == 0 Then MsgBox(0, $Computer, $Computer & " is pingable") Else MsgBox(0, $Computer, $Computer & " is NOT pingable") EndIf Func Mail() $as_Body[0] = iniRead ("Config.ini", "Settings", "Line1", "notfound") $as_Body[1] = iniRead ("Config.ini", "Settings", "Line2", "notfound") $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf EndFunc
Here is a sample of the INI
[Comments]
;Wait - How long between PING tests the script will pause (in Milliseconds)
;Computer - Name or IP of computer to ping
;SMTP_Server - Outgoing SMTP
;From_Address - Name email message will appear from (does not have to exist)
;To_Address - Who to send email to
;Subject - Subject of Email
;Line1 = First line of email body
;Line2 = Second line of email body (No more lines may be added)
[Settings]
Wait = 10000
Computer = 127.0.0.1
SMTP_Server = Server@mail.com
From_Name = Alert
From_Address = From@mail.com
To_Address = To@mail.com
Subject = My Test Email
Line1 = Testing the use of an INI file in an email
Line2 = Server is not pingable and may be down.