Greymeister.net

My First VBScript Adventure

As I’m introducing myself to the .Net Framework so that I’m not bound to working only on Java projects, I quickly ran into registering COM objects on a remote host. I didn’t realize until a day or so into my problem that the reason I didn’t have a problem on my development environment was that the register for COM property of the project was checked. Obviously a real development effort would include an installer or setup package of some type, but this was just some quick work to create sample code for a learning course. While it seems like it is going to be a case of the blind leading the blind, I appreciate the opportunity to delve into something different, even if it is under the steel curtain of Microsoft. I finally decided to take the middle road (also known as doing things “half-assed”) and write some VBScript that will register my custom application component libraries I create to customize the application. It’s crude and I am embarrassed that this is my first code post but it’s something.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
' *********************************************************************
' *                  Dumb Component Registrar 1.0                     * 
' *                  Note: Edit locations if necessary                *
' *                  Last Revised: 06/05/2009                         * 
' *********************************************************************

Dim SysVarReg, dotNetInstallRoot, dotNetFolderName

dotNetInstallRoot = "C:\WINDOWS\Microsoft.NET\Framework\"
dotNetFolderName = "v2.0.50727\"

' Input DLL Name
dim dllName
dllName=InputBox("Enter your dll with path:")

Dim objShell
Set objShell = CreateObject("WScript.Shell")

Dim regCommand
regCommand = dotNetInstallRoot & dotNetFolderName &_
  "RegAsm.exe " & dllName

objShell.Run regCommand