
omstef11.552492216176379E12 asked a question.
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
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.
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 ?
http://blogs.msdn.com/robmen/archive/2004/05/20/136530.aspx
So how to use DoMethod and ExecuteGlobal ?