| |
Flo
Posts: 1
Score: 0
Joined: 11/25/2004
From: France
Status: offline
|
Hi all Has anyone managed to handle events in wsc component, when instantiating nested component ? Here is the full story : I have created a few vbs functions to do some admin tasks on servers and desktops. I used to write wsf files for the main script and to include vbs files which contains the reusable functions. Now I would like to put my functions in wsc components. For some reasons, I want to create several wsc (say c1.wsc, c2.wsc ...), with c2.wsc using methods from c1. Each function needs to be able to send messages to stdout. Stdout is not available in srcobj environment, so I understood that I need to declare an event in the wsc, fire the event each time I want to send a message, then declare a function in the main script to handle the event. ex : in the C1.wsc file : <event name="DEBUG"> <parameter name="Msg"/> </event> .... function myFunction() ... FireEvent "DEBUG", myMsg end function in the main script set oC1 = wscript.createObject("C1.wsc", "c1_") ... call oC1.myFunction() sub c1_DEBUG(sMsg) WScript.Echo " -- " & sMsg end sub This work fine. But how can I access the DEBUG event of C2, if c2 is instanciated in c1.myFunction ? Thanks for any hint. Florence
|
|