Share this page 

Create and use a classTag(s): WSH VBScript


[myclass.vbs]

Dim my_howto

' create an VbsHowTo object and init its properties
Set my_howto = new VbsHowTo
my_howto.create "General", _
                "Start a script", _
                "CSCRIPT to start a script in CONSOLE mode" & vbCRLF & _
                "WSCRIPT to start a script in GUI mode"           
my_howto.print
WScript.Quit(0)

' ---------------------------------------
' class definition to represent an VBScript Howto
Class VbsHowTo
 Dim category
 Dim title
 Dim howto

 Sub create(cat, tit, how)
    category = cat
    title = tit
    howto = how
 End Sub

 Sub print()
   WScript.Echo category & " - " & title
   Wscript.Echo howto
 End Sub

End Class
Thanks to E. Girardet for this tip