Jump to content
Sign in to follow this  
wisem2540

Script spawns multiple processes when compiled

Recommended Posts

wisem2540

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?

#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.

Edited by wisem2540

Share this post


Link to post
Share on other sites
wisem2540

oh crap.... It just dawned on me....

Sorry for that.

Edited by wisem2540

Share this post


Link to post
Share on other sites
BrewManNH

Where's the rest of the script? Because I can't see anything in there that would spawn anything. It won't ever send the email either, because you never call the Mail() function in that snippet.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
SmOke_N

Is your script named ping.au3 and when compiled ping.exe?

If so, try changing the name of the script and re-compile, your Run() function is more than likely calling your script over and over.

Edited by SmOke_N
Jos was way too fast with answer!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
wisem2540

Is your script named ping.au3 and when compiled ping.exe?

If so, try changing the name of the script and re-compile, your Run() function is more than likely calling your script over and over.

thats what was happening.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×