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]: IniImport[Next]: /JsCa
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->JsCa

The "JsCa" Command

This command is used to start the definition (and creation) of a Windows Installer JSCRIPT based custom action which ends when the /JsCa command is encountered. The generated script is automatically added into the "Binary" table. You should be aware of the "Norton's Malicious Script Detection" issue.

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.

You will indicate the function entry points (which you will schedule via the JsCaSetup command) with the JsCaEntry and /JsCaEntry commands. You place your code between these two commands. You may define contants and common initialization code above the first use of "JsCaEntry".

I highly recommend the use of the CaDebug function and will be reluctant to look at any user supplied code which doesn't make use of it to indicate progress and to make the code easier to debug when it fails.

The generated script has these main characteristics:

Microsoft actually have some very useful script information and samples at "http://www.microsoft.com/technet/scriptcenter/default.mspxThis external link was OK when tested at 22 Jun 2008

HTML page dated Sat, 21 Jun 2008 06:38:18 GMT". I have a collection of other useful scripting links at "http://dennisbareis.com/bookmark_developer_windows_scripting_host.htmThis external link was OK when tested at 14 Jun 2008

HTML page dated Wed, 21 May 2008 09:41:19 GMT".

Parameters

This command takes these parameters:

Main "JsCa" Options

Please see the "options for commands" section of the manual.

;----------------------------------------------------------------------------
;--- General Options --------------------------------------------------------
;----------------------------------------------------------------------------
#define? DEFAULT_JSCA_CAD_DELIMITER        ,_,              ;;Must be 1-9 characters long
#define? JSCA_LOGDIR_ENVVAR                MAKEMSI_LOGDIR
#define? JSCA_LOG_OK_ENVVAR                MAKEMSI_LOG      ;;Set this environment variable to N to disable logging
#define? JSCA_LOGDIR_EXP_4_DEFAULT         "C:\\"           ;;By default place in C:\ (can be any JSCRIPT expression)
#define? JSCA_LOGFILE_BASENAME_PREFIX      MAKEMSI_JSCA-
#define? DEFAULT_JSCA_SEQTABLE             InstallExecuteSequence
#define? JSCA_OUT_DIR                      <$MAKEMSI_OUT_LOG_DIR>Jscripts
#define? JSCA_INC_BY_SPACE_COUNT           4
#define? JSCA_ROW_@VALIDATE                NEW                ;;See the "@Validate" parameter of the "ROW" command
#define? JSCA_PAUSE                        <$SUNDRY_CA_PAUSE> ;;Debug pauses (Y/N)
#define? JSCA_DISABLED                     <$SUNDRY_DISALLOW_USE_OF_SCRIPT_CUSTOM_ACTIONS> ;;Make non blank to disable (text is error message)
#define? JSCA_DEFAULT_TYPE_ATTRIBUTES
#define? JSCA_BINARY_DOCO                  Y                  ;;"N" = Don't add to doco
#define? JSCA_BINARY_COMMENT               This file generated by the "JsCa" command at <??RxMmLocation>

;----------------------------------------------------------------------------
;--- Custom Action conditions -----------------------------------------------
;----------------------------------------------------------------------------
#define? JSCA_CONDITION_INSTALL_ONLY    <$CONDITION_INSTALL_ONLY>
#define? JSCA_CONDITION_UNINSTALL_ONLY  <$CONDITION_UNINSTALL_ONLY>

EXAMPLE

;--- Create a JSCRIPT and add to the binary table ---------------------------
<$JsCa Binary="SimpleCa.js">
    var some = 1

    <$JsCaEntry "Install">
    {
        try
        {
            CaMsgBox("E", "test of the error box")
        }
        catch(e)
        {
            CaDebug(0, "Install_1 function: trapped")
        }
    }
    <$/JsCaEntry>

    <$JsCaEntry "UnInstall">
        UserFunction("Uninstalling...")
    <$/JsCaEntry>

   //==========================
   function UserFunction(Text)
   //==========================
   {
       CaDebug(0, "Doing something...")
       CaMsgBox("I", Text)
       CaDebug(0, "Finished doing something...")
   }
<$/JsCa>

;--- Call the above script during install and uninstall ---------------------
<$JsCaSetup Binary="SimpleCa.js" Entry="Install"    Deferred=Y Seq="InstallFiles-" CONDITION=^<$CONDITION_INSTALL_ONLY>^>
<$JsCaSetup Binary="SimpleCa.js" Entry="UnInstall"  Deferred=Y Seq="InstallFiles-" CONDITION=^<$CONDITION_UNINSTALL_ONLY>^>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 12 Jun 2008Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: IniImport[Next]: /JsCa


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Wednesday June 25 2008 at 7:16pm
Visit MAKEMSI's Home PageThis external link was OK when tested at 21 Jun 2008

HTML page dated Mon, 29 Jan 2007 00:11:11 GMT
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 12 Jun 2008