No announcement yet.

Conditionally open help file on successful installation

  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditionally open help file on successful installation

    On the "ExitDialog" dialog screen I have added a checkbox for determining if the help file should be opened when the "Finish" button clicked.

    I added a "Published Event" to the "Finish" button, to run conditionally if the checkbox is selected. The variable used for the condition is "IFLAUNCHHELP" and that is what I entered for the "Condition" field in the published event.

    The problem I have is when it comes to creating a "Custom Action" to open the file. I can create a custom action for "run executable" which works when I select an .exe file, but it doesn't work when I choose my help file (which is .htm file).

    That in part makes sense, as it's not an executable. So the question is: how do I get it to open the .htm file? (in it's default application)

    I have tried playing the the LUA script custom action type, but I am not comfortable with that, and wasn't even sure if it was the right path. If I need to use the LUA option, an example would be useful.


  • #2
    You can use the WixShellExec custom action to open the HTML file, which would open the file in the default editor/viewer associated with the extension - normally the default web browser. You should be able to insert this code via a WiX fragment, or using the method shown here.



    • #3
      Hi Ulrich,

      Thanks for the information and link. I was able to get it to open the help file as desired, however this causes us another issue:

      We need to generate the setup.exe file that would normally come when we use"Build Installer". We have some pre-requisite installs that get bootstrapped with it, and this doesn't seem to be included with the "make_setup.bat" method. However, running the Build Installer fails with errors related to duplicate symbols. Is there a workaround to avoid these errors with the Build Installer method?


      • #4
        If you used the method which requires to remove the mention of "WixCA", you need to build the MSI manually using the batch file. Once you have the MSI, go to the Bootstrapper Designer, open the current project and build this manually as well.

        If you insert a WiX fragment into the source files to add the WixShellExec action (with something like this), then you may be able to build everything in a single step.



        • #5
          OK, I will take a look into that too.

          Do you think my aim would be possible using a LUA Script Custom Action? I tried by simply create a script file with a single line of code for the File.Open function, but I wasn't sure what to use to specify the path. Can you assist with this? Basically the path I want is "[INSTALL DIRECTORY]\Help\Index.htm"

          Also, is there anyway to know if the script is being called? The reason I got so lost going down this route is because I didn't know if I had issue calling the action/script, or if I had errors in the script itself.


          • #6
            Yes, you can use a short Lua script as well, which would basically just call File.Open() to start the default viewer. You need to use something like
            folder = MSI.GetProperty(_hInstall, "INSTALLDIR");
            for getting the folder path where the product was installed, then build the path to the file with something similar to
            path = folder .. "\\myfilename.htm";
            and finally open the file with code like
            File.Open(path, folder, SW_SHOWNORMAL);
            -- Test for error
            error = Application.GetLastError();
            if (error ~= 0) then
            	Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            One simple way to debug your Lua scripts is using Dialog.Message(), or by writing a log into a text file with TextFile.WriteFromString(), for example.



            • #7
              That works great, Ulrich. It also removes the manual elements involved with the other methods.

              Thank you very much!