In the example below when I am setting up the variables to be passed do I have to demention the variables again if the Var names are the same as previously Dim'ed Variables.

For Example $EmailServer, or $IT_Email

 Code:
Function SendEmail($User,$system,$systemup,$EmailServer,$IT_Email,$EmailSufix,$RS_Logs,$Userstoskip)
; == Declaring Variables
Dim $User			; User to be emailed
Dim $System			; Hostname of current system
Dim $Systemup		; Uptime of Current system
Dim $Unli			; Defined as (User Not Logged In) - Incase user isn't logged in

;Dim $EmailSufix 	; Global and needs to be passed.
;Dim $IT_Email 		; is Global and needs to be passed.
;Dim $RS_log		; is Global and needs to be passed.


If len(ltrim($User)) <> 0	; == This checks to make sure that a 0 digit value didn't show up for $User
	If checkusers($User,$Userstoskip) = -1
		;Shell 'bmail -s $EmailServer -t $User@@$EmailSufix -f $IT_Email -a "(System Reboot Needed!) Uptime: $systemup Days." -m $RS_Logs\$system.SentEmail.txt'
	Else
		;Shell 'bmail -s $EmailServer -t $IT_Email -f $IT_Email -a "$system - $user Uptime: $systemup Days." -m $RS_Logs\$system.SentEmail.txt'
		;Shell '%compsec% net send \\$system "Alert Notice: This system has been turned on for $systemup days please reboot!, Thanks IT"'
	Endif
Else
	$Unli = "(User Not Logged In)"
	Shell 'bmail -s $EmailServer -t $IT_Email -f $IT_Email -a "$system - $Unli System Reboot Needed! It Has been Turned on for $systemup Days." -m $RS_Logs\$system.SentEmail.txt'
	;Shell '%compsec% net send \\$system "Alert Notice: This system has been turned on for $systemup days please reboot!, Thanks IT"'
Endif
EndFunction



Also When I call a second Function inside of the first one like below for Checkusers do I have to pass the $Userstoskip Variable to the Function SendEmail First and then to the Function checkusers for it to pass the information along or can I just call checkusers with he added $Userstoskip variable and it will work fine.


 Code:
If checkusers($User,$Userstoskip) = -1
		;Shell 'bmail -s $EmailServer -t $User@@$EmailSufix -f $IT_Email -a "(System Reboot Needed!) Uptime: $systemup Days." -m $RS_Logs\$system.SentEmail.txt'
	Else
		;Shell 'bmail -s $EmailServer -t $IT_Email -f $IT_Email -a "$system - $user Uptime: $systemup Days." -m $RS_Logs\$system.SentEmail.txt'
		;Shell '%compsec% net send \\$system "Alert Notice: This system has been turned on for $systemup days please reboot!, Thanks IT"'
	Endif
Else
	$Unli = "(User Not Logged In)"
	Shell 'bmail -s $EmailServer -t $IT_Email -f $IT_Email -a "$system - $Unli System Reboot Needed! It Has been Turned on for $systemup Days." -m $RS_Logs\$system.SentEmail.txt'
	;Shell '%compsec% net send \\$system "Alert Notice: This system has been turned on for $systemup days please reboot!, Thanks IT"'
Endif


Thanks!

Indigo


Edited by Indigo (2008-10-21 10:33 PM)