We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Calling An External VBScript Function/Routine With Return Parameters

shacho
shacho asked
on
Medium Priority
2,246 Views
Last Modified: 2012-05-07
I want to run a VBScript function from another VBScript with parameters.  How is this done?

'C:\Script1.vbs
Dim MyVar
MyVar = Blah(1, 2, 3)

'C:\Scrip2.vbs
Function Blah(Num1, Num2, Num3)
  Blah = Num1 + Num2 + Num3
End Function


Mike
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:

Tompa - I don't see how you are specifying the path to the second script.
Rob - Interesting approach.

Mike
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Tompa's reference to the second script is this bit:
src="Functions.vbs"

The file is a WSF file, as opposed to a VBS file, so you can save it as WSF and try it.

You can also try my approach, let me know if it works out.

Regards,

Rob.

Author

Commented:
Hmm.  I suppose that would work.  But is there really no way to call functions script to script (vbs only) with return values?

Commented:
Hi,

Not that I know. WSF or like Rob suggested are 2 solutions.

Best Regards Tompa
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Rob - that's a pretty clever workaround.  Thanks all for your comments.

Mike
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Great, thanks for the grade,

Regards,

Rob.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.