Registry Path Confusion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • 3DTrains
    Forum Member
    • Nov 2007
    • 4

    Registry Path Confusion

    Changing from SUF 5 to v7 (trial), I'm having a tough time getting my head around the use of variables in locating an existing path on a user's sytem. The following is what I've tried thus far (in the Actions > On Startup box):

    Code:
    RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "EXE Path", true);
    if RegVar ~= "" then
    SessionVar.Set("%AppFolder%", RegVar);
    end
    and...

    Code:
    RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "EXE Path", true);
    result = Application.GetLastError();
    SessionVar.Set("%AppFolder%", RegVar);
    RegVar = SessionVar.Expand("%AppFolder%");
    Session Variables:

    Folder Defaults
    %RegVar% (entered in the right-side pane on the %AppFolder% line)

    When I run the resulting setup, the first code example returns "%RegVar%" into the path dialog, instead of the path taken from the registry. The second code example returns an empty field for the directory to be installed to. This was all fairly straight forward in SUF v5 and it worked fine, but I'm a bit lost in SUF v7.
  • Brett
    Indigo Rose Staff Member
    • Jan 2000
    • 2001

    #2
    If RegVar is meant to be a session variable (one that is expanded in text) then you need to change your last line to:

    SessionVar.Set("%RegVar%", SessionVar.Expand("%AppFolder%"));

    I would suggest that you read Chapter 5 o fthe User's Guide to get a more clear understanding of Session Variables.

    Comment

    • 3DTrains
      Forum Member
      • Nov 2007
      • 4

      #3
      Thank you, but I still get a literal "%ReVar%" in the path dialog after the setup has been compiled:

      Code:
      RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\My Application", "EXE Path", true);
      SessionVar.Set("%RegVar%", SessionVar.Expand("%AppFolder%"));
      I realize I'm missing something, but clueless as to what.

      Comment

      • 3DTrains
        Forum Member
        • Nov 2007
        • 4

        #4
        Missed the double '\\' in the path, and finally got it working.

        Code:
        RegVar = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "EXE Path", true);
        SessionVar.Set("%AppFolder%", RegVar);

        Comment

        Working...
        X