thanx guys

I've used both the CALL and INCLUDE commands before... but what I am trying to do is, using the example from Shawn

call myfunction(v1,v2)

which would then call and run the function, and then return the value of the two varioubles to the script which called the function. In doing this I can then use the variouble values independently in other locations in the script.

I have attached some samples of what I intend to do. Please note that the way in which I used the function command is not correct, but the rest is in essence a partial copy of the actual script

eg.

--------------------Function--------------------

;Please note that this is merely a section out of a bigger script
;this is why the sub at the bottom of the script might not make sence

Code:
Function GetInfo($fserver,$lclsite,$lserver)

$usrhome = @COMMENT			;Get user home server from AD

Select
Case ($usrhome = "site1")		;Assign server names and connection
	$fserver = "\\fileserver1"	;strings
Case ($usrhome = "site2")
	$fserver = "\\fileserver2"
Case ($usrhome = "site3")
	$fserver = "\\fileserver3"
Case ($usrhome = "site4")
	$fserver = "\\fileserver4"
EndSelect

;****											Section 2

$section = $section + 1

Gosub GET_LOCATION

Select
Case ($DefGateway = "10.10.1.1")	;Assign server names and connection
	$lclsite = "FactoryA"		;strings according to Default 
	$lserver = "\\DC1"              ;Gateway
Case ($DefGateway = "10.10.2.1")
	$lclsite = "FactoryB"
	$lserver = "\\DC2"
Case ($DefGateway = "10.10.3.1")
	$lclsite = "FactoryC"
	$lserver = "\\DC3"
Case ($DefGateway = "10.10.4.1")
	$lclsite = "FactoryD"
	$lserver = "\\DC4"
EndSelect

Goto End

;Analyze location of site through subnet mask
:GET_LOCATION
CLS

$Octet1 = LTrim (SubStr(@IPADDRESS0, 1, 3))
$Octet2 = LTrim (SubStr(@IPADDRESS0, 5, 3))
$Octet3 = LTrim (SubStr(@IPADDRESS0, 9, 3))

$DefGateway = $Octet1 + "." + $Octet2 + "." + $Octet3 + ".1"

Return

:End

EndFunction

--------------------Script--------------------

;this is only a section of the script

$F_fserver
$F_lclsite
$F_lserver

;Get information from Function
Call Function GetInfo($fserver,$lclsite,$lserver)

$F_fserver = $fserver
$F_lclsite = $lclsite
$F_lserver = $lserver

If Exist "c:\utils\script"	;Test for folder and call
	Goto next0		;function to create
Else				;if doesn't exist
	Call $F_fserver + "\nai\scripts\" + createfolder.kix
EndIf

:Next0

If Exist "k:\"			;Test for mapped drive and
	Goto Next1		;call funtion to map if doesn't
Else
	Call $F_fserver + "\nai\scripts\" + $F_lclsite + "\" + Map_All.kix
EndIf



Hope this helps you to understand what I'm trying to accomplish

P.S. This script won't work if copied and pasted as there are some items missing which are still in the actual script. This is merely to give an understanding of what my goals are


Edited by Acidean (2007-01-19 08:26 AM)