Variables Method

Top  Previous  Next

Lokas Software AWinstall Online Help
Start Page
Engine Functionality
Tasks and Actions
Installer Variables
Reading from Registry and Environment
Tips And Tricks
Frequently Asked Questions
Installer Actions
Extract Files with Folders
Register COM DLL
Register COM Type Library
Create Shortcuts and Start Menu Items
Register Fonts
Add Registry Keys
Add Keys from .reg file
Add Keys from System Registry
Run External Programs
Add Uninstall Shortcut
Setup Builder Interface
Main Windows
Property Pane
Project Tree
Event Log
Menu bar commands
File
Edit
View
Project
Task
Help
Toolbars
Standard
Actions
Extending your setups
Script Actions
Installer Object
AddRegKey Method
CancelInstall Method
CopyFile Method
CreateObject Method
CreateShortcut Method
RegisterFont Method
RegisterServer Method
RegisterTypeLib Method
RunProgram Method
ShowMessage Method
Variables Method
VersionMajor Property
VersionMinor Property
General Information
Product Registration
History of Changes
  download AWinstall

Gets or sets the installer variables.

[VBScript]

sVar = Installer.Variables(sVarName)

Installer.Variables(sVarName) = sNewVar

 

[JScript]

sVar = Installer.Variables(sVarName);

Installer.Variables(sVarName) = sNewVar;

Parameters

sVar

The returned AWinstall variable value.

sVarName

The variable name (for example, "SystemPath").

sNewVar

The new variable value.

Remarks

This method provides the access to installer variables. You may obtain the value of the built-in installer variable ("ProductName", for example), or you may create your own variables and use it later.

The method supports also Registry and Environment Pseudo-Variables. For example, Installer.Variables("ENV:USERNAME") returns the contents of the USERNAME environment variable.

Uninstall support

This action does not support uninstallation.

Example (VBScript)

In this example the script tries to create the MS Word executable using ActiveX Automation. In success, it will create the new installer variable, "MSTemplatePath", which may be used later for extracting MS Word templates.

On Error Resume Next

Set obj = CreateObject("Word.Application")

If Err.number<>0 Then

  ShowError "Can not find MS Word installed." & vbCrLf & "Cancel Install?"

Else

  Installer.Variables("MSTemplatePath") = obj.Options.DefaultFilePath(2)

  obj.Quit

  Set obj = Nothing

End If

Sub ShowError(msg)

  res = Installer.ShowMessage(msg, "System checks", vbYesNo+vbExclamation)

  If res = vbYes Then

     Installer.CancelInstall

  End If

End Sub

Example (JScript)

This example obtains and displays the path to the Windows System folder.

sysPath = Installer.Variables("SystemPath");

Installer.ShowMessage("System path is: \n" + sysPath, "Message", 0);

© 2007 Lokas Software