home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 September
/
CHIPCD_9_99.iso
/
software
/
uaktualnienia
/
OptionPackPL
/
MTS4.CAB
/
WSH_InstDLLCLI.vbs
< prev
next >
Wrap
Text File
|
1998-04-27
|
4KB
|
123 lines
' Filename: InstDLLCLI.vbs
'
' Description: Sample VB Script that creates an empty package and installs the Sample Bank components into it
'
' This file is provided as part of the Microsoft Transaction Server Samples
' See the MTS Software Development Kit for more information on Scriptable Administration Objects
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
' OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
' PURPOSE.
'
' Copyright (C) 1997 Microsoft Corporation, All rights reserved
'
' Use: InstDLLCLI.vbs "dll path"
' Ex: InstDLLCLI.vbs "C:\Program Files\MTX\Packages\Samples"
' Get arguments
Dim objArgs
Set objArgs = WScript.Arguments
' Set up path names
Dim packageName
packageName = "Sample Bank"
Path = objArgs(0)
' First, we create the catalog object
Dim catalog
Set catalog = CreateObject("MTSAdmin.Catalog.1")
' Then we get the packages collection
Dim packages
Set packages = catalog.GetCollection("Packages")
packages.Populate
' Remove all packages that go by the same name as the package we wish to install
numPackages = packages.Count
For i = numPackages - 1 To 0 Step -1
If packages.Item(i).Value("Name") = packageName Then
packages.Remove (i)
End If
Next
' Commit our deletions
packages.SaveChanges
' Add a new package
Dim newPackage
Set newPackage = packages.Add
newPackage.Value("Name") = packageName
newPackage.Value("SecurityEnabled") = "N"
' Commit new package
packages.SaveChanges
' Refresh packages
packages.Populate
' Get components collection for new package
Dim components
Set components = packages.GetCollection("ComponentsInPackage", newPackage.Value("ID"))
' Install components
Dim util
Set util = components.GetUtilInterface
' VB and VC
dllPath = Path & "vbacct.dll"
util.InstallComponent dllPath, "", ""
dllPath = Path & "vcacct.dll"
util.InstallComponent dllPath, "", ""
' Java: i386 only
util.ImportComponentByName "Bank.Account.VJ"
util.ImportComponentByName "Bank.MoveMoney.VJ"
util.ImportComponentByName "Bank.GetReceipt.VJ"
util.ImportComponentByName "Bank.UpdateReceipt.VJ"
' Refresh components
components.Populate
' Iterate through the components and change the transaction attributes
numComponents = components.Count
Dim component
Dim progName
For i = numComponents - 1 To 0 Step -1
Set component = components.Item(i)
progName = component.Value("ProgID")
If progName = "Bank.Account" Or progName = "Bank.Account.VC" Then
component.Value("Transaction") = "Required"
End If
If progName = "Bank.MoveMoney" Or progName = "Bank.MoveMoney.VC" Then
component.Value("Transaction") = "Required"
End If
If progName = "Bank.GetReceipt" Or progName = "Bank.GetReceipt.VC" Then
component.Value("Transaction") = "Supported"
End If
If progName = "Bank.UpdateReceipt" Or progName = "Bank.UpdateReceipt.VC" Then
component.Value("Transaction") = "Requires New"
End If
If component.Value("ProgID") = "Bank.CreateTable" Then
component.Value("Transaction") = "Not Supported"
End If
Next
' Commit the changes to the components
components.SaveChanges
' Create the 'Managers' role in the package
Dim rolesInPack
Dim newRole
Set rolesInPack = packages.GetCollection("RolesInPackage", newPackage.Value("ID"))
Set newRole = rolesInPack.Add
newRole.Value("Name") = "Managers"
rolesInPack.SaveChanges