Deferred custom action. Please read carefully this artical
http://msdn.microsoft.com/en-us/library/aa370543(VS.85).aspx
And see my example.
<CustomAction Id="ShowInstallDir.SetProperty"
   Property="ShowInstallDir" Value="[INSTALLDIR]" />
  <CustomAction Id="ShowInstallDir"
   Script="vbscript" Execute="deferred">
   <![CDATA[
   Dim property
   property = Session.Property("CustomActionData")
   MsgBox property
   ]]>
  </CustomAction>
  <InstallExecuteSequence>
   <Custom Action="ShowInstallDir.SetProperty"
    Before="InstallInitialize">NOT REMOVE="ALL"</Custom>
   <Custom Action="ShowInstallDir"
    Before="InstallFinalize">NOT REMOVE="ALL"</Custom>
  </InstallExecuteSequence>


2009/7/17 Jirong Hu <jirong...@gov.ab.ca>

> Hi
>
> This is my first Custom Action, and I copied the code from here:
>
> http://n2.nabble.com/Re:-Creating-a-virtual-directory-under-a-web-site-(other-than-the-default)-(by-Mark-Jones)-td692909.html
>
> When I try to run this GetSites.vbs from Windows command line, I got an
> error say "Object required on Session.Property("WebSitesList") = strRslt. If
> run the msi file SFS.msi, I got an error like this in the log:
>
> Action 16:06:26: caGetWebSites.
> Error 1720. There is a problem with this Windows Installer package. A
> script required for this install to complete could not be run. Contact your
> support personnel or package vendor. Custom action caGetWebSites script
> error -2147467259, Msi API Error: Property,Name Line 13, Column 2,
> MSI (s) (1C:4C) [16:06:32:531]: Product: SFS -- Error 1720. There is a
> problem with this Windows Installer package. A script required for this
> install to complete could not be run. Contact your support personnel or
> package vendor. Custom action caGetWebSites script error -2147467259, Msi
> API Error: Property,Name Line 13, Column 2,
>
> All my scripts are attached. Can someone also point me to some links tell
> how to write Custom Action in VBScript? I try to get a list of existing IIS
> web sites and display them in a Combo box in a dialog for the installer to
> choose from. How can I pass the result of GetSites() into the dialog?
>
> --------------- GetSites.vbs -----------------
> Function GetSites()
>                Dim strRslt: strRslt = ""
>                Dim locatorObj: Set locatorObj =
> CreateObject("WbemScripting.SWbemLocator")
>                Dim objProvider: Set objProvider =
> locatorObj.ConnectServer("localhost", "root/MicrosoftIISv2")
>                Dim objServersCollection: Set objServersCollection =
> objProvider.ExecQuery("SELECT Name, ServerComment FROM IIsWebServerSetting",
> "WQL",&H30)
>                Dim oServer
>                For Each oServer In objServersCollection
>                                'strRslt = strRslt &  oServer.Name & Chr(9)
> & oServer.ServerComment & vbCrLf
>                                strRslt = strRslt & oServer.ServerComment &
> vbCrLf
>                Next
>                Session.Property("WebSitesList") = strRslt
>                Set objServersCollection = Nothing
>                Set objProvider = Nothing
>                Set locatorObj = Nothing
>                GetSites = 0
>                Log (strRslt)
> End Function
> --------------- GetSites.vbs -----------------
>
> ---------------install.wxs ----------------
>                                <CustomAction Id="caGetWebSites"
>              FileKey="GetSitesFile"
>              VBScriptCall="GetSites"
>              Execute="deferred"
>              Return="check"
>              HideTarget="no"
>              Impersonate="no" />
>                                <!--
>                                <Binary Id="GetSitesBin"
> SourceFile="GetSites.vbs" />
>                                <CustomAction Id="caGetWebSites"
> BinaryKey="GetSitesBin" VBScriptCall="GetSites" Execute="firstSequence"
> Return="check" />
>                                -->
>                                <InstallExecuteSequence>
>                                                <Custom
> Action="caGetWebSites" Before="InstallFinalize">Not Installed</Custom>
>                                </InstallExecuteSequence>
>
> ---------------install.wxs ----------------
>
>
> Thanks
> Jirong Hu
> Build Master
> 780-644-5488
>
>
> This communication is intended for the use of the recipient to which it is
> addressed, and may contain confidential, personal, and or privileged
> information. Please contact us immediately if you are not the intended
> recipient of this communication, and do not copy, distribute, or take action
> relying on it. Any communication received in error, or subsequent reply,
> should be deleted or destroyed.
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>


-- 
Konstantin Vlasenko
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to