Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can functions from mutiple VBScripts be referenced in a single .wsf file?

Status
Not open for further replies.

Don Child

Programmer
Apr 4, 2003
64
US
Hi,

Can we access several .vbs files, in a single .wsf? Just like we can interact with functions multiple languages, I was wondering if we could use more than one VBScript in the same job.

 
Looks like the answer is yes. This is an example with different scripts, but the same job.

Get_A() is taken from TEST_01.vbs, while Get_B() is taken from TEST_02.vbs.


Test.wsf
Code:
<job id="Test">
	<script language="VBScript" src="TEST_01.vbs">
	</script>
	<script language="VBScript" src="TEST_02.vbs">
	</script>
	<script language="VBScript">
		Option Explicit
		Dim A_s
		Dim B_s
		A_s = Get_A()
		B_s = Get_B()
		MsgBox( "Finished" )
	</script>
</job>

Test_01.vbs
Code:
Option Explicit

Function Get_A()
Dim A_s
A_s = "A"
Get_A = A_s
End Function



Test_02.vbs
Code:
Option Explicit

Function Get_B()
Dim B_s
B_s = "B"
Get_B = B_s
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top