123456789101112131415161718192021222324252627282930313233343536373839404142 |
- ' Generating a type library for the specified WSC file.
- ' The script assumes to be invoked through a context menu
- ' and to receive the WSC name on the command line.
- ' ---------------------------------------------------------------
-
- ' Get the WSC file name to work with
- If WScript.Arguments.Count = 0 Then
- wscFile = InputBox ("Enter the WSC file name:", "WSC")
- Else
- wscFile = WScript.Arguments.Item(0)
- End If
- if wscFile = "" Then WScript.Quit
-
-
- ' Instantiate the object to create the typelib
- Set oTL = CreateObject("Scriptlet.TypeLib")
-
-
- ' Set source and target file names
- oTL.AddURL wscFile
- tlbFile = Replace(wscFile, ".wsc", ".tlb", 1, -1, 1)
- oTL.Path = tlbFile
-
-
- ' Set the name to appear in the Object Browser
- posSlash = InStrRev(wscFile, "\")
- posDot = InStrRev(wscFile, ".")
- wscFileOnly = Mid(wscFile, posSlash+1, posDot-posSlash-1)
- oTL.Name = wscFileOnly & "TLB"
-
- ' Get the description
- defDesc = wscFileOnly & " Type Library"
- desc = InputBox ("Enter the TypeLib description", "WSC Description", defDesc)
- If desc <> "" Then
- oTL.Doc = desc
- Else
- oTL.Doc = defDesc
- End If
-
- ' Write the TypeLib
- oTL.Write
- oTL.Reset
|