How to make an app - Andromo App Maker


No announcement yet.

A simple attempt to set %AppFolder% from a registry key value

  • Filter
  • Time
  • Show
Clear All
new posts

  • A simple attempt to set %AppFolder% from a registry key value

    Hello all, and experts

    I have been trying to get a seemingly simple task working all day, without success. I've looked at code examples and answers on this forum, but nothing seems to be working for me.

    Since I am evaluating SE8 to use for our commercial application installer, this stumbling block is preventing us from moving forward, so any help would be appreciated and get IndigoRose a sale

    What I want to achieve

    Pretty simple. I am installing an addon for Microsoft Flight Simulator X, and its registry key for the installation path is:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\microsoft games\flight simulator\10.0

    With a parameter of SetupPath which in this case has the value D:\Program Files\Microsoft Games\Microsoft Flight Simulator X

    So this value is what I want to use for the installer's %AppFolder% session variable because our addon gets installed into that folder.

    Most other installer tools we've tried have a very straight forward function to retrieve such registry key values and populate the installation path. Not so SE8, which seems to force me to learn coding in order to achieve this simple objective.

    What I've tried

    Somehow, the Session Variables window has lost its value for %AppFolder%, so it's blank. Not sure if this will cause issues, but from reading the forums here, I should be able to assign a new value to %AppFolder% at runtime.

    So in Project | Screens, I have a bunch of screens, including the "Verify Serial Number" screen followed by the "Select Install Folder" Screen.

    I tried attaching code to the 'Next>' button of Verify Serial Number to no avail.

    I am currently attaching the following code to the [Actions] tab of the 'Select Install Folder' screen:

    local strProgPath = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\microsoft games\flight simulator\10.0", "SetupPath");
    SessionVar.Set("%AppFolder%", strProgPath);
    This results in a blank input window for that screen at runtime.


    Please can you enlighten me on how I can provide a value for %AppFolder% which will be passed onto that window and also ensure my addon get installed into that path?

    Any answers will be very much appreciated. It really should not have to be so hard, LOL!

  • #2
    Actually, problem solved

    I saw Ulrich's post and used this code on the 'On Next' action from the Welcome To Setup screen:

    -- These actions are performed when the Next button is clicked.

    -- see if Flight Simulator X is installed and fetch the installed path
    if (Registry.DoesKeyExist(HKEY_CLASSES_ROOT, "Applications\\fsx.exe")) then
    -- fetch the current installation location at the proper place
    program = Registry.GetValue(HKEY_CLASSES_ROOT, "Applications\\fsx.exe\\shell\\open\\command", "", true)
    -- other operations
    path = String.Mid(program, 2, String.ReverseFind(program, "\\", false) - 1);
    -- set the destination folder
    SessionVar.Set("%AppFolder%", path);
    -- advance to the next screen (with AppFolder properly set)

    Now for my next challenge - how do I abort the installer if there is no registry key found for fsx.exe?