home » help » udfs
Additional Information
Follow on Twitter
Follow Kix2Exe on Twitter
New Version Notifier

You'll get notified as soon as new releases are out.

Note: Your e-mail address is only used to keep you informed about new releases.

UDFs

Depending on the packaging parameters you specify, User Defined Functions (UDFs) are added to your script during the packaging process. The following UDFs are available:

On this page you can find information about how to use Kix2Exe UDFs to extend the possibilities of packaged KiXtart scripts.

K2e_GetParam()

K2E_GetParam() is included into the KiXtart script during the packaging process. K2E_GetParam() can be used to get values from command line parameters that are passed to the package. The full command line string is available in the variable $K2E_EXEParam.

Availability

always

How to use

$value = K2E_GetParam($parameter)

Returns

  • True if the parameter is specified but no value for the parameter is specified, or;
  • False if the parameter was not specified, or;
  • the actual value of the parameter specified

Example

Here's an example of how you can use K2E_GetParam() in your scripts.

c:\temp>mypackage.exe /installsource "c:\install" /autoinstall

You can get the value of the /installsource and /autoinstall parameters in the KiXtart script by using the following KiXtart code:

$InstallSource = K2E_GetParam("installsource")
$AutoInstall = K2E_GetParam("autoinstall")

In this example $InstallSource will contain the value "c:\install" and $AutoInstall will contain the value True.

K2E_SetBalloonTip()

Description

Allows balloon tip control from within the packaged script

Availibility

Specify the /balloontips parameter when running Kix2Exe to build the package

How to use

$rc = K2E_SetBalloonTip($MsgTitle,$Message,$StyleID)

K2E_SetBalloonTip() accepts the following parameters:

  • Title of balloon tip (required)
  • Message (required)
  • Balloon tip style identifier (optional)

StyleID is an optional parameter and can be one of the following values:

  • i = information mark
  • w = warning mark
  • e = error mark
  • r = remove balloon tip
  • empty = no mark

Returns

  • True if balloon tip functionality is enabled on the client computer (registry check) (see to MS article mentioned below)
  • False if balloon tip functionality is disabled on the client computer

Example

To detect if the required /balloontip parameter was specified, check if the value of the $K2E_BalloonTipsEnabled variable is set to True (this means K2E_SetBalloonTip() is available).

If $K2E_BalloonTipsEnabled = True
  $rc = K2E_SetBalloonTip("Installation Progress","Creating shortcuts","i")
EndIf

This will popup a balloon tip with the title Installation Progress with the message Creating shortcuts... The icon will be an information mark (see pictures below).

To remove the balloon tip from the tray bar, call K2E_SetBalloonTip() with the "r" balloon tip style identifier:

$rc = K2E_SetBalloonTip("","","r")

Note: You don't have to remove the final balloon tip in your script. This is done automatically to prevent problems with cleaning up tempfiles.

balloontip-infoballoontip-errorballoontip-error

If the UDF returns false, please read Microsoft KB Article 307729.

UDF K2E_RegisterKixforms()

Description

Temporarily registers Kixforms.dll into the HKCU registry hive - this means that the user running the script is not required to have administrative rights on the machine to register the Kixforms (Classic) DLL on the machine.

Since the registration of Kixforms.dll by the UDF is only valid during script execution (registration of the DLL points to a temporary random location only available during script execution), you should unregister the DLL just before the script ends by calling the K2E_UnregisterKixforms() UDF (see below).

Note: if you are using this UDF on Windows Vista or newer operating systems, use Kix2Exe 1.4.2.

Availability

Specify /kixforms parameter when packaging the script to add the UDF to the script

Syntax

$rc = K2E_RegisterKixforms()

Returns

  • True if the registration succeeded
  • False if the registration failed

Example

To detect if the script was built with the /kixforms parameter, check the value of $K2E_KixformsEnabled. It is set to True if /kixforms was specified and thus K2E_RegisterKixforms() is available.

Here's an example of how you could use the K2E_RegisterKixforms():

If $K2E_KixformsEnabled = True
  If K2E_RegisterKixforms() = True
    $System = CreateObject("Kixtart.System")
  EndIf
Else
  ; code if K2E_RegisterKixforms() failed
EndIf

UDF K2E_UnRegisterKixforms()

Description

Unregisters Kixforms.dll from the HKCU registry hive. Call K2E_UnregisterKixforms() before you exit the form.

Availability

Specify the /kixforms parameter when packaging the script to add the UDF to the script.

Syntax

$rc = K2E_UnregisterKixforms()

Returns

  • True if the unregistration succeeded
  • False if the unregistration failed

Example

If $K2E_KixformsEnabled = True ; UDF is available
  $rc = K2E_UnregisterKixforms()
EndIf