Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Load a specific class from an external file

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Load a specific class from an external file
  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 >>
 Load a specific class from an external file - 2/17/2006 4:54:44 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
I posted a script a while back to load classes from an external file:
http://www.visualbasicscript.com/m_29285/tm.htm

One potential drawback to this is that it runs all of the script in the external file. That could potentially cause problems if there is code in the file that actually does something other than just classes. To remedy this, I have created a function that will load just the class that you want from an external file. To use it you simply need to have a file somewhere that has classes in it. For a test I made a test file named TestClasses.vbs and had it in the same folder as I was running the script in although it doesn't need to be as long as you specify the path to the file when you call the function. The function uses the error object to report errors. Here are the contents of the TestClasses.vbs file:

      

Here is the function to load the external classes along with some code showing how it would be used:

      

I of course welcome all questions/suggestions/comments.

< Message edited by ebgreen -- 2/17/2006 8:18:48 AM >


_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
 
 
Revisions: 1 | Post #: 1
 
 RE: Load a specific class from an external file - 3/14/2006 3:14:24 PM   
  DiGiTAL.SkReAM


Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Hmmm... maybe I could add this function to my includes file, so that i only have to load particular fun ctions/classes, etc....
but then, i'd need ot use this to only load this one function... but if I was going to use it, then i'd need it in my includes...

OW!!!  My brain broke!!

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to ebgreen)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Load a specific class from an external file 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