Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


wsc component and fireEvent

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1646
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> wsc component and fireEvent
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 wsc component and fireEvent - 11/25/2004 3:38:39 AM   
  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
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> wsc component and fireEvent Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts