Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

reading string from wix custom action with VB script problem

$
0
0
Hello.

I am building an installer in Wix, and it all works just fine except the part with my VB script. what needs to happen is the following:

1) user is prompted to fill in the MachineID.
2) installer continues by pressing next.
3) after installation the script is silently being called via a custom action.
4) the script retrieves the value from the installer and changes the selected text.

that is the idea, however it isn't working on the VB script side. the part in WIX is sorted out as I already had some help with it, so that part should be alright.

Code from the WIX installer:

Code:

<ComponentGroup Id ="DLL" Directory ="INSTALLFOLDER">
      <Component Id ="StringTransfer" Guid ="{479947FA-C324-411C-9B98-083E79C116CB}">
        <File Id ="StringTransfer" KeyPath="yes" Source="C:\Users\fjansen\Documents\Visual Studio 2015\Projects\String Transfer\Data Transfer\obj\x86\Debug\DataTransfer.CA.dll" />
      </Component>
    </ComponentGroup>
   
    <Binary Id="StringTransfer" SourceFile="C:\Users\fjansen\Documents\Visual Studio 2015\Projects\String Transfer\Data Transfer\obj\x86\Debug\DataTransfer.CA.dll" />
   
      <CustomAction
          Id="SetProperties"
          Property="ValueAdaptionScript"
          HideTarget="yes"
          Value="[MachineIdNumber]"
        />

      <CustomAction
          Id="ValueAdaptionScript"
          BinaryKey="StringTransfer"
          DllEntry="CustomAction1"
          Execute="deferred"
          Impersonate="no"
          Return="check"
        />

      <InstallExecuteSequence>
        <Custom Action="SetProperties" Before="ValueAdaptionScript" />
        <Custom Action="ValueAdaptionScript" Before="InstallFinalize">NOT REMOVE="ALL"</Custom>
      </InstallExecuteSequence>

in my Vb script I have the following code:

Code:

Public Class CustomActions
    Private Shared Property ValueAdaptionScript As String

    <CustomAction()>
    Public Shared Function CustomAction1(ByVal session As Session) As ActionResult
        session.Log("Begin CustomAction1")

        Dim MachineID As String = [ValueAdaptionScript]
        My.Computer.FileSystem.WriteAllText("C:\Program Files\MMI\dbcmmi.ini", My.Computer.FileSystem.ReadAllText("C:\Program Files\MMI\dbcmmi.ini").Replace("DE987654", [MachineID]), False)

        Return ActionResult.Success
    End Function

End Class

I do know that I need to do something with CustomActionData, bud that is prety much it. I looked it up on the Microsft website and a ton of other websites for some extra information bud I just don't seem to be able to get it working. I am not sure if it doesnt get the value from the installer or that the problem is in my script.

all the help would be appreciated,
thanks in advance,

F.J

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>