MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: /VbsCaEntry[Next]: WrapInstall
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->VbsCaSetup

The "VbsCaSetup" Command

This command is used to schedule a preexisting VBSCRIPT custom action (its already in the "Binary" table). It also sets up the "Action Text" which gets displayed in the progress bar even if your script does not update the bar itself.

You would normally create the script with "VbsCa" but this is not required.

If you have an existing Windows Scripting Host (WSH) script which you want to use, use the "ExeCa" command to invoke "WSCRIPT.EXE". All parameters will typically be passed on the command line and no logging will take, in my mind good reasons why this should be avoided at nearly all costs. I recommend rewriting to use the "VbsCa" command instead.

This command takes these parameters:

EXAMPLE - Simple INLINE (type 38 CA)

<$VbsCa Binary="!SimpleVbs">
     InstallDir = session.property("INSTALLDIR")
     InstallDir = left(InstallDir, len(InstallDir)-1)

     'MsgBox "DEBUG: The INSTALLDIR without a trailing backslash ===> " & InstallDir
     session.property("DIR_NO_SLASH") = InstallDir      ;;You will see this action logged in any verbose log
<$/VbsCa>
<$VbsCaSetup Binary="!SimpleVbs" Seq="CostFinalize-" SeqTable="InstallExecuteSequence" CONDITION=^<$CONDITION_INSTALL_ONLY>^>

EXAMPLE - Binary - With CustomActionData

;--- Set up the 2 parameters (CustomActionData) -----------------------------
#data "Fred"
   "Name1" 'Name 1 Value'          ;;Parameter 1 (name + value)
   "Name2" "[INSTALLDIR]"          ;;Parameter 2
#data

;--- Deferred Custom Action which accesses 2 passed parameters --------------
<$VbsCa Binary="TestCustomActionDataPassing.vbs" DATA="Fred">
   <$VbsCaEntry "Install">
       ;--- Do something ----------------------------------------------------
       Show("Install: NAME1=" & VbsCaCadGet("Name1"))
       Show("Install: NAME2=" & VbsCaCadGet("Name2"))
   <$/VbsCaEntry>

   '=======================
   sub Show(Text)
   '=======================
       CaMsgBox "I", Text
   end sub
<$/VbsCa>

;--- Set up the Deferred custom action passing the CustomActionData ---------
<$VbsCaSetup Data="Fred" Binary="TestCustomActionDataPassing.vbs" Entry="Install" Seq="InstallFiles-" CONDITION=^<$CONDITION_INSTALL_ONLY>^>

EXAMPLE - Others

;--- Create a VBSCRIPT and add to the binary table --------------------------
#( '<?NewLine>'
   #define InstallationOnTrap

   ;--- This code must be called to "clean up" after failed install ---------
   'clean up code statement 1
   'clean up code statement 2
   'clean up code statement 3
#)
<$VbsCa Binary="TEST.vbs">
   <$VbsCaEntry "Install" OnTrap="<$InstallationOnTrap>">
       ;--- Do something ----------------------------------------------------
       UserFunction("Called during Install...")

       ;--- Set the return code ---------------------------------------------
       '<$VbsCaEntryName> = 1603         ;;Error Return code
   <$/VbsCaEntry>

   <$VbsCaEntry "UnInstall">
       ;--- Do something ----------------------------------------------------
       UserFunction("Called during UNInstall...")
   <$/VbsCaEntry>

   '=======================
   sub UserFunction(Text)
   '=======================
       CaMsgBox "I", Text
   end sub
<$/VbsCa>

;--- Call the above script during install and uninstall ---------------------
<$VbsCaSetup Binary="TEST.vbs" Entry="Install"   Seq="InstallFiles-" CONDITION=^<$CONDITION_INSTALL_ONLY>^>
<$VbsCaSetup Binary="TEST.vbs" Entry="UnInstall" Seq="InstallFiles-" CONDITION=^<$CONDITION_UNINSTALL_ONLY>^>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: /VbsCaEntry[Next]: WrapInstall


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.