You may want a complete example :


<!-- ******************* BINARY ******************* -->

        <!-- Stockage des fichiers dans la table Binary -->

        <Binary Id="polyval.hta" SourceFile="Binary\polyval.hta" />



...



        <CustomAction Id="Launch_HTA_binary_table"

                      Script="vbscript"

                      Execute="firstSequence">



            Dim TempFolder : TempFolder =
Session.Property("TempFolder")

            Dim SFolder : SFolder = Session.Property("SystemFolder")



            '********** Début du main **********

            ExtractBinary "polyval.hta",
TempFolder &amp; "polyval.hta"            ' Extraction du fichier HTA
de la table Binary vers le dossier Temp

            ExtractIcon "polyval.ico",
TempFolder &amp; "polyval.ico"            ' Extraction du fichier ico
de la table Binary vers le dossier Temp

            SExecute SFolder &amp; "mshta.exe
" &amp; TempFolder &amp; "polyval.hta"    ' Exécution du HTA à partir
du dossier Temp

            CleanFile
TempFolder &amp; "polyval.hta"                            ' Suppression
du fichier HTA dans le dossier Temp

            CleanFile
TempFolder &amp; "polyval.ico"                            ' Suppression
du fichier ico dans le dossier Temp

            SetMSIProperty
"REGION","HKEY_LOCAL_MACHINE\SOFTWARE\Marimba\Applications\REGION" '
Récupération d'une clé de registre pour l'affecter à une variable
windows installer

            '********** Fin du main **********





            Function SetMSIProperty(MSIProperty,RegistryKey)



                Dim WShell

                Set WShell = CreateObject("Wscript.Shell")



                RegistryValue = WShell.RegRead(RegistryKey)

                Session.Property(MSIProperty)=RegistryValue



            Set WShell = nothing



            End Function





            Function ExtractBinary(BinaryName, OutputFile)

                Const msiReadStreamAnsi = 2



                Dim oDatabase

                Set oDatabase = Session.Database



                Dim View

                Set View = oDatabase.OpenView("SELECT * FROM Binary
WHERE Name = '" &amp; BinaryName &amp; "'")

                View.Execute



                Dim Record

                Set Record = View.Fetch

                Dim BinaryData



                BinaryData = Record.ReadStream(2, Record.DataSize(2),
msiReadStreamAnsi)



                Dim FSO

                Set FSO = CreateObject("Scripting.FileSystemObject")

                Dim Stream

                Set Stream = FSO.CreateTextFile(OutputFile, True)

                Stream.Write BinaryData

                Stream.Close

                Set FSO = Nothing

            End Function



            Function ExtractIcon(IconName, OutputFile)

                Const msiReadStreamAnsi = 2



                Dim oDatabase

                Set oDatabase = Session.Database



                Dim View

                Set View = oDatabase.OpenView("SELECT * FROM Icon WHERE
Name = '" &amp; IconName &amp; "'")

                View.Execute



                Dim Record

                Set Record = View.Fetch

                Dim BinaryData



                BinaryData = Record.ReadStream(2, Record.DataSize(2),
msiReadStreamAnsi)



                Dim FSO

                Set FSO = CreateObject("Scripting.FileSystemObject")

                Dim Stream

                Set Stream = FSO.CreateTextFile(OutputFile, True)

                Stream.Write BinaryData

                Stream.Close

                Set FSO = Nothing

            End Function



            Sub SExecute(Command)



                Dim oShell

                Set oShell = CreateObject("Wscript.Shell")



                Dim oExec : oExec = oShell.Run(Command,0,True)



                Set oShell = nothing



            End Sub



            Function CleanFile(File)



                Dim oShell

                Set oShell = CreateObject("Wscript.Shell")



                Command = "cmd /c del /F /Q " &amp; File



                Dim oExec : oExec = oShell.Run(Command,0,True)



                Set oShell = nothing



            End Function



        </CustomAction>



..

        <InstallExecuteSequence>

            <Custom Action="Launch_HTA_binary_table" Sequence="56">REGI
ONISEMPTY="Yes" And NOT REMOVE = "ALL" And Not Installed</Custom>

        </InstallExecuteSequence>



        <InstallUISequence>

            <Custom Action="Launch_HTA_binary_table" Sequence="56">REGI
ONISEMPTY="Yes" And NOT REMOVE = "ALL" And Not Installed</Custom>

        </InstallUISequence>



--

Sincèrement,

Gabriel







Le Mar 03 Septembre 2013, à 14:41, ak m a écrit :

custom action during install...





On Tue, Sep 3, 2013 at 5:46 PM, Christopher Painter

<[1]chr...@iswix.com>wrote:



Is this for an application extracting a resource or for a custom action

during an install?



----------------------------------------

From: "ak m" <[2]wixak...@gmail.com>

Sent: Monday, September 02, 2013 7:21 AM

To: "General discussion for Windows Installer XML toolset."

<[3]wix-users@lists.sourceforge.net>

Subject: [WiX-users] Extract Binary file from MSI to Temp folder using
C#



Dear All,



Code to Extract Binary file from MSI to Temp folder using C#



Anyone Plz help me on this?



Thanks in Advance...



Anil



-----------------------------------------------------------------------
-----

--

Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!

Discover the easy way to master current and previous Microsoft

technologies

and advance your career. Get an incredible 1,500+ hours of step-by-step

tutorial videos with LearnDevNow. Subscribe today and save!

[4]http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg
.clktrk





_______________________________________________

WiX-users mailing list

[5]WiX-users@lists.sourceforge.net

[6]https://lists.sourceforge.net/lists/listinfo/wix-users







-----------------------------------------------------------------------
-------

Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!

Discover the easy way to master current and previous Microsoft
technologies

and advance your career. Get an incredible 1,500+ hours of step-by-step

tutorial videos with LearnDevNow. Subscribe today and save!

[7]http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg
.clktrk

_______________________________________________

WiX-users mailing list

[8]WiX-users@lists.sourceforge.net

[9]https://lists.sourceforge.net/lists/listinfo/wix-users



-----------------------------------------------------------------------
-------

Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!

Discover the easy way to master current and previous Microsoft

technologies

and advance your career. Get an incredible 1,500+ hours of step-by-step

tutorial videos with LearnDevNow. Subscribe today and save!

[10]http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ost
g.clktrk

_______________________________________________

WiX-users mailing list

[11]WiX-users@lists.sourceforge.net

[12]https://lists.sourceforge.net/lists/listinfo/wix-users



--
Sincèrement,
Gabriel

"I know no way of judging the future but by the past."
Patrick Henry
"You can never plan the future by the past."
Edmund Burke

References

1. mailto:chr...@iswix.com
2. mailto:wixak...@gmail.com
3. mailto:wix-users@lists.sourceforge.net
4. http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
5. mailto:WiX-users@lists.sourceforge.net
6. https://lists.sourceforge.net/lists/listinfo/wix-users
7. http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
8. mailto:WiX-users@lists.sourceforge.net
9. https://lists.sourceforge.net/lists/listinfo/wix-users
  10. 
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
  11. mailto:WiX-users@lists.sourceforge.net
  12. https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to