Nathan, here are a couple of snippets that might help.  You need to use the 
Binary to get the script into the MSI database and then you reference it in a 
custom action.  The custom action calls a specific funtion in the script 
source.  Then you need to reference the custom action your 
InstallExecuteSequence.  This example checks for the existance a WMI class.

 

 

<Binary Id='InstallerScripts' SourceFile='InstallerScripts.vbs' />

<CustomAction Id='CustomAction_VerifyHbaApiSupport' 
BinaryKey='InstallerScripts' VBScriptCall='IsHbaApiInstalled' Return='check' />

 

<InstallExecuteSequence>

…

<Custom Action="CustomAction_VerifyHbaApiSupport" 
After="LaunchConditions">$Component_Dsm>2</Custom>

…

</InstallExecuteSequence>

 

My VBScript looks like

 

'

public function IsHbaApiInstalled()

 

      on error resume next

 

      '

      ' required error code for a failure see MSI docs

      '

      IsHbaApiInstalled = 1603

      '

      ' get an instance of SWbemWebServices thru a moniker handling

      ' security and and the CIM namespace we need

      '

      Set sWbemService = 
GetObject("winmgmts:{impersonationLevel=impersonate}!root/wmi")

      

      '

      ' query a class def - arbitrary choice...

      '

      Set sWbemObjs = sWbemService.ExecQuery("select * from meta_class where 
__this isa 'MSFC_FCAdapterHBAAttributes'", "WQL", 0)

      

      '

      ' if we got here the class is in the repository and

      ' all is good...

      '

      if Err.Number = 0 then

            IsHbaApiInstalled = 0 ' see MSI docs

      else

            '

            ' TODO:  should use Session.Message eventually and pull the

            '        message from the database to allow for localization

            '

            MsgBox "Microsoft support for the HBA API is not installed.  This 
package requires Microsoft support for the HBA API.  Support is included in the 
Fibre Channel Information Tool (fcinfo).  See Microsoft's web site for more 
information and to download the tool.  After installing the Fibre Channel 
Information Tool try installing Seagate ISE MPIO." & vbCrLf & vbCrLf &  "The 
installation process cannot continue.", vbOKOnly, "Seagate ISE Multi-path I/O"

      end if

      

      exit function

 

end function

 

 

Regards,

Robert.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nathan Lane
Sent: Tuesday, April 24, 2007 1:40 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] How to use CustomAction with a VBScript

 

Hello all,

I am in need of using some VBScripts in my installation and have learned that 
one can use a CustomAction to reference and eventually execute the VBScript.  
But I'm not understanding how that actually works.  Looking at the Manual > 
Schema reference, I am very confused about what attributes to set and how to 
set them.  Could somebody help me out? 

Thanks,

-- 
Nathan Lane 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to