taking user input and save to file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Jonas DK
    Indigo Rose Customer
    • Jul 2004
    • 345

    taking user input and save to file

    Hi,

    I haven't played with MSI Factory since it was released, only making a few simple MSI installs using default settings.

    But now I have a project that needs some custom settings and I can't seem to find any info about it in the help files or on this forum (the new forum is very difficult to search effectively, the old one was better).

    The Problem:

    I am creating a package that installs a product and as part of the installation, after the user selects the install path I want to have a dialog that askes for a path to the databasefile. A dialog that is a copy of the InstallDir dialog.

    I then want to take the path in the database selection and save it to a sting that I can save in a lua script file that will be installed with the rest of the application, sort of a preconfiguration step, done directly in the installation.

    Any Ideas about this?

    My first setup was to make the installed application check for this sting on first run and if it was not set then set it. The application is build in AMS

    But the client wants if posible this step to take place in the msi installation process.

    Any help is much apreziated..

    Kind regards,
    Jonas
  • Ulrich
    Indigo Rose Staff Member
    • Apr 2005
    • 5130

    #2
    Originally posted by Jonas DK View Post
    I am creating a package that installs a product and as part of the installation, after the user selects the install path I want to have a dialog that askes for a path to the databasefile. A dialog that is a copy of the InstallDir dialog.

    I then want to take the path in the database selection and save it to a sting that I can save in a lua script file that will be installed with the rest of the application, sort of a preconfiguration step, done directly in the installation.

    Any Ideas about this?
    Well, you already have the idea. The question is now where exactly you are stuck. You can find several examples in this forum showing how to install into custom folders, and you know that the folder path the user selects in the InstallDirDlg gets saved in a MSI Property. There are ways to save this Property, for example, in the Registry, in an INI file, in a XML file, use it as a command line parameter for the shortcut, just to name a few options.

    Ulrich

    Comment

    • Jonas DK
      Indigo Rose Customer
      • Jul 2004
      • 345

      #3
      This is how it works now...

      Think I'll try playing around with MSI Factory.

      The plan is to create a dialog screen after the install dir screen that askes for a location to store the Database and then take the string of that path and concatenate it into a text file that is saved with the installation of the software to create a lua script file that will be read when the application is launched.

      At the moment the application checks to see if the file dblocation.lua exists in the application folder and if so it will be read with the dofile function.
      Code:
      if File.DoesExist(_SourceFolder.."\\Data\\dblocation.lua") == true then
      	dofile(_SourceFolder.."\\Data\\dblocation.lua");
      	Page.Jump("Start");
      else Page.Jump("FirstRun");
      end
      Else the application will goto a First Run page that asks for a path to save the database. that path is then concatenated into a string:
      Code:
      strInputText = Input.GetText("iDBFile");
      strInputText2 = String.Replace(strInputText, "\\", "\\\\", false);
      strPath = "xStore = \""..strInputText2.."\\\\xStore.jit\""
      TextFile.WriteFromString(_SourceFolder.."\\Data\\dblocation.lua", strPath, false);
      Page.Jump("Preload");
      When the Preload screen is loaded again the file now exists so the application will go to the start page.

      Basically the last code is what I want to move into the MSI package.

      I tried placing a new installDIR dialog in the installation and rename it , but somehow it is still linked to the InstallDir dialog and what I have trouble understanding is how to get the path selected on the DB dialog and run the last code above to create and install the dblocation.lua file on the fly.

      Comment

      • descheng
        Forum Member
        • Apr 2011
        • 10

        #4
        Your new dialog is still linked to the original one because the Translate checkbox is checked in your controls. Uncheck it for every controls and you'll be good to go.

        Comment

        • Jonas DK
          Indigo Rose Customer
          • Jul 2004
          • 345

          #5
          My analyses so far has let me to the following conclusion:

          I can not do what I want in the MSI installer as the MSI Installer can't create a new file on the fly.

          I can't get the path of the database install dir to a string and then using a lua function to build a lua script on the fly and save it to a file because the file dosent exist before the install has finished. I can't make it create a new file and then install the file.

          as the MSI Installer does not support the lua functions, is this is going to work I will need to wrap the msi file in a bootstrap that creates the dblocation.lua file after the MSI installer has finished installing the application.

          So the easiest way is to keep my First Run function in the application it self.
          or build an application that looks like the MSI installer and is run after the install has finished.

          Comment

          Working...
          X