#190232 - 2008-10-21 10:52 PM
Re: Hi, All - (Where do i Post a Full Script I want to Share)
[Re: Indigo]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
|
The environment of a function is unique - the variable $User defined in the main program as a local will not be visible in the function. Thus, if you don't define it in the function, you'll get an undeclared var error when Explicit is enabled. You need to define the vars in the functions, too.
That's why I add the "_" to my function var names - just to reinforce that they are unique to the function. It also protects against corruption due to variable reuse if Explicit is off.
As far as passing vars to a function, you need to pass everything that the function will need. Remember that the function gets a copy of the data, not the actual data, so you can't just modify the data in a function the way you can in a subroutine. (Subroutines are in the same memory context as the main program.) So, in your example, you'd need to pass EMailServer, IT_Email, System, etc..
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
Client Reboot Script / Sends out Email warnings) Version .6
|
Indigo
|
2008-10-20 06:44 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-20 07:21 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Lonkero
|
2008-10-20 09:04 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-20 09:08 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-20 09:15 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Lonkero
|
2008-10-20 09:19 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-20 09:21 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 01:39 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 02:12 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
NTDOC
|
2008-10-21 02:38 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 04:12 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-21 03:55 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 04:02 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-21 04:46 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 05:11 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-21 08:09 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 09:03 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-21 10:31 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 10:52 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-22 05:57 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-22 08:06 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Lonkero
|
2008-10-22 09:12 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-22 09:16 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Lonkero
|
2008-10-22 09:20 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-22 09:34 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Mart
|
2008-10-23 09:16 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 03:10 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-23 03:27 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 04:47 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 04:59 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Mart
|
2008-10-23 05:01 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 05:02 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 05:07 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Allen
|
2008-10-23 05:20 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 05:41 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Kdyer
|
2008-10-23 05:45 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 06:16 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Kdyer
|
2008-10-23 06:53 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-23 08:00 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-23 09:39 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-27 04:13 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-27 04:21 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-27 04:32 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-27 04:34 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-27 04:41 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-28 08:06 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-28 08:14 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-29 04:40 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-29 04:47 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-29 04:57 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-29 05:05 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-29 05:52 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-30 04:23 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-28 08:24 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Lonkero
|
2008-10-28 10:03 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-28 10:10 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Mart
|
2008-10-27 04:25 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Gargoyle
|
2008-10-23 04:54 PM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 12:47 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Glenn Barnas
|
2008-10-21 12:53 AM
|
Re: Hi, All - (Where do i Post a Full Script I want to Share)
|
Indigo
|
2008-10-20 09:00 PM
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 601 anonymous users online.
|
|
|