Hi am able to use VBScript.RegExp as an object in another application,
which allows me to use regular expressions in that application. I would
like to do something similar for math functions. Is there a way to use
VBScript as a COM object so I can access its math functions? Thank you
very much.

Rick Quatro

Re: Using VBScript as a COM object by Justin

Justin
Wed Sep 13 09:08:35 CDT 2006

On Wed, 13 Sep 2006 08:24:55 -0500, frameexpert <frameexpert@truevine.net>
wrote:

> Is there a way to use VBScript as a COM object so I can access its
> math functions?

Microsoft offer an ActiveX control that may be of use to you.

Download details: Windows Script Control
http://www.microsoft.com/downloads/details.aspx?familyid=D7E31492-2595-49E6-8C02-1426FEC693AC&displaylang=en

--
Justin Piper
Bizco Technologies
http://www.bizco.com/

Re: Using VBScript as a COM object by mr_unreliable

mr_unreliable
Wed Sep 13 16:27:27 CDT 2006

hi frameexpert,

I am curious about the language you are using in "another application".
The reason is that just about every language I can think of (except
maybe assembly language) has its own math functions. And, the math
functions you get with vbScript are VERY minimal (the trig functions,
plus exp and log).

If you insist on using vbscript for math, you could write your own
COM object in vbScript. Go to microsoft's scripting site:

http://msdn.microsoft.com/scripting/

and look up "Windows Script Components" (alias "scriptlets). You can
write a scriptlet to expose any math function available in vbScript,
register it, and then access it like any other COM object.

For example, to wrap the "sin" function:

Public Function mySinFunction(vRadians)
' (meta code: if vRadians is not numeric, throw error)
mySinFunction = Sin(vRadians) ' set return value
End Function

Then to use it:

Set oMath = CreateObject("myMathComponent.wsc")

CalcSine = oMath.mySinFunction(vAngle) ' in radians


cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)



frameexpert wrote:
> Hi am able to use VBScript.RegExp as an object in another application,
> which allows me to use regular expressions in that application. I would
> like to do something similar for math functions. Is there a way to use
> VBScript as a COM object so I can access its math functions? Thank you
> very much.
>
> Rick Quatro
>

Re: Using VBScript as a COM object by frameexpert

frameexpert
Thu Sep 14 06:51:30 CDT 2006

Thanks for the good advice. I am using a program called FrameScript,
which is a scripting language for Adobe FrameMaker. It doesn't happen
to have the trig functions that I need for a particular task. So, I was
hoping to hook into something that would likely be installed on
Windows, such as VBScript. Since I am already able to do this with
VBScript.RegExp, I thought there might be a similar way to access the
math functions.

Rick

mr_unreliable wrote:
> hi frameexpert,
>
> I am curious about the language you are using in "another application".
> The reason is that just about every language I can think of (except
> maybe assembly language) has its own math functions. And, the math
> functions you get with vbScript are VERY minimal (the trig functions,
> plus exp and log).
>
> If you insist on using vbscript for math, you could write your own
> COM object in vbScript. Go to microsoft's scripting site:
>
> http://msdn.microsoft.com/scripting/
>
> and look up "Windows Script Components" (alias "scriptlets). You can
> write a scriptlet to expose any math function available in vbScript,
> register it, and then access it like any other COM object.
>
> For example, to wrap the "sin" function:
>
> Public Function mySinFunction(vRadians)
> ' (meta code: if vRadians is not numeric, throw error)
> mySinFunction = Sin(vRadians) ' set return value
> End Function
>
> Then to use it:
>
> Set oMath = CreateObject("myMathComponent.wsc")
>
> CalcSine = oMath.mySinFunction(vAngle) ' in radians
>
>
> cheers, jw


Re: Using VBScript as a COM object by frameexpert

frameexpert
Thu Sep 14 07:20:08 CDT 2006

Hi Justin,

Thanks for the help. This is exactly what I needed. Here is a snippet
of my code, which is written in FrameScript, a scripting language for
Adobe FrameMaker.

New EActiveXObject NewVar(oSc) ProgId('ScriptControl');
Set oSc.Language = 'VBScript';
Display oSc.Eval{'Tan(1)'};

Thanks again!

Rick

Justin Piper wrote:
> On Wed, 13 Sep 2006 08:24:55 -0500, frameexpert <frameexpert@truevine.net>
> wrote:
>
> > Is there a way to use VBScript as a COM object so I can access its
> > math functions?
>
> Microsoft offer an ActiveX control that may be of use to you.
>
> Download details: Windows Script Control
> http://www.microsoft.com/downloads/details.aspx?familyid=D7E31492-2595-49E6-8C02-1426FEC693AC&displaylang=en
>
> --
> Justin Piper
> Bizco Technologies
> http://www.bizco.com/