cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to call a script of a VB CA in other VB CA

Hi,

I want to know if it's possible to call a vbscript that is in CA from another VBscript CA?

There is my problem:

Script 1:

Class MyClass

Public Sub fonc1()
...
End Sub
...
...
End Class

Script 2:

In my script 2 I want to call the MyClass Class (like i have a file), by this command


ExecuteGlobal ...

Set xx = new MyClass


My script 1 is a very big file and I want that my others scripts use fonctions of that file.
I cannot put script 1 after Install Files sequence, and I don't want to put it outside MSI.


Any ideas ???


Thanks for replies
(5) Replies
First I'd like to point out that you can use the DoMethod of the Session Object to invoke one custom action from within a custom action. This may be enough for what you need.

Also realize that MSI has it's own host and doesn't use WSH so you can include other scripts like you can use WSH.

If you really want to be modular then you can write script components and have a custom action to register them ahead of time. Then you can just late bind to your script component from within your CA and call your methods.

Or even better you can just skip script all together ( for your COM servers ) and go to VB6 ActiveX objects instead of classes. Trust me, these are alot easier to debug then script custom actions. In this case you have a VB6 project that compiles an OCX which you include in your supportfiles folder. A custom action registers the control and a vbscript custom action simply says

set objSomething = CreateObject("MyApp.MyClass")
objSomething.MyEntryPoint( Session )
set objSomething = Nothing

My passing the Session object BYREF to your method you can use it to do all the same things you could in a script CA.
But How do I use DoMethod and ExecuteGlobal together ?

My problem is to include a script within a script, that's the reason why I use class and ExecuteGlobal

So do you know a better way to include my script 1 into my script 2 ?
Your really pushing the limits of script in an enviroment ( MSI ) that's barely script friendly. If you havn't read this link already, I highly suggest it.

http://blogs.msdn.com/robmen/archive/2004/05/20/136530.aspx
It a very interesting blog, but it doesn't help me.
So how to use DoMethod and ExecuteGlobal ?
It's a very good blog. Do you know who Robmen is?