Hi,
Tuxedo 7.1 creates the following registry key:
Code: Select all
HKEY_LOCAL_MACHINE\SOFTWARE\BEA Systems\TUXEDO\7.1
while Tuxedo 8.1 creates the following key:
Code: Select all
HKEY_LOCAL_MACHINE\SOFTWARE\BEA Systems\TUXEDO\8.1
Therefore, we need a Custom Action that enumerates all the subkeys contained by a given registry key. An example VBScript that performs this task is given below:
Code: Select all
Function EnumRegSubkeys
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\BEA Systems\TUXEDO"
ret = objReg.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys)
' MsgBox ret
' Test if the EnumKey function was successfull or not
If ret <> 0 Then
' Set a property that will be tested in Advanced Installer
Session.Property("TUXVER") = "ERROR"
Exit Function
End If
Dim VerCompArray
Dim MaxMajorVer, MajorVer
' Assume that the installed version is recent enough
Dim TuxVer : TuxVer = "OK"
MaxMajorVer = 0
' Enumerate the subkeys in the array
For Each subkey In arrSubKeys
' MsgBox subkey
' tokenize the subkey into version components
' (major.minor etc)
VerCompArray = Split(subkey, ".", -1, 1)
MajorVer = CInt(VerCompArray(0))
If MajorVer > MaxMajorVer Then
MaxMajorVer = MajorVer
End If
Next
If MaxMajorVer < 7 Then
TuxVer = "NOT_ENOUGH"
End If
' MsgBox(Tuxver)
Session.Property("TUXVER") = TuxVer
End Function
Note that this script uses the WMI "StdRegProv" class. WMI is preinstalled in Windows Server 2003, Windows XP, Windows Me, and Windows 2000. For Win95/98, WMI CORE 1.5 is available for download at Microsoft's website. For more information about this WMI class, please visit:
http://msdn.microsoft.com/library/defau ... egprov.asp
How to use this script:
1. Create a new text file ("TuxedoVer.vbs") containing the above code.
2. Switch to the Custom Actions page and make sure that the "AppSearch" Standard Action appears under both sequences ("InstallUISequence" and "InstallExecuteSequence"). Use the "Show Standard Action" toolbar button or context menu item for this purpose.
3. Right click one of the "AppSearch" items and select "New Attached Custom Action", then select the file you have created in step 1.
- In the Function Name field enter "EnumRegSubkeys".
- Set the following Scheduling Option: "Execute only once if present in both sequence tables".
- Set the Execution Condition to: (Not Installed).
4. Keep the SHIFT key pressed and drag this Custom Action to the other "AppSearch" tree item. Note that the script will be executed only once, although it appears in both sequence tables.
5. Switch to the "Launch Conditions" page a create a new condition:
Condition:
Description:
Code: Select all
Tuxedo is not installed or your Tuxedo version is too old.
6. Modify the script if necessary so that it checks the minor version too.
Hope this helps.
Regards,
Denis