Page tree
Skip to end of metadata
Go to start of metadata

Scripting Guidelines for using CapaInstaller Scripting Library

Through years of experience in scripting, CapaSystems has developed a concept for making safe scripting.
This help file describes in detail the core script component called CapaInstaller Scripting Library. CapaInstaller Scripting Library is a function library where standard VBS (Visual Basic Scripting) functions has been wrapped in jacket routines. The reasons to do so are many: handle the deployment log, secure deployment integrity, more simple and standardized code etc.

To include the CapaInstaller Scripting Library, in the script, you must include the following code in the script:

Dim bStatus
Private Function IncludeScript(sScriptFile)
Dim oLocalFso
Dim sCmd
Dim sClientDir
Dim oLocalShell
  On Error Resume Next
  Set oLocalShell=CreateObject("WScript.Shell")
  sClientDir=oLocalShell.RegRead("HKLM\Software\CapaSystems\CapaInstaller\Client Directory")
  If bStatus and (sClientDir<>"") Then
    Set oLocalFso = CreateObject("Scripting.FileSystemObject")
    sCmd = oLocalFso.OpenTextFile(sClientDir & "\Lib\" & sScriptFile,1).ReadAll
  End If
  ExecuteGlobal sCmd
End Function
Function Install()
Dim bStatus
  'Place your own code here
End Function

  If bStatus Then bStatus=IncludeScript("Includes.cis")
  If bStatus Then bStatus=IncludeScript("customlib.cis")
  If bStatus Then bStatus=IncludeScriptingLibrary("CapaInstaller Scripting Library.cin")
  If bStatus Then bStatus=Job_Start("WS","Demo script","1.0","DemoScript.log","INSTALL")

  If bStatus Then bStatus=Install()

'End main

Script Comments:

The function IncludeScript includes the customer-specific CapaInstaller module CustomLib.cis and the standard library includes.cis. Includes.cis contains a function to include the CapaInstaller Scripting library.
Before CapaInstaller functions can be used the library must be initialized. This is done from the function call Job_Start. When a Job has finished the function Job_End must be called.
See Job_Start and Job_End function description for further details.

  • No labels